Skip to content

Commit

Permalink
Adding discrete_transmit_power to math_functions, and it's use in exc…
Browse files Browse the repository at this point in the history
…itation_function in base_classes. This allows the definition of an aperture with a specific total transmit power.
  • Loading branch information
LyceanEM committed May 29, 2024
1 parent 2c00f3a commit 07d9e0b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,4 @@ cython_debug/
# End of https://www.toptal.com/developers/gitignore/api/python
/examples/
/lyceanem/_version.py
/lyceanem/tests/rotation_tests.py
12 changes: 10 additions & 2 deletions lyceanem/base_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,11 +381,11 @@ def export_all_points(self, point_index=None):
def excitation_function(
self,
desired_e_vector,
transmit_amplitude=1,
point_index=None,
phase_shift="none",
wavelength=1.0,
steering_vector=np.zeros((1, 3)),
transmit_power=1.0
):
# generate the local excitation function and then convert into the global coordinate frame.
if point_index == None:
Expand All @@ -404,7 +404,15 @@ def excitation_function(
)
aperture_weights = aperture_weights * phase_weights.reshape(-1, 1)

return aperture_weights * transmit_amplitude
from .utility.math_functions import discrete_transmit_power
if 'Area' in aperture_points.point_data.keys():
areas=aperture_points.point_data['Area']
else:
areas=np.zeros((aperture_points.points.shape[0]))
areas[:]=wavelength**2

calibrated_amplitude_density=discrete_transmit_power(aperture_weights,areas,transmit_power)
return calibrated_amplitude_density


def export_all_structures(self):
Expand Down
23 changes: 23 additions & 0 deletions lyceanem/utility/math_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,29 @@ def calc_normals(T):

return T

def discrete_transmit_power(weights,element_area,transmit_power=100.0,impedance=np.pi*120.0):
"""
Calculate the transmitting aperture amplitude density required for a given transmit power in watts.
Parameters
----------
weights
element_area
transmit_power
impedance
Returns
-------
"""
#to start with assume area per element is consistent
power_at_point=np.abs(weights.reshape(-1,1))*element_area.reshape(-1,1) # calculate power
#integrate power over aperture and normalise to desired power for whole aperture
power_normalisation=transmit_power/np.sum(power_at_point)
transmit_power_density=(power_at_point*power_normalisation)/element_area.reshape(-1,1)
#calculate amplitude density
transmit_amplitude_density=(transmit_power_density*impedance)**0.5
transmit_excitation=transmit_amplitude_density.reshape(-1,1)*element_area.reshape(-1,1)*np.exp(1j*np.angle(weights.reshape(-1,1)))
return transmit_excitation

@guvectorize(
[(float32[:], float32[:], float32[:], float32)],
Expand Down

0 comments on commit 07d9e0b

Please sign in to comment.