Acoular 25.03 documentation

acoular.sources.get_modes

«  acoular.sources.get_radiation_angles   ::   sources   ::   spectra  »

acoular.sources.get_modes

acoular.sources.get_modes(lOrder, direction, mpos, sourceposition=None)

Calculate the spherical harmonic radiation pattern at microphone positions.

This function computes the spherical harmonic radiation pattern values at each microphone position for a given maximum spherical harmonic order (lOrder), orientation (direction), and optional source position (sourceposition).

Parameters:
lOrderint

The maximum order of spherical harmonics to compute. The resulting modes will include all orders up to and including lOrder.

directionnumpy.ndarray of shape (3,)

Unit vector representing the orientation of the spherical harmonics. Should contain 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,), optional

Position of the source in a 3D Cartesian coordinate system. If not provided, it defaults to the origin [0, 0, 0].

Returns:
numpy.ndarray of shape (N, (lOrder+1) ** 2)

Complex values representing the spherical harmonic radiation pattern at each microphone position (N microphones) for each spherical harmonic mode.

See also

get_radiation_angles()

Computes azimuth and elevation angles between microphones and the source.

scipy.special.sph_harm

Computes spherical harmonic values.

Notes

  • The azimuth (azi) and elevation (ele) angles between the microphones and the source are calculated using the get_radiation_angles() function.

  • Spherical harmonics (sph_harm) are computed for each mode (l, m), where l is the degree (ranging from 0 to lOrder) and m is the order (ranging from -l to +l).

  • For negative orders (m < 0), the conjugate of the spherical harmonic is computed and scaled by the imaginary unit 1j.

Examples

>>> import acoular as ac
>>> import numpy as np
>>>
>>> lOrder = 2
>>> direction = [0, 0, 1]  # Orientation along z-axis
>>> mpos = np.array([[1, -1], [1, -1], [0, 0]])  # Two microphones
>>> sourcepos = [0, 0, 0]  # Source at origin
>>>
>>> modes = ac.sources.get_modes(lOrder, direction, mpos, sourcepos)
>>> modes.shape
(2, 9)

«  acoular.sources.get_radiation_angles   ::   sources   ::   spectra  »