Electromagnetic Functions
- lyceanem.electromagnetics.emfunctions.Directivity(field_data)[source]
Calculate the directivity of the electric field vectors in the given field data. The function checks for the presence of the electric field components in both Cartesian (Ex, Ey, Ez) and spherical (E(theta), E(phi)) coordinates. If the components are present, it calculates the directivity for each component and adds them to the point data with appropriate labels.
- Parameters:
field_data (
meshio.Mesh
) – The field data containing the electric field components in either Cartesian or spherical coordinates as point data.- Returns:
field_data – The field data containing the directivity components for each electric field vector. The directivity is stored as
D(theta)
,D(phi)
, andD(Total)
- Return type:
meshio.Mesh
- lyceanem.electromagnetics.emfunctions.PoyntingVector(field_data)[source]
Calculate the poynting vector for the given field data. If the magnetic field data is present, then the poynting vector is calculated using the cross product of the electric and magnetic field vectors. If the magnetic field data is not present, then the poynting vector is calculated using the electric field vectors and the impedance of the material. If material parameters are not included in the field data, then the impedance is assumed to be that of free space. Measurement is a boolean value which indicates whether the field data represents measurements with a finite aperture, rather than point data. If measurement is True, then the aperture parameter must be provided, which is the area of the measurement aperture. This allows the power density at each measurement location to be calculated consistently with the point approach.
- Parameters:
field_data (
meshio.Mesh
) – The field data containing the electric field components in either cartesian format- Returns:
field_data – The field data containing the poynting vector in the point data. The poynting vector is stored as Poynting_Vector_(Magnitude_(W/m2)) and Poynting_Vector_(Magnitude_(dBW/m2)).
- Return type:
meshio.Mesh
- lyceanem.electromagnetics.emfunctions.calculate_atmospheric_propagation_constant(frequency, temperature, pressure, water_vapor_density)[source]
Calculate the propagation constant as a function of frequency (GHz), temperature (Celsius), atmospheric pressure (hectoPascals) and water vapour density (g/m^3). The complex propagation constant
, which includes both attenuation (
) and phase shift (
).
- Parameters:
- Returns:
propagation constant – The propagation constant in Np/m, which includes both attenuation (
) and phase shift (
).
- Return type:
- lyceanem.electromagnetics.emfunctions.calculate_oxygen_attenuation(frequency, pressure, temperature)[source]
Calculate the specific attenuation due to oxygen using the ITU-R P.676-11 model.
- lyceanem.electromagnetics.emfunctions.calculate_phase_constant(frequency, temperature, pressure, water_vapor_density)[source]
Calculate the phase constant as a function of frequency (GHz), temperature (Celsius), atmospheric pressure (hectoPascals) and water vapour density (g/m^3).
- lyceanem.electromagnetics.emfunctions.calculate_total_gaseous_attenuation(frequency, pressure, temperature)[source]
Calculate the total gaseous attenuation due to both oxygen and water vapor.
- lyceanem.electromagnetics.emfunctions.calculate_water_vapor_attenuation(frequency, pressure, temperature)[source]
Calculate the specific attenuation due to water vapor using the ITU-R P.676-11 model.
- lyceanem.electromagnetics.emfunctions.excitation_function(aperture_points, desired_e_vector, phase_shift='none', wavelength=1.0, steering_vector=array([[0., 0., 0.]]), transmit_power=1.0, local_projection=True)[source]
Calculate the excitation function for the given aperture points, desired electric field vector, phase shift, wavelength, steering vector, transmit power, and local projection. This will generate the normalised field intensities for the desired total transmit power, and beamforming algorithm. The aperture mesh should have Normals and Area associated with each point for full functionality.
- Parameters:
aperture_points (
meshio.Mesh
) – Aperture mesh containing the points to be used for the excitation function. The mesh should have point data containing ‘Normals’ and optionally ‘Area’.desired_e_vector (numpy.ndarray of float) – The desired electric field vector. If the local_projection flag is set to True, this vector will be projected based on the local surface normals of the aperture points. If not the provided vectors will be used regardless of local geometry.
phase_shift (str) – The phase shift can be set to ‘none’, ‘wavefront’, or ‘coherence’.
wavelength (float) – wavelength of interest in meters. This is used to calculate the phase shift for the wavefront or coherence beamforming algorithms. If the mesh does not contain Area point data then it will be used to generate arbitary, equal areas for each point.
steering_vector (numpy.ndarray of float) – Desired steering vector for the beamforming algorithm. This is used to calculate the phase shift for the wavefront or coherence beamforming algorithms.
transmit_power (float) – Total power to be transmitted by the aperture in Watts.
local_projection (bool) – The local projection flag indicates whether the electric field vectors should be projected based upon the local surface normals.
- Returns:
calibrated_amplitude_weights – The calibrated amplitude weights for the given aperture points, desired electric field vector, phase shift, wavelength, steering vector, and total transmit power.
- Return type:
- lyceanem.electromagnetics.emfunctions.extract_electric_fields(field_data)[source]
Return the electric field vectors in the provided mesh.
- Parameters:
field_data (
meshio.Mesh
) – The field data containing the electric field components in either cartesian format- Returns:
fields – The electric field vectors in the provided mesh. The shape of the array is (n_points, 3), where n_points is the number of points in the mesh.
- Return type:
- lyceanem.electromagnetics.emfunctions.field_magnitude_phase(field_data)[source]
Calculate the magnitude and phase of the electric field vectors in the given field data. The function checks for the presence of the electric field components in both Cartesian (Ex, Ey, Ez) and spherical (E(theta), E(phi)) coordinates. If the components are present, it calculates the magnitude and phase for each component and adds them to the point data.
- Parameters:
field_data (
meshio.Mesh
) – The field data containing the electric field components in either Cartesian or spherical coordinates.- Returns:
field_data – The field data containing the resultant magnitude and phase components for each electric field vector. The magnitude and phase are stored as
Ex-Magnitude
,Ex-Phase
,Ey-Magnitude
,Ey-Phase
,Ez-Magnitude
, andEz-Phase
for Cartesian coordinates, andE(theta)-Magnitude
,E(theta)-Phase
,E(phi)-Magnitude
, andE(phi)-Phase
for spherical coordinates.- Return type:
meshio.Mesh
- lyceanem.electromagnetics.emfunctions.field_vectors(field_data)[source]
Extract the electric field vectors from the field data in the meshio format. The function checks for the presence of the electric field components in Cartesian (Ex, Ey, Ez) format. If the components are present, it extracts them and returns them as a numpy array of float.
- Parameters:
field_data (
meshio.Mesh
) – The field data containing the electric field components in Cartesian format.- Returns:
directions – The alignment vector for each electric field vector in the mesh.
- Return type:
- lyceanem.electromagnetics.emfunctions.fresnel_zone(pointA, pointB, wavelength, zone=1)[source]
Based on the provided points, wavelength, and zone number, calculate the fresnel zone. This is defined as an ellipsoid for which the difference in distance between the line AB (line of sight), and AP+PB (reflected wave) is a constant multiple of (
).
- Parameters:
pointA (numpy.ndarray of float) – Point A as a number array of floats
pointB (numpy.ndarray of float) – Point B as a number array of floats
wavelength (float) – wavelength of interest
zone (int) – highest order Fresnel zone to be calculated. The default is 1, which is the first order fresnel zone.
- Returns:
ellipsoid – A meshio object representing the fresnel zone, allowing for visualisation and boolean operations for decimating a larger triangle mesh.
- Return type:
meshio.Mesh
- lyceanem.electromagnetics.emfunctions.update_electric_fields(field_data, ex, ey, ez)[source]
Updates the electric field components in the provided field data mesh.
- Parameters:
field_data (
meshio.Mesh
) – The field data which requires updating with new electric field components.ex (numpy.ndarray of complex)
ey (numpy.ndarray of complex)
ez (numpy.ndarray of complex)
- Returns:
field_data – The updated field data containing the new electric field components in the point data.
- Return type:
meshio.Mesh