Acoular 25.03 documentation

acoular.sources.get_radiation_angles

«  acoular.sources.spherical_hn1   ::   sources   ::   acoular.sources.get_modes  »

acoular.sources.get_radiation_angles

acoular.sources.get_radiation_angles(direction, mpos, sourceposition)

Calculate the azimuthal and elevation angles between the microphones and the source.

The function computes the azimuth (azi) and elevation (ele) angles between each microphone position and the source position, taking into account the orientation of the spherical harmonics provided by the parameter direction.

Parameters:
directionnumpy.ndarray of shape (3,)

Unit vector representing the spherical harmonic orientation. It should be a 3-element array corresponding to the x, y, and z components of the direction.

mposnumpy.ndarray of shape (3, N)

Microphone positions in a 3D Cartesian coordinate system. The array should have 3 rows (the x, y and z coordinates) and N columns (one for each microphone).

sourcepositionnumpy.ndarray of shape (3,)

Position of the source in a 3D Cartesian coordinate system. It should be a 3-element array corresponding to the x, y, and z coordinates of the source.

Returns:
azinumpy.ndarray of shape (N,)

Azimuth angles in radians between the microphones and the source. The range of the values is \([0, 2\pi)\).

elenumpy.ndarray of shape (N,)

Elevation angles in radians between the microphones and the source. The range of the values is \([0, \pi]\).

See also

numpy.linalg.norm()

Computes the norm of a vector.

numpy.arctan2()

Computes the arctangent of two variables, preserving quadrant information.

Notes

  • The function accounts for a coordinate system transformation where the z-axis in Acoular corresponds to the y-axis in spherical coordinates, and the y-axis in Acoular corresponds to the z-axis in spherical coordinates.

  • The elevation angle (ele) is adjusted to the range \([0, \pi]\) by adding \(\pi/2\) after the initial calculation.

Examples

>>> import acoular as ac
>>> import numpy as np
>>>
>>> direction = [1, 0, 0]
>>> mpos = np.array([[1, 2], [0, 0], [0, 1]])  # Two microphones
>>> sourceposition = [0, 0, 0]
>>> azi, ele = ac.sources.get_radiation_angles(direction, mpos, sourceposition)
>>> azi
array([0.       , 5.8195377])
>>> ele
array([4.71238898, 4.71238898])

«  acoular.sources.spherical_hn1   ::   sources   ::   acoular.sources.get_modes  »