You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
""" Run a k-wave simulation for the given transducer array and parameters.
102
+
Args:
103
+
arr: The transducer array to simulate.
104
+
params: The simulation parameters as an xarray Dataset. Must include 'sound_speed', '
105
+
density', and 'attenuation' variables with appropriate units.
106
+
delays: Optional array of time delays for each element in the transducer array, in seconds. If None, no delays will be applied.
107
+
apod: Optional array of apodization values for each
108
+
element in the transducer array. If None, no apodization will be applied.
109
+
freq: The frequency of the input signal in Hz. Default is 1 MHz.
110
+
cycles: The number of cycles in the input signal. Default is 20.
111
+
amplitude: The amplitude of the input signal. Default is 1.
112
+
dt: The time step for the simulation in seconds. If 0, it will be automatically calculated based on the CFL condition.
113
+
t_end: The total time for the simulation in seconds. If 0, it will be automatically calculated based on the input signal duration and the CFL condition.
114
+
cfl: The Courant-Friedrichs-Lewy (CFL) number for the simulation. Default is 0.5.
115
+
bli_tolerance: The tolerance for the boundary layer integral method used in k-wave. Default
116
+
is 0.05.
117
+
upsampling_rate: The upsampling rate for the boundary layer integral method used in k-wave
118
+
Default is 5.
119
+
gpu: Whether to use GPU for the simulation. Default is True. If False, the simulation will run on the CPU. Note that running on CPU may be very slow for large simulations.
120
+
ref_values_only: Whether to use only the reference values for the medium properties (sound speed, density, attenuation) instead of the full spatial maps. Default is False. Setting this to True can significantly speed up the simulation, but will not capture any spatial variations in the medium properties.
121
+
return_kwave_outputs: Whether to return the raw outputs from k-wave in addition to the processed xarray Dataset. Default is False.
122
+
return_kwave_inputs: Whether to return the inputs to k-wave (kgrid, source, sensor, medium) in addition to the processed xarray Dataset. Default is False.
123
+
sensor_record: List of strings specifying which k-wave sensor outputs to record. Can include '
124
+
p_max', 'p_min', and 'p'. Default is ['p_max', 'p_min'].
125
+
126
+
Additional Args:
127
+
_source: Optional kSource object to use for the simulation. If None, a source will be created based on the transducer array and input signal.
128
+
_sensor: Optional kSensor object to use for the simulation. If None, a sensor
129
+
130
+
Returns:
131
+
An xarray Dataset containing the simulation results, with variables corresponding to the requested sensor outputs and
132
+
coordinates corresponding to the spatial dimensions of the simulation. If return_kwave_outputs is True, also returns a dictionary containing the raw outputs from k-wave. If return_kwave_inputs is True, also returns a dictionary containing the inputs to k-wave.
Copy file name to clipboardExpand all lines: src/openlifu/xdc/transducer.py
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -58,6 +58,12 @@ class Transducer:
58
58
sensitivity: Annotated[float|None, OpenLIFUFieldData("Sensitivity", "Sensitivity of the element (Pa/V)")] =None
59
59
"""Sensitivity of the element (Pa/V)"""
60
60
61
+
crosstalk_frac: Annotated[float, OpenLIFUFieldData("Crosstalk fraction", "Fraction of the signal that leaks into other elements due to crosstalk")] =0.0
62
+
"""Fraction of the signal that leaks into other elements due to crosstalk"""
63
+
64
+
crosstalk_dist: Annotated[float, OpenLIFUFieldData("Crosstalk distance", "Distance within which elements experience crosstalk")] =0.0
65
+
"""Distance within which elements experience crosstalk"""
66
+
61
67
impulse_response: Annotated[np.ndarray|None, OpenLIFUFieldData("Impulse response", "Impulse response of the element")] =None
62
68
"""Impulse response of the element, can be a single value or an array of values. If an array, `impulse_dt` must be set to the time step of the impulse response. Is convolved with the input signal."""
0 commit comments