vbeam.core.element_geometry

vbeam.core.element_geometry#

A datastructure for representing a transducer element (or the full array), including the position, orientation, etc.

class vbeam.core.element_geometry.ElementGeometry(*args, **kwargs)[source]#

A vectorizable container of element geometry.

ElementGeometry is vectorizable, meaning that it works with vmap. This way we can represent the element geometry for all probe elements in a single object.

If an ElementGeometry object contains multiple elements then each field will have an additional dimension. For example, position may have the shape (64, 3) if there are 64 elements (each with x, y, and z coordinates).

with_updates_to(*, position: ~typing.Callable[[~numpy.ndarray], ~numpy.ndarray] = <function <lambda>>, theta: ~typing.Callable[[float], float] = <function <lambda>>, phi: ~typing.Callable[[float], float] = <function <lambda>>, sub_elements: ~typing.Callable[[~vbeam.core.element_geometry.ElementGeometry], ~vbeam.core.element_geometry.ElementGeometry] = <function <lambda>>, parent_element: ~typing.Callable[[~vbeam.core.element_geometry.ElementGeometry], ~vbeam.core.element_geometry.ElementGeometry] = <function <lambda>>) ElementGeometry[source]#

Return a copy with updated values for the given fields.

If the given value for a field is a function the updated field will be that function applied to the current field. Example: >>> element_geometry = ElementGeometry(np.array([0, 0, 0]), 1, 2) >>> element_geometry.with_updates_to(position=lambda x: x+1) ElementGeometry(position=array([1, 1, 1]), theta=1, phi=2, sub_elements=None)

If the given value for a field is not a function then the field will simply be set to that value. Example: >>> element_geometry.with_updates_to(theta=5, phi=6) ElementGeometry(position=array([0, 0, 0]), theta=5, phi=6, sub_elements=None)