LyceanEM Base

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.

cartesian_points()[source]

exports the cartesian points for all pattern points.

directivity()[source]
Returns:

  • Dtheta (numpy array) – directivity for Etheta farfield

  • Dphi (numpy array) – directivity for Ephi farfield

  • Dtotal (numpy array) – overall directivity pattern

  • Dmax (numpy array) – the maximum directivity for each pattern

display_pattern(plottype='Polar', desired_pattern='both', pattern_min=-40, plot_max=0)[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

export_ffe(path, source_name='Antenna Export')[source]

Export Antenna Pattern as .ffe file for import by FEKO, and programs supporting this format. This export assumes that the pattern frequency property has been populated, and translates the azimuth and elevation coordinates into theta/phi coordinates in the range 0-180 and 0-360 respectively.

Parameters:
  • path

  • source_name

export_global_weights()[source]

Calculates the global frame coordinates and xyz weightings of the antenna pattern using the pattern pose to translate and rotate into the correction position and orientation within the model environment. If this function is used as a source for models, then the antenna pattern pose must be updated for the desired position and orientation before export.

Returns:

  • points

  • weights

export_pattern(file_location)[source]

takes the file location and exports the pattern as a .dat file unfinished, must be in Etheta/Ephi format,

Parameters:

file_location (pathlib.Path) – the path for the output file, including name

Return type:

None

import_ffe(file_path)[source]

tested for .ffe files with theta in the range 0 to 180 degrees, and phi in the range -180 to 180 degrees :param file_path:

import_pattern(file_location)[source]

takes the file location and imports the individual pattern file, replacing exsisting values with those of the saved file.

It is import to note that for CST ASCII export format, that you select a plot range of -180 to 180 for phi, and that by defauly CST exports from 0 to 180 in theta, which is the opposite direction to the default for LyceanEM, so this data structures are flipped for consistency.

Parameters:

location (file) – file location

Return type:

None

initilise_pattern()[source]

pattern initialisation function, providing an isotopic pattern or quasi-isotropic pattern

Return type:

Populated antenna pattern

resample_pattern(old_points, old_pattern, new_points)[source]
Parameters:
  • old_points (float xyz) – xyz coordinates that the pattern has been sampled at

  • old_pattern (2 or 3 by n complex array of the antenna pattern at the old_poitns) – DESCRIPTION.

  • new_points (desired_grid points in xyz float array) – DESCRIPTION.

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 (3x3 numpy float array) – 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

transmute_pattern(desired_format='Etheta/Ephi')[source]

convert the pattern from Etheta/Ephi format to Ex, Ey,Ez format, or back again

class lyceanem.base_classes.antenna_structures(structures, points)[source]

Dedicated class to store information on a specific antenna, including aperture points as open3d.geometry.PointCloud data structures, and structure shapes as open3d.geometry.TriangleMesh data 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

rotate_antenna(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 within the local coordinate system

Parameters:
  • rotation_matrix (open3d rotation matrix) – o3d.geometry.TriangleMesh.get_rotation_matrix_from_xyz(rotation_vector)

  • rotation_centre (1*3 numpy float array) – centre of rotation for the structures

Return type:

None

translate_antenna(vector)[source]

translates the structures and points in the class by the given cartesian vector (x,y,z) within the local coordinate system

Parameters:

vector (1*3 numpy array of floats) – The desired translation vector for the antenna

Return type:

None

visualise_antenna(extras=[], origin=True)[source]

This function uses open3d to display the antenna structure in the local coordinate frame

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.

cartesian_points()[source]

exports the cartesian points for all pattern points.

directivity()[source]
Returns:

  • Dtheta (numpy array) – directivity for Etheta farfield

  • Dphi (numpy array) – directivity for Ephi farfield

  • Dtotal (numpy array) – overall directivity pattern

  • Dmax (numpy array) – 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

initilise_pattern()[source]

pattern initialisation function, providing an isotopic pattern or quasi-isotropic pattern

Return type:

Populated antenna pattern

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 open3d.geometry.TriangleMesh data 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 (open3d.geometry.PointCloud) – 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 2d array) – the coordinates of all the poitns

  • normals (numpy 2d array) – 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_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 (open3d rotation matrix) – o3d.geometry.TriangleMesh.get_rotation_matrix_from_xyz(rotation_vector)

  • rotation_centre (1*3 numpy float array) – centre of rotation for the structures

Return type:

None

translate_points(vector)[source]

translates the point clouds in the class by the given cartesian vector (x,y,z)

Parameters:

vector (1*3 numpy array of floats) – The desired translation vector 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 open3d.geometry.TriangleMesh data 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 (open3d.geometry.TriangleMesh) – the solid to be added to the structure

Return type:

None

export_vertices(structure_index=None)[source]

Exports the vertices for either all or the indexed point clouds, transformed to the global coordinate frame.

Parameters:

structure_index (list) – list of structures of interest for vertices export

Return type:

point_cloud

import_cad(posixpath, scale=1.0, center=array([[0.], [0.], [0.]]))[source]

Import trianglemesh from cad format, with scalling factor is requried. Open3d supports .ply, .stl, .obj, .off, and .gltf/.glb files :param posixpath: file address to cad file to import :param scale: scalling factor to account for units which are not SI.

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 (open3d rotation matrix) – o3d.geometry.TriangleMesh.get_rotation_matrix_from_xyz(rotation_vector)

  • rotation_centre (1*3 numpy float array) – 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 (1*3 numpy array of floats) – The desired translation vector for the structures

Return type:

None

triangles_base_raycaster()[source]

generates the triangles for all the open3d.geometry.TriangleMesh objects in the structure, and outputs them as a continuous array of triangle_t format triangles

Parameters:

None

Returns:

triangles – a continuous array of all the triangles in the structure

Return type:

N by 1 numpy array of triangle_t triangles