kwave.ksensor module

class kSensor[source]

Bases: object

__init__(mask=None, record=None)[source]
expand_grid(expand_size)[source]

Enlarge the sensor mask (for Cartesian sensor masks and cuboid corners, this has already been converted to a binary mask for display in inputChecking)

Parameters:

expand_size – the number of elements to add in each dimension

Returns:

None

Return type:

None

property mask

Binary matrix or a set of Cartesian points where the pressure is recorded at each time-step

property record_start_index

Time index to start recording if transducer is used as a sensor

class kSensorDirectivity[source]

Bases: object

kSensorDirectivity(angle: numpy.ndarray = None, pattern: str = ‘pressure’, size: float = None, unique_angles: numpy.ndarray = None, wavenumbers: numpy.ndarray = None)

__init__(angle=None, pattern='pressure', size=None, unique_angles=None, wavenumbers=None)
Parameters:
  • angle (ndarray | None)

  • pattern (str)

  • size (float | None)

  • unique_angles (ndarray | None)

  • wavenumbers (ndarray | None)

Return type:

None

angle: ndarray = None

matrix of directivity angles (direction of maximum response) for each sensor element defined in sensor.mask. The angles are in radians where 0 = max sensitivity in x direction (up/down) and pi/2 or -pi/2 = max sensitivity in y direction (left/right)

pattern: str = 'pressure'

string defining the directivity pattern, valid inputs are ‘pressure’ (spatial averaging over the sensor surface equivalent to a sinc function) and ‘gradient’

set_default_size(kgrid)[source]

Set the element size based on the kGrid

Parameters:

kgrid – Instance of ~kwave.kgrid.kWaveGrid class

Returns:

None

Return type:

None

set_unique_angles(sensor_mask)[source]

Assign unique_angles from sensor_mask

Parameters:

sensor_mask

Returns:

None

Return type:

None

set_wavenumbers(kgrid)[source]

Assign the wavenumber vectors

Parameters:

kgrid – Instance of ~kwave.kgrid.kWaveGrid class

Returns:

None

Return type:

None

size: float = None

equivalent element size (the larger the element size the more directional the response)

unique_angles: ndarray = None

list of the unique directivity angles

wavenumbers: ndarray = None

It is precomputed to allow data casting, as kgrid.kx (etc) are computed on the fly.