openlifu.sim.sim_setup.SimSetup¶
- class openlifu.sim.sim_setup.SimSetup(spacing: "Annotated[float, OpenLIFUFieldData('Spacing', 'Simulation grid spacing')]" = 1.0, units: "Annotated[str, OpenLIFUFieldData('Spatial units', 'Units used for spatial measurements')]" = 'mm', x_extent: "Annotated[Tuple[float, float], OpenLIFUFieldData('X-extent', 'Simulation grid extent along the first dimension')]" = (-30.0, 30.0), y_extent: "Annotated[Tuple[float, float], OpenLIFUFieldData('Y-extent', 'Simulation grid extend along the second dimension')]" = (-30.0, 30.0), z_extent: "Annotated[Tuple[float, float], OpenLIFUFieldData('Z-extent', 'Simulation grid extend along the third dimension')]" = (-4.0, 60.0), dt: "Annotated[float, OpenLIFUFieldData('Time step', 'Simulation time step')]" = 0.0, t_end: "Annotated[float, OpenLIFUFieldData('End time', 'Simulation end time')]" = 0.0, c0: "Annotated[float, OpenLIFUFieldData('Speed of Sound (m/s)', 'Reference speed of sound for converting distance to time')]" = 1500.0, cfl: "Annotated[float, OpenLIFUFieldData('CFL number', 'Courant-Friedrichs-Lewy number')]" = 0.3, options: "Annotated[dict[str, str], OpenLIFUFieldData('Simulation options', 'Additional simulation options')]" = <factory>)[source]¶
Bases:
DictMixin- c0: Annotated[float, OpenLIFUFieldData(name='Speed of Sound (m/s)', description='Reference speed of sound for converting distance to time')] = 1500.0¶
Reference speed of sound for converting distance to time
- cfl: Annotated[float, OpenLIFUFieldData(name='CFL number', description='Courant-Friedrichs-Lewy number')] = 0.3¶
Courant-Friedrichs-Lewy number
- dt: Annotated[float, OpenLIFUFieldData(name='Time step', description='Simulation time step')] = 0.0¶
Simulation time step
- static from_dict(d: dict, on_keyword_mismatch: Literal['warn', 'raise', 'ignore'] = 'warn') SimSetup[source]¶
Create a SimSetup instance from a dictionary.
- options: Annotated[dict[str, str], OpenLIFUFieldData(name='Simulation options', description='Additional simulation options')]¶
Additional simulation options
- setup_sim_scene(seg_method: SegmentationMethod, volume: DataArray | None = None) Tuple[DataArray, Transducer, Point][source]¶
Prepare a simulation scene composed of a simulation grid
Setup a simulation scene with a simulation grid including physical properties. A segmentation is performed to detect the medium, so we can assign physical properties to each voxel, later used by the ultrasound simulation. This assume that the input volume is resampled to the geo-referenced simulation grid (lon, lat, ele).
- Parameters:
seg_method – seg.SegmentationMethod
volume – xa.DataArray Optional volume to be used for simulation grid definition (Default: None). The volume is assumed to be resampled on sim grid coordinates.
- Returns
params: The xa.DataArray simulation grid with physical properties for each voxel
- spacing: Annotated[float, OpenLIFUFieldData(name='Spacing', description='Simulation grid spacing')] = 1.0¶
Simulation grid spacing
- t_end: Annotated[float, OpenLIFUFieldData(name='End time', description='Simulation end time')] = 0.0¶
Simulation end time
- to_table() DataFrame[source]¶
Get a table of the simulation setup parameters
- Returns:
Pandas DataFrame of the simulation setup parameters
- units: Annotated[str, OpenLIFUFieldData(name='Spatial units', description='Units used for spatial measurements')] = 'mm'¶
Units used for spatial measurements
- x_extent: Annotated[Tuple[float, float], OpenLIFUFieldData(name='X-extent', description='Simulation grid extent along the first dimension')] = (-30.0, 30.0)¶
Simulation grid extent along the first dimension
- y_extent: Annotated[Tuple[float, float], OpenLIFUFieldData(name='Y-extent', description='Simulation grid extend along the second dimension')] = (-30.0, 30.0)¶
Simulation grid extend along the second dimension
- z_extent: Annotated[Tuple[float, float], OpenLIFUFieldData(name='Z-extent', description='Simulation grid extend along the third dimension')] = (-4.0, 60.0)¶
Simulation grid extend along the third dimension