vbeam.core.wavefront#

Wavefront models that return the distance that a wave has traveled. TransmittedWavefront models the transmitted wave while ReflectedWavefront models a reflected/backscattered wave.

Wavefront models return a distance in meters. This way they are decoupled from the speed of sound of the medium.

class vbeam.core.wavefront.TransmittedWavefront[source]#

The base class for defining wavefront models of transmitted waves.

TransmittedWavefront models are used to calculate the distance (in meters) from a sending element to a point. This distance, along with the distance returned from ReflectedWavefront and when divided by a speed-of-sound, can be used to delay the signal of a receiving element.

Most TransmittedWavefront models return a single distance for a wave. However, it may optionally return more than one distance value in the form of a MultipleTransmitDistances object. This is useful for wavefront models that sample multiple distances for a single transmit.

Examples

We can create a simple synthetic transmit aperture (STA) wavefront model where a single sender element sends out a spherical wavefront. The returned distance is then simply the euclidean distance between the sender and point. To illustrate the use of MultipleTransmitDistances, we also add a small smoothing to the distance by averaging with two small delays (+/- 0.1 millimeters):

>>> class TransmittedWavefront(Wavefront):
...     def __call__(self, sender, point_position, wave_data):
...         # Simply get the distance from sender to point (assume STA)
...         dist = distance(sender.position, point_position)
...         # Smooth the dist by averaging with the two neighboring distances
...         dist = jnp.array([dist - 1e-4, dist, dist + 1e-4])
...         # Weights for the three different delayed signal samples
...         weights = jnp.array([0.2, 0.6, 0.2])
...         return MultipleTransmitDistances(
...             dist,
...             # The samples values are aggregated by a weighted sum
...             lambda samples: np.sum(samples * weights),
...         )
class vbeam.core.wavefront.ReflectedWavefront(*args, **kwargs)[source]#

The base class for defining wavefront models of reflected/backscattered waves.

This is usually just the euclidian distance as there are limits to what we can model.

class vbeam.core.wavefront.MultipleTransmitDistances(values: ndarray, aggregate_samples: Callable[[ndarray, ndarray], ndarray] | None = None)[source]#

Multiple distance values returned from a TransmittedWavefront.

Some more advanced TransmittedWavefront models may return multiple distances for a transmitted wave. In this case, each returned distance will be used to delay the element signals, and the delayed samples will be combined using the function set in aggregate_samples. The aggregate_samples function may for example weight the delayed signals differently before summing.

See reference to MultipleTransmitDistances in signal_for_point() for implementation details.

Mathematical operators applied to the MultipleTransmitDistances object will apply them to the values attribute as if it was just a numpy array.

values#

The distance values that will be used to delay the element signals.

Type:

np.ndarray

aggregate_samples#

A function that will be used to combine the delayed samples into one value, for example as a weighted sum. If None, the samples will be averaged.

Type:

Callable[[np.ndarray, np.ndarray], np.ndarray]