Skip to content

openstb.simulator.system.transducer

Classes:

Name Description
GenericTransducer

A generic transducer.

GenericTransducer

GenericTransducer(position, orientation, beampattern=None)

Bases: Transducer

A generic transducer.

Parameters:

Name Type Description Default
position ArrayLike

The position of the transducer relative to the system origin.

required
orientation ArrayLike | QArray

The orientation of the transducer boresight relative to the x axis of the system.

required
beampattern PluginOrSpec[Distortion] | None

The distortion model of the beampattern.

None
Source code in openstb/simulator/system/transducer.py
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
def __init__(
    self,
    position: ArrayLike,
    orientation: ArrayLike | quaternionic.QArray,
    beampattern: PluginOrSpec[Distortion] | None = None,
):
    """
    Parameters
    ----------
    position
        The position of the transducer relative to the system origin.
    orientation
        The orientation of the transducer boresight relative to the x axis of the
        system.
    beampattern
        The distortion model of the beampattern.

    """
    self._position = np.array(position, dtype=float)
    if self._position.shape != (3,):
        raise ValueError(_("position should be a 3-element vector"))

    try:
        self._orientation = quaternionic.array(orientation)
    except ValueError:
        raise ValueError(_("transducer orientation must be a valid quaternion"))
    if self._orientation.shape != (4,):
        raise ValueError(_("transducer orientation must be a single quaternion"))

    if beampattern is None:
        self._distortion = []
    else:
        self._distortion = [distortion(beampattern)]