tidy3d.plugins.microwave.LobeMeasurer#
- class LobeMeasurer[source]#
Bases:
Tidy3dBaseModel
Tool for detecting and analyzing lobes in antenna radiation patterns, along with their characteristics such as direction and beamwidth.
- Parameters:
attrs (dict = {}) – Dictionary storing arbitrary metadata for a Tidy3D object. This dictionary can be freely used by the user for storing data without affecting the operation of Tidy3D as it is not used internally. Note that, unlike regular Tidy3D fields,
attrs
are mutable. For example, the following is allowed for setting anattr
obj.attrs['foo'] = bar
. Also note that Tidy3D` will raise aTypeError
ifattrs
contain objects that can not be serialized. One can check ifattrs
are serializable by callingobj.json()
.angle (ArrayLike[dtype=float, ndim=1]) – A 1-dimensional array of angles in radians. The angles should be in the range [0, 2π] and should be sorted in ascending order.
radiation_pattern (ArrayLike[dtype=float, ndim=1]) – A 1-dimensional array of real values representing the radiation pattern of the antenna measured on a linear scale.
apply_cyclic_extension (bool = True) – To enable accurate peak finding near boundaries of the
angle
array, we need to extend the signal using its periodicity. If lobes near the boundaries are not of interest, this can be set toFalse
.width_measure (ConstrainedFloatValue = 0.5) – Relative magnitude of the lobes at which the beamwidth is measured. Default value of
0.5
corresponds with the half-power beamwidth.min_lobe_height (ConstrainedFloatValue = 0.001) – Only lobes in the radiation pattern with heights above this value are found. Lobe heights are measured relative to the maximum value in
radiation_pattern
.null_threshold (ConstrainedFloatValue = 0.001) – The threshold for detecting nulls, which is relative to the maximum value in the
radiation_pattern
.
Example
>>> theta = np.linspace(0, 2 * np.pi, 301, endpoint=False) >>> Urad = np.cos(theta) ** 2 * np.cos(3 * theta) ** 2 >>> lobe_measurer = LobeMeasurer( ... angle=theta, ... radiation_pattern=Urad) >>> lobe_measures = lobe_measurer.lobe_measures
Attributes
The lobe measures as a pandas
pandas.DataFrame
with the following columns:Properties of the main lobe.
Properties of all side lobes.
The sidelobe level returned on a linear scale.
Methods
cyclic_extension
(angle, signal)This helper function extends the given signal array by leveraging its periodic nature.
plot
(lobe_index, ax[, include_beamwidth, ...])Annotate an existing
matplotlib
axis with lobe locations and widths.Inherited Common Usage
- angle#
- radiation_pattern#
- apply_cyclic_extension#
- width_measure#
- min_lobe_height#
- null_threshold#
- property lobe_measures#
The lobe measures as a pandas
pandas.DataFrame
with the following columns:direction
: The angular position of the lobe peak.magnitude
: The height of the lobe peak.beamwidth
: The width of the lobe at the specified beamwidth measure.beamwidth magnitude
: The magnitude at which the beamwidth is measured.beamwidth bounds
: The bounds of the lobe at the the beamwidth measure.FNBW
: The first null beam width (FNBW) of the lobe.FNBW bounds
: The locations of the nulls on either side of the lobe.
- Returns:
A DataFrame containing all lobe measures, where rows indicate the lobe index.
- Return type:
DataFrame
- static cyclic_extension(angle, signal)[source]#
This helper function extends the given signal array by leveraging its periodic nature. It ensures that the peak finding algorithm in Scipy can reliably detect peaks near the minimum and maximum values of the
angle
array. The returned arrays are extended to the range [-π, 3π).- Parameters:
angle (ArrayLike) – The array of angles, expected to be in the range [0, 2π].
signal (ArrayLike) – The array of signal values corresponding to the angle array.
- Returns:
A tuple containing the extended angle and signal arrays.
- Return type:
tuple[ArrayLike, ArrayLike]
- property main_lobe#
Properties of the main lobe.
- property side_lobes#
Properties of all side lobes.
- property sidelobe_level#
The sidelobe level returned on a linear scale.
- plot(lobe_index, ax, include_beamwidth=True, include_FNWB=True)[source]#
Annotate an existing
matplotlib
axis with lobe locations and widths.- Parameters:
lobe_index (int) – Index of the lobe to plot from the
lobe_measures
.ax (Ax) –
matplotlib
axis on which to plot the lobe measure.include_beamwidth (bool, optional) – If True, plot the beamwidth markers and fill the beamwidth region.
include_FNWB (bool, optional) – If True, plot the First Null Beam Width markers and fill the FNBW region.
- Returns:
The matplotlib axis with the plotted lobe measures.
- Return type:
Ax
- __hash__()#
Hash method.