Grids¶
Loading grids¶
- waveport.load_grid(path: str | Path, geometry: GridGeometry | None = None) list[Grid]¶
Load a grid file given its path
The function takes the name of the file containing the grid and returns a
Gridobject:import waveport cut = waveport.load_grid("my_antenna_pattern.grid")
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 grid files. If you are unsure, leave the default (
None).
- waveport.loads_grid(contents: str, geometry: waveport._core.GridGeometry | None = None) list[waveport._core.Grid]¶
Parse a string containing the contents of a TICRA grid file
This function accepts a text string that contains the contents of a TICRA grid 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_grid()if the file you want to load was compressed using GZip or BZip2, as the function handles the decompression automatically.
The Grid class¶
- class waveport.Grid¶
The contents of a TICRA grid file
This class contains all the information loaded from a
.grdfile.It is typically instantiated by the functions
loads_grid()(which reads the contents from a pre-loaded text string) andload_grid()(which takes a filename as parameter and loads its contents).- property coefficients¶
The components of the electric field \(\vec E\)
This is a NumPy array of rank 3 and shape
(n_y, n_x, n_comp), wheren_xis the fastest-varying angle andn_ythe slowest-varying angle. The value ofn_compis either 2 or 3, whether the simulation was done in the near or far field.The value of
n_yis the same asGrid.num_of_values_along_y,n_xis the same asGrid.num_of_values_along_x, andn_compis the same asGrid.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 component_type¶
The way the polarization vector is encoded.
This type specifies the axes used to decompose the electric vector \(\vec E\) along the two transverse directions. Refer to the TICRA User’s manual for an explanation of each of these entries.
- property frequency_hz¶
The frequency used to compute the coefficients
Frequency (in Hz) used to compute the values of the electric field on the grid.
- property geometry¶
The type of geometry used in the grid
This is an enumeration
GridGeometrythat describes the kind of geometry that was used in the grid.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_grid()orload_grid().
- property grid_type¶
Kind of parameterization used for the grid
This is an instance of the
GridTypeenum that specifies how the grid was defined.
- property num_of_values_along_x¶
Number of values sampled along the X component
The X component is typically an angle, and it is the fastest-varying one.
- property num_of_values_along_y¶
Number of values sampled along the Y component
The Y component is typically an angle, and it is the slowest-varying one.
- property x_vector¶
The array of values for the X component
The X component is typically an angle, and it is the fastest-varying one.
- property y_vector¶
The array of values for the Y component
The Y component is typically an angle, and it is the slowest-varying one.