Cuts

Loading cuts

waveport.load_cut(path: str | Path, geometry: CutGeometry | None = None) → list[Cut]

Load a cut file given its path

The function takes the name of the file containing the cut and returns a Cut object:

import waveport

cut = waveport.load_cut("my_antenna_pattern.cut")

The function is able to automatically decompress .gz and .bz2 files.

The geometry parameter is needed to specify the kind of geometry used in the file, as TICRA does not record this information in cut files. If you are unsure, leave the default (None).

waveport.loads_cut(contents: str, geometry: waveport._core.CutGeometry | None = None) → list[waveport._core.Cut]

Parse a string containing the contents of a TICRA cut file

This function accepts a text string that contains the contents of a TICRA cut file. It should be used whenever a file is not physically present on a storage device but was received by any other means, e.g., through a socket or as the output of a decompression program.

Note that you can use load_cut() if the file you want to load was compressed using GZip or BZip2, as the function handles the decompression automatically.

The Cut class

class waveport.Cut

The contents of a TICRA Cut file

This class contains all the information loaded from a .cut file.

It is typically instantiated by the functions loads_cut() (which reads the contents from a pre-loaded text string) and load_cut() (which takes a filename as parameter and loads its contents).

angles() → ndarray

Return a NumPy array containing the list of angles that vary in the cut.

The angle that varies can either be ϑ (polar angle) or φ (azimuthal angle). To decide what is the case, refer to Cut.mode.

Angles are expressed in degrees.

property coefficients

The coefficients of the cut

This is a NumPy array of rank 2 with shape (n_points, n_components), where n_points is the number of points along the cut and n_components is either 2 or 3, depending whether it is a near field or far field simulation.

The value of n_points is the same as Cut.num_of_values_in_cut, while n_components is the same as Cut.component_count.

property component_count

The number of components per sample.

It can be one of the following values:

  • 2: only the tangential components of the electric vector are recorded (far field)

  • 3: the three components of the electric vector are recorded (near field)

property constant_angle

Value of the angle that is kept constant in the cut

The actual angle is determined by the value in Cut.mode:

  • FIXED_AZIMUTH: the constant angle is φ (azimuth angle), while ϑ varies

  • VARYING_AZIMUTH: the constant angle is ϑ (polar angle), while φ varies

The angle is expressed in degrees.

property geometry

The type of geometry used in the cut

The geometry type is expressed through the type CutGeometry.

A word of caution: the TICRA cut file format does not encode the geometry in the file. This information must be usually provided externally, i.e., through the parameter geometry when calling loads_cut() or load_cut().

property increment

Angle between two consecutive samples

Angle (in degrees) between two consecutive samples in Cut.coefficients. This is the increment used in the field Cut.angles.

property init_value

First angle in the cut

Angle (in degrees) of the first sample in Cut.coefficients. This is the value of the first element in the array Cut.angles.

property mode

Type: waveport._core.CutMode

property num_of_values_in_cut

Number of angles sampled by the cut

This is the number of elements in the array Cut.angles.

property type

Type: waveport._core.CutType | None

Enumerations

class waveport.CutGeometry(*values)

The geometry used in a TICRA cut file

This type is used to record the kind of geometry used in a TICRA cut file.

SPHERICAL = 0
PLANAR = 1
SURFACE = 2
CYLINDRICAL = 3
class waveport.CutMode(*values)

Which angle in the cut is varying

This type is used to indicate whether the cut was computed along the ϑ (polar) or φ (azimuthal) angle.

  • FIXED_AZIMUTH: the constant angle is φ (azimuth angle), while ϑ varies

  • VARYING_AZIMUTH: the constant angle is ϑ (polar angle), while φ varies

FIXED_AZIMUTH = 1
VARYING_AZIMUTH = 2
class waveport.CutType(*values)

Type of cut

This type is used to indicate the coordinates used to extract the cut. Refer to the TICRA User’s manual to get the proper definition of each coordinate system.

POLAR_SPHERICAL = 0
CONICAL_SPHERICAL = 1
RADIAL_PLANAR = 2
CIRCULAR_PLANAR = 3
RADIAL_SURFACE = 4
CIRCULAR_SURFACE = 5
AXIAL_CYLINDRICAL = 6
CIRCULAR_CYLINDRICAL = 7