Directivity¶
The directivity module provides tools to work with directivity.
The following conventions are used within this module:
- The inclination angle \(\theta\) has a range \([0, \pi]\).
- The azimuth angle \(\phi\) has a range \([0 , 2 \pi]\).
-
class
acoustics.directivity.
Custom
(theta=None, phi=None, r=None)[source]¶ A class to work with directivity.
-
phi
= None¶ Longitude. 1-D array.
-
r
= None¶ Magnitude or radius. 2-D array.
-
theta
= None¶ Latitude. 1-D array.
-
-
class
acoustics.directivity.
Directivity
(rotation=None)[source]¶ Abstract directivity class.
This class defines several methods to be implemented by subclasses.
-
plot
(filename=None, include_rotation=True)[source]¶ Directivity plot. Plot to
filename
when given.Parameters: - filename – Filename
- include_rotation – Apply the rotation to the directivity. By default the rotation is applied in this figure.
-
rotation
= None¶ Rotation of the directivity pattern.
-
-
class
acoustics.directivity.
Omni
(rotation=None)[source]¶ Class to work with omni-directional directivity.
-
class
acoustics.directivity.
SphericalHarmonic
(rotation=None, m=None, n=None)[source]¶ Directivity of a spherical harmonic of degree n and order m.
-
__init__
(rotation=None, m=None, n=None)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
m
= None¶ Order m.
-
n
= None¶ Degree n.
-
-
acoustics.directivity.
cardioid
(theta, a=1.0, k=1.0)[source]¶ A cardioid pattern.
Parameters: - a – a
- k – k
-
acoustics.directivity.
cartesian_to_spherical
(x, y, z)[source]¶ Convert cartesian coordinates to spherical coordinates.
Parameters: - x – x
- y – y
- z – z
\[r = \sqrt{\left( x^2 + y^2 + z^2 \right)}\]\[\theta = \arccos{\frac{z}{r}}\]\[\phi = \arccos{\frac{y}{x}}\]
-
acoustics.directivity.
figure_eight
(theta, phi=0.0)[source]¶ A figure-of-eight pattern.
Parameters: theta – angle \(\theta\)
-
acoustics.directivity.
plot
(d, sphere=False)[source]¶ Plot directivity d.
Parameters: d ( Directivity
) – DirectivityReturns: Figure