LyceanEM Base
- lyceanem.base_types.ray_t = Record([('ox', {'type': float32, 'offset': 0, 'alignment': None, 'title': None, }), ('oy', {'type': float32, 'offset': 4, 'alignment': None, 'title': None, }), ('oz', {'type': float32, 'offset': 8, 'alignment': None, 'title': None, }), ('dx', {'type': float32, 'offset': 12, 'alignment': None, 'title': None, }), ('dy', {'type': float32, 'offset': 16, 'alignment': None, 'title': None, }), ('dz', {'type': float32, 'offset': 20, 'alignment': None, 'title': None, }), ('dist', {'type': float32, 'offset': 24, 'alignment': None, 'title': None, }), ('intersect', {'type': bool, 'offset': 28, 'alignment': None, 'title': None, })], 32, True)
A Numba type representing a ray in 3D space, based on a numpy record array.
- ox, oy, oz
Coordinates of the origin of the ray.
- Type:
- dx, dy, dz
Direction vector of the ray.
- Type:
- lyceanem.base_types.scattering_t = Record([('px', {'type': float32, 'offset': 0, 'alignment': None, 'title': None, }), ('py', {'type': float32, 'offset': 4, 'alignment': None, 'title': None, }), ('pz', {'type': float32, 'offset': 8, 'alignment': None, 'title': None, }), ('vx', {'type': float32, 'offset': 12, 'alignment': None, 'title': None, }), ('vy', {'type': float32, 'offset': 16, 'alignment': None, 'title': None, }), ('vz', {'type': float32, 'offset': 20, 'alignment': None, 'title': None, }), ('nx', {'type': float32, 'offset': 24, 'alignment': None, 'title': None, }), ('ny', {'type': float32, 'offset': 28, 'alignment': None, 'title': None, }), ('nz', {'type': float32, 'offset': 32, 'alignment': None, 'title': None, }), ('ex', {'type': complex64, 'offset': 36, 'alignment': None, 'title': None, }), ('ey', {'type': complex64, 'offset': 44, 'alignment': None, 'title': None, }), ('ez', {'type': complex64, 'offset': 52, 'alignment': None, 'title': None, }), ('permittivity', {'type': complex64, 'offset': 60, 'alignment': None, 'title': None, }), ('permeability', {'type': complex64, 'offset': 68, 'alignment': None, 'title': None, }), ('Electric', {'type': bool, 'offset': 76, 'alignment': None, 'title': None, })], 80, True)
A Numba type representing a scattering point in 3D space, based on a numpy record array.
- px, py, pz
Coordinates of the scattering point.
- Type:
- vx, vy, vz
Velocity vector of the scattering point. Not used in the current implementation.
- Type:
- nx, ny, nz
Normal vector at the scattering point.
- Type:
- ex, ey, ez
Electric field components at the scattering point.
- Type:
- lyceanem.base_types.triangle_t = Record([('v0x', {'type': float32, 'offset': 0, 'alignment': None, 'title': None, }), ('v0y', {'type': float32, 'offset': 4, 'alignment': None, 'title': None, }), ('v0z', {'type': float32, 'offset': 8, 'alignment': None, 'title': None, }), ('v1x', {'type': float32, 'offset': 12, 'alignment': None, 'title': None, }), ('v1y', {'type': float32, 'offset': 16, 'alignment': None, 'title': None, }), ('v1z', {'type': float32, 'offset': 20, 'alignment': None, 'title': None, }), ('v2x', {'type': float32, 'offset': 24, 'alignment': None, 'title': None, }), ('v2y', {'type': float32, 'offset': 28, 'alignment': None, 'title': None, }), ('v2z', {'type': float32, 'offset': 32, 'alignment': None, 'title': None, })], 36, True)
A Numba type representing a triangle in 3D space, based on a numpy record array.
- v0x, v0y, v0z
Coordinates of the first vertex of the triangle.
- Type:
- v1x, v1y, v1z
Coordinates of the second vertex of the triangle.
- Type:
- v2x, v2y, v2z
Coordinates of the third vertex of the triangle.
- Type:
- class lyceanem.base_classes.antenna_pattern(azimuth_resolution=37, elevation_resolution=37, pattern_frequency=1000000000.0, arbitary_pattern=False, arbitary_pattern_type='isotropic', arbitary_pattern_format='Etheta/Ephi', file_location=None)[source]
Antenna Pattern class which allows for patterns to be handled consistently across LyceanEM and other modules. The definitions assume that the pattern axes are consistent with the global axes set. If a different orientation is required, such as a premeasured antenna in a new orientation then the pattern rotate_function must be used.
Antenna Pattern Frequency is in Hz Rotation Offset is Specified in terms of rotations around the x, y, and z axes as roll,pitch/elevation, and azimuth in radians.
- arbitary_pattern
If True, the antenna pattern is an arbitrary pattern defined by the arbitary_pattern_type options
- Type:
- arbitary_pattern_type
The type of arbitrary antenna pattern, options include “isotropic”, “xhalfspace”, “yhalfspace”, and “zhalfspace”.
- Type:
- arbitary_pattern_format
The format of the arbitrary antenna pattern, options include “Etheta/Ephi” and “ExEyEz”.
- Type:
- file_location
The file location of the antenna pattern file to be imported. If None, an arbitrary pattern will be created.
- Type:
str, optional
- directivity()[source]
- Returns:
Dtheta (numpy.ndarray of float) – directivity for Etheta farfield
Dphi (numpy.ndarray of float) – directivity for Ephi farfield
Dtotal (numpy.ndarray of float) – overall directivity pattern
Dmax (numpy.ndarray of float) – the maximum directivity for each pattern
- display_pattern(plottype='Polar', desired_pattern='both', pattern_min=-40, plot_max=0, plotengine='matplotlib')[source]
Displays the Antenna Pattern using
lyceanem.electromagnetics.beamforming.PatternPlot()- Parameters:
plottype (str) – the plot type, either [Polar], [Cartesian-Surf], or [Contour]. The default is [Polar]
desired_pattern (str) – the desired pattern, default is [both], but is Pattern format is ‘Etheta/Ephi’ then options are [Etheta] or [Ephi], and if Pattern format is ‘ExEyEz’, then options are [Ex], [Ey], or [Ez].
pattern_min (float) – the desired scale minimum in dB, the default is [-40]
- Return type:
None
- initilise_pattern()[source]
pattern initialisation function, providing an isotopic pattern or quasi-isotropic pattern
- Return type:
Populated antenna pattern
- pattern_mesh()[source]
Create pyvista structured grid mesh from the antenna pattern data.
- Returns:
mesh – A structured grid mesh representing the antenna pattern.
- Return type:
pyvista.StructuredGrid
- resample_pattern(old_points, old_pattern, new_points)[source]
- Parameters:
old_points (numpy.ndarray of float) – xyz coordinates that the pattern has been sampled at
old_pattern (numpy.ndarray of complex) – 2 or 3 by n complex array of the antenna pattern at the old_points
new_points (numpy.ndarray of complex) – desired_grid points in xyz float array
- Return type:
new points, new_pattern
- resample_pattern_angular(new_azimuth_resolution, new_elevation_resolution)[source]
resample pattern based upon provided azimuth and elevation resolution
- rotate_pattern(rotation_matrix=None)[source]
Rotate the self pattern from the assumed global axes into the new direction
- Parameters:
new_axes (numpy.ndarray of float) – the new vectors for the antenna x,y,z axes
- Returns:
Updates self.pattern with the new pattern reflecting the antenna
orientation within the global models
- class lyceanem.base_classes.antenna_structures(structures, points)[source]
Dedicated class to store information on a specific antenna, including aperture points as
meshio.Meshdata structures, and structure shapes asmeshio.Meshdata structures. Everything in the class will be considered an integrated unit, rotating and moving together. This inherits functions from the structures and points classes.This class will be developed to include material parameters to enable more complex modelling.
Units should be SI, metres
- structures
The structures associated with the antenna, which can be used to calculate the antenna’s properties and behaviour.
- Type:
- points
The points associated with the antenna, which can be used to calculate the antenna’s properties and behaviour.
- Type:
- excitation_function(desired_e_vector, point_index=None, phase_shift='none', wavelength=1.0, steering_vector=array([[0., 0., 0.]]), transmit_power=1.0, local_projection=True)[source]
Calculate the excitation weights for the antenna aperture points based upon the desired electric field vector.
- Parameters:
desired_e_vector (numpy.ndarray of float) – The desired electric field vector to be achieved at the aperture points, in the form of a 3D vector.
point_index (list, optional) – A list of indices for the aperture points meshes to be used. If None, all points will be used.
phase_shift (str, optional) – The phase shift to be applied to the excitation weights. Default is “none”, which applies no beamforming.
wavelength (float, optional) – The wavelength of interest in metres. Default is 1.0.
steering_vector (numpy.ndarray of float, optional) – A 3D vector representing the command direction, if phase_shift is not “none”. Default is a zero vector.
transmit_power (float, optional) – The total power to be transmitted by the antenna aperture in watts. Default is 1.0.
local_projection (bool, optional) – If True, the excitation weights will be projected onto the local coordinate system of the antenna. Default is True.
- Returns:
excitation_weights
- Return type:
- export_all_points(point_index=None)[source]
Exports all the points in the antenna structure as a
meshio.Meshpoint cloud, transforming them to the global coordinate system
- pyvista_export()[source]
Export the aperture points and structures as easy to visualize pyvista objects.
- Returns:
aperture_meshes (list) – aperture meshes included in the antenna structure class
structure_meshes (list) – list of the triangle mesh objects in the antenna structure class
- rotate_antenna(rotation_vector, rotation_centre=array([[0.], [0.], [0.]], dtype=float32))[source]
Rotates the antenna structures and points around a common point, default is the origin.
- Parameters:
rotation_vector (numpy.ndarray of float) – The rotation vector to be applied to the structures and points. This can be a 3x1 or 3x3 array, or a single 3D vector.
rotation_centre (numpy.ndarray of float, optional) – The centre of rotation for the structures and points. Default is the origin (0, 0, 0).
- Return type:
None
- class lyceanem.base_classes.array_pattern(azimuth_resolution=37, elevation_resolution=37, pattern_frequency=1000000000.0, arbitary_pattern=False, arbitary_pattern_type='isotropic', arbitary_pattern_format='Etheta/Ephi', position_mapping=array([0., 0., 0.], dtype=float32), rotation_offset=array([0., 0., 0.], dtype=float32), elements=2)[source]
Array Pattern class which allows for patterns to be handled consistently across LyceanEM and other modules. The definitions assume that the pattern axes are consistent with the global axes set. If a different orientation is required, such as a premeasured antenna in a new orientation then the pattern rotate_function must be used.
Antenna Pattern Frequency is in Hz Rotation Offset is Specified in terms of rotations around the x, y, and z axes as roll,pitch/elevation, and azimuth in radians.
- directivity()[source]
- Returns:
Dtheta (numpy.ndarray of float) – directivity for Etheta farfield
Dphi (numpy.ndarray of float) – directivity for Ephi farfield
Dtotal (numpy.ndarray of float) – overall directivity pattern
Dmax (numpy.ndarray of float) – the maximum directivity for each pattern
- display_pattern(plottype='Polar', desired_pattern='both', pattern_min=-40)[source]
Displays the Antenna Array Pattern using
lyceanem.electromagnetics.beamforming.PatternPlot()and the stored weights- Parameters:
plottype (str) – the plot type, either [Polar], [Cartesian-Surf], or [Contour]. The default is [Polar]
desired_pattern (str) – the desired pattern, default is [both], but is Pattern format is ‘Etheta/Ephi’ then options are [Etheta] or [Ephi], and if Pattern format is ‘ExEyEz’, then options are [Ex], [Ey], or [Ez].
pattern_min (float) – the desired scale minimum in dB, the default is [-40]
- Return type:
None
- class lyceanem.base_classes.points(points=None)[source]
Structure class to store information about the geometry and materials in the environment, holding the seperate shapes as
meshio.Meshdata structures. Everything in the class will be considered an integrated unit, rotating and moving together. This class will be developed to include material parameters to enable more complex modelling.Units should be SI, metres
This is the default class for passing structures to the different models.
- add_points(new_points)[source]
adds a component or components from the structure
- Parameters:
new_points (
meshio.Mesh) – the point cloud to be added to the point cloud collection- Return type:
None
- create_points(points, normals)[source]
create points within the class based upon the provided numpy arrays of floats in local coordinates
- Parameters:
points (numpy.ndarray) – the coordinates of all the points
normals (numpy.ndarray) – the normal vectors of each point
- Return type:
None
- export_points(point_index=None)[source]
combines all the points in the collection as a combined point cloud for modelling
- Return type:
combined points
- remove_points(deletion_index)[source]
removes a component or components from the class
- Parameters:
deletion_index (list) – list of integers or numpy array of integers to the solids to be removed
- Return type:
None
- rotate_points(rotation_vector, rotation_centre=array([[0.], [0.], [0.]], dtype=float32))[source]
rotates the components of the structure around a common point, default is the origin
- Parameters:
rotation_matrix (numpy.ndarray of floats) – [3,1] numpy array
rotation_centre (numpy.ndarray of floats) – [3,1] centre of rotation for the structures
- Return type:
None
- class lyceanem.base_classes.structures(solids=None)[source]
Structure class to store information about the geometry and materials in the environment, holding the seperate shapes as
meshio.Meshdata structures. Everything in the class will be considered an integrated unit, rotating and moving together. This class will be developed to include material parameters to enable more complex modelling.Units should be SI, metres
This is the default class for passing structures to the different models.
- add_structure(new_solids)[source]
adds a component or components from the structure
- Parameters:
new_solids (
meshio.Mesh) – the solid to be added to the structure- Return type:
None
- export_combined_meshio()[source]
Combines all the structures in the collection as a combined mesh for modelling
- Returns:
combined mesh – A combined mesh of all the structures in the collection, with normals if available.
- Return type:
meshio.Mesh
- remove_structure(deletion_index)[source]
removes a component or components from the class
- Parameters:
deletion_index (list) – list of integers or numpy array of integers to the solids to be removed
- Return type:
None
- rotate_structures(rotation_matrix, rotation_centre=array([[0.], [0.], [0.]], dtype=float32))[source]
rotates the components of the structure around a common point, default is the origin
- Parameters:
rotation_matrix (numpy.ndarray of floats) – [4,4] numpy array
rotation_centre (numpy.ndarray of floats) – [3,1] centre of rotation for the structures
- Return type:
None
- translate_structures(vector)[source]
translates the structures in the class by the given cartesian vector (x,y,z)
- Parameters:
vector (numpy.ndarray of floats) – The desired translation vector for the structures
- Return type:
None
- triangles_base_raycaster()[source]
generates the triangles for all the
meshio.Meshobjects in the structure, and outputs them as a continuous array ofbase_types.triangle_ttriangles- Parameters:
None
- Returns:
triangles – a continuous array of all the triangles in the structure
- Return type:
numpy.ndarray of
base_types.triangle_ttriangles