Skip to content

openstb.simulator.distortion.beampattern

Classes:

Name Description
RectangularBeampattern

Scaling due to the beampattern of an ideal rectangular aperture.

RectangularBeampattern

RectangularBeampattern(width, height, transmit, receive, frequency, horizontal=True, vertical=True)

Bases: Distortion

Scaling due to the beampattern of an ideal rectangular aperture.

Parameters:

Name Type Description Default
width float

The size of the aperture in metres.

required
height float

The size of the aperture in metres.

required
transmit bool

Whether to apply this for the transmited and/or received signal. At least one of these must be True.

required
receive bool

Whether to apply this for the transmited and/or received signal. At least one of these must be True.

required
frequency "min", "centre", "max", "all

Which frequency or frequencies to calculate the attenuation at. If "min" or "max", use the minimum or maximum frequency in the signal, respectively. When "centre", use the centre frequency, i.e., (min + max) / 2. If "all", calculate the attenuation at each frequency being sampled in the simulation.

"min"
horizontal Boolean

Whether to include the horizontal and/or vertical components of the beampattern in the scaling. At least one of these must be true.

True
vertical Boolean

Whether to include the horizontal and/or vertical components of the beampattern in the scaling. At least one of these must be true.

True
Source code in openstb/simulator/distortion/beampattern.py
17
18
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
def __init__(
    self,
    width: float,
    height: float,
    transmit: bool,
    receive: bool,
    frequency: str,
    horizontal: bool = True,
    vertical: bool = True,
):
    """
    Parameters
    ----------
    width, height : float
        The size of the aperture in metres.
    transmit, receive: Boolean
        Whether to apply this for the transmited and/or received signal. At least
        one of these must be True.
    frequency : {"min", "centre", "max", "all}
        Which frequency or frequencies to calculate the attenuation at. If "min" or
        "max", use the minimum or maximum frequency in the signal, respectively.
        When "centre", use the centre frequency, i.e., (min + max) / 2. If "all",
        calculate the attenuation at each frequency being sampled in the simulation.
    horizontal, vertical : Boolean, default True
        Whether to include the horizontal and/or vertical components of the
        beampattern in the scaling. At least one of these must be true.


    """
    # Check the size.
    if not width > 0:
        raise ValueError(_("width of aperture must be positive"))
    if not height > 0:
        raise ValueError(_("height of aperture must be positive"))
    self.width = width
    self.height = height

    # Check when to apply.
    self.transmit = transmit
    self.receive = receive
    if not self.transmit and not self.receive:
        raise ValueError(_("at least one of transmit and receive must be true"))

    # Which frequency to evaluate at.
    if frequency == "min":
        self._freqmode = 0
    elif frequency == "max":
        self._freqmode = 1
    elif frequency == "centre":
        self._freqmode = 2
    elif frequency == "all":
        self._freqmode = 3
    else:
        raise ValueError(
            _("unknown value for frequency: {value}").format(value=frequency)
        )

    # Components to include.
    self.horizontal = horizontal
    self.vertical = vertical
    if not self.horizontal and not self.vertical:
        raise ValueError(_("at least one of horizontal and vertical must be true"))