src.acoustools.Mesh.Filename
1import torch 2 3from torch import Tensor 4from vedo import Mesh 5 6def board_name(board:Tensor) -> str: 7 ''' 8 Returns the name for a board, TOP and/or BOTTOM, used in cache system 9 :param board: The board to use 10 :return: name of board as `<'TOP'><'BOTTOM'><M>` for `M` transducers in the boards 11 ''' 12 M = board.shape[0] 13 14 top = "TOP" if 1 in torch.sign(board[:,2]) else "" 15 bottom = "BOTTOM" if -1 in torch.sign(board[:,2]) else "" 16 return top+bottom+str(M) 17 18def scatterer_file_name(scatterer:Mesh) ->str: 19 ''' 20 Get a unique name to describe a scatterer position, calls `str(scatterer.coordinates)` 21 ONLY USE TO SET FILENAME, USE `scatterer.filename` TO GET 22 :param scatterer: The Mesh to use 23 :return: Scatterer name 24 25 ''' 26 27 f_name = str(list(scatterer.coordinates)) + str(scatterer.cell_normals) 28 return f_name
def
board_name(board: torch.Tensor) -> str:
9def board_name(board:Tensor) -> str: 10 ''' 11 Returns the name for a board, TOP and/or BOTTOM, used in cache system 12 :param board: The board to use 13 :return: name of board as `<'TOP'><'BOTTOM'><M>` for `M` transducers in the boards 14 ''' 15 M = board.shape[0] 16 17 top = "TOP" if 1 in torch.sign(board[:,2]) else "" 18 bottom = "BOTTOM" if -1 in torch.sign(board[:,2]) else "" 19 return top+bottom+str(M)
Returns the name for a board, TOP and/or BOTTOM, used in cache system
Parameters
- board: The board to use
Returns
name of board as
<'TOP'><'BOTTOM'><M>forMtransducers in the boards
def
scatterer_file_name(scatterer: vedo.mesh.core.Mesh) -> str:
21def scatterer_file_name(scatterer:Mesh) ->str: 22 ''' 23 Get a unique name to describe a scatterer position, calls `str(scatterer.coordinates)` 24 ONLY USE TO SET FILENAME, USE `scatterer.filename` TO GET 25 :param scatterer: The Mesh to use 26 :return: Scatterer name 27 28 ''' 29 30 f_name = str(list(scatterer.coordinates)) + str(scatterer.cell_normals) 31 return f_name
Get a unique name to describe a scatterer position, calls str(scatterer.coordinates)
ONLY USE TO SET FILENAME, USE scatterer.filename TO GET
Parameters
- scatterer: The Mesh to use
Returns
Scatterer name