Utility Functions

Math Functions

lyceanem.utility.math_functions.discrete_transmit_power(weights, element_area, transmit_power=100.0, impedance=376.99111843077515)[source]

Calculate the transmitting aperture voltages required for a given transmit power in watts.

Parameters:
  • weights (numpy.ndarray of complex) – The complex weights for each mesh point, representing the magnitude and phase of the electric field at each point.

  • element_area (numpy.ndarray of float) – the area of each mesh point, representing the effective area of the antenna element at that point.

  • transmit_power (float) – The total power to be transmitted by the antenna aperture in watts.

  • impedance (float, optional) – The impedance of the medium in ohms. Default is the impedance of free space (approximately 377 ohms).

Returns:

polarized_amplitudes – The complex amplitudes at each mesh point, representing the electric field amplitude intensity and phase at each point, scaled to the desired transmit power.

Return type:

numpy.ndarray of complex

Mesh Functions

lyceanem.utility.mesh_functions.id_cells(faces)[source]

Identify cell ids

Parameters:

faces (numpy.ndarray of int) – The faces of the mesh.

Returns:

meshio_cells – A list of tuples containing the cell type and the cell data.

Return type:

list

lyceanem.utility.mesh_functions.meshio_to_pyvista(meshio_object)[source]

Convert a meshio object to a pyvista object.

Parameters:

meshio_object (meshio.Mesh) – The meshio object to convert.

Returns:

pyvista_object – The converted pyvista object.

Return type:

pyvista.PolyData or pyvista.UnstructuredGrid

lyceanem.utility.mesh_functions.points2pointcloud(xyz)[source]

turns numpy array of xyz data into a meshio format point cloud

Parameters:

xyz (numpy.ndarray of float) – The xyz data to convert. The shape of the array should be (n, 3) or (n, 1, 3). If the shape is (n, 1, 3), it will be reshaped to (n, 3).

Returns:

new_point_cloud – The converted meshio point cloud.

Return type:

meshio.Mesh

lyceanem.utility.mesh_functions.pyvista_to_meshio(polydata_object)[source]

Convert a pyvista object to a meshio object, if pyvista >=0.45, use to_meshio method.

Parameters:

polydata_object (pyvista.PolyData or pyvista.UnstructuredGrid) – The pyvista object to convert.

Returns:

meshio_object – The converted meshio object.

Return type:

meshio.Mesh