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 parameterdirection.- Parameters:
- direction
numpy.ndarrayof shape(3,) Unit vector representing the spherical harmonic orientation. It should be a 3-element array corresponding to the
x,y, andzcomponents of the direction.- mpos
numpy.ndarrayof shape(3, N) Microphone positions in a 3D Cartesian coordinate system. The array should have 3 rows (the
x,yandzcoordinates) andNcolumns (one for each microphone).- sourceposition
numpy.ndarrayof shape(3,) Position of the source in a 3D Cartesian coordinate system. It should be a 3-element array corresponding to the
x,y, andzcoordinates of the source.
- direction
- Returns:
- azi
numpy.ndarrayof shape(N,) Azimuth angles in radians between the microphones and the source. The range of the values is \([0, 2\pi)\).
- ele
numpy.ndarrayof shape(N,) Elevation angles in radians between the microphones and the source. The range of the values is \([0, \pi]\).
- azi
See also
numpy.linalg.norm()Computes the norm of a vector.
numpy.arctan2Computes 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 they-axis in spherical coordinates, and they-axis in Acoular corresponds to thez-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])