round_decimals (int, optional) – Decimal precision used for sampling.radius. All radii must be
identical to compute the sampling weights. This can be used to ignore
numerical noise on the radii. The default is 12.
Generate sampling of the sphere with equally spaced angles.
This sampling contain points at the North and South Pole. See
equiangular, gaussian, and
great_circle for samplings that do not contain points at the
poles.
Parameters:
delta_angles (tuple, number) – Tuple that gives the angular spacing in azimuth and colatitude in
degrees. If a number is provided, the same spacing is applied in both
dimensions.
radius (number, optional) – Radius of the sampling grid. The default is 1.
Sampling based on partitioning into faces with equal area.
The implementation is based on [3] and Leopardi’s MATLAB implementation.
Parameters:
n_max (int) – Spherical harmonic order
condition_num (double) – Desired maximum condition number of the spherical harmonic basis
matrix. Default is 2.5.
n_points (int, optional) – Number of points to start the condition number optimization. If set to
None the value (n_max+1)**2 will be used as start.
Default is None.
Returns:
sampling – SamplingSphere object containing all sampling points
For detailed information, see [4], Chapter 3.2. This is a quadrature
sampling with the sum of the sampling weights in sampling.weights
being \(4\pi\) if the number of rings is even and the number of
points in azimuth and elevation are equal. This condition is always
fulfilled if the number of points is chosen through n_max.
This sampling does not contain points at the North and South Pole and is
typically used for spherical harmonics processing. See
equal_angle and great_circle for samplings
containing points at the poles.
Parameters:
n_max (int) – Maximum applicable spherical harmonic order. If this is provided,
‘n_points’ is set to 2*n_max+1. Either n_points or
n_max must be provided. The default is None.
n_points (int, tuple of two ints) – Number of sampling points in azimuth and elevation. Either n_points
or n_max must be provided. The default is None.
radius (number, optional) – Radius of the sampling grid. The default is 1.
Returns:
sampling – Sampling positions including sampling weights.
Create a cubic sampling with equidistant spacings in x, y, and z.
The cuboid spans from -1 m to 1 m along each axis and is centered at
the origin.
Parameters:
n_points (int, tuple) – Number of points in the sampling. If a single value is given, the
number of sampling positions will be the same in every axis. If a
tuple is given, the number of points will be set as
(n_x,n_y,n_z).
flatten_output (bool, optional) – Whether to flatten the output Coordinates object or not.
The default is False.
Returns:
sampling – Sampling positions as Coordinate object with cshape
(n_x,n_y,n_z) if flatten_output is False, otherwise
with cshape (n_x*n_y*n_z,).
Does not contain sampling weights.
This is intended to be a quadrature sampling with positive sampling
weights summing to \(4\pi\). For unknown reasons, this is not the
case for orders 10, 12, 18, 20, 24, 26, 27, and 29. For this reason,
the respective weights are not returned regardless of the order.
Parameters:
n_max (int) – Maximum applicable spherical harmonic order.
It must be between 1 and 29.
radius (number, optional) – Radius of the sampling grid in meters. The default is 1.
Returns:
sampling – (n_max+1)**2 sampling positions without sampling weights
(see note above).
Generate sampling of the sphere based on the Gaussian quadrature.
For detailed information, see [7] (Section 3.3). This is a quadrature
sampling with the sum of the sampling weights in sampling.weights
being \(4\pi\).
This sampling does not contain points at the North and South Pole and is
typically used for spherical harmonics processing. See
equal_angle and great_circle for samplings
containing points at the poles.
Parameters:
n_max (int) – Maximum applicable spherical harmonic order. Results in
2*(n_max+1) in azimuth and n_max+1 points in elevation.
radius (number, optional) – Radius of the sampling grid in meters. The default is 1.
Returns:
sampling – Sampling positions including sampling weights.
Spherical sampling grid according to the great circle distance criterion.
Sampling grid where neighboring points of the same elevation have approx.
the same great circle distance across elevations [8].
Parameters:
elevation (array like, optional) – Contains the elevation from wich the sampling grid is generated, with
\(-90^\circ\leq elevation \leq 90^\circ\) (\(90^\circ\):
North Pole, \(-90^\circ\): South Pole). The default is
np.linspace(-90,90,19).
gcd (number, optional) – Desired great circle distance (GCD). Note that the actual GCD of the
sampling grid is equal or smaller then the desired GCD and that the GCD
may vary across elevations. The default is 10.
radius (number, optional) – Radius of the sampling grid in meters. The default is 1.
azimuth_res (number, optional) – Minimum resolution of the azimuth angle in degree. The default is
1.
match (number, optional) – Forces azimuth entries to appear with a period of match degrees. E.g.,
if match=90, the grid includes the azimuth angles 0, 90, 180, and
270 degrees. The default is 360.
After Sloan and Womersley [9]. The samplings are available for
spherical harmonics orders \(1 \leq n_\text{max} \leq 200\). The number
of points in the sampling grid equals \((n_\text{max} + 1)^2\).
Parameters:
n_max (int) – Maximum applicable spherical harmonic order. It must be
between 1 and 200.
radius (number, optional) – Radius of the sampling grid in meters. The default is 1.
Returns:
sampling – Sampling positions including sampling weights, with
(n_max+1)**2 points.
This implementation uses precalculated sets of points from [10]. The data
up to n_max=20 are loaded the first time this function is called.
The remaining data is loaded upon request.
Find stabilization points inside for an open spherical microphone array.
The interior points stabilize the array response at the eigenfrequencies of
the array. The algorithm is based on [11] and implemented following the
Matlab code provided by Gilles Chardon on his homepage at [12].
The stabilization points are independent of the sampling of the sphere
and can therefore be combined with arbitrary spherical samplings.
Parameters:
kr_max (float) – The maximum kr value to be considered. This will define
the upper frequency limit of the array.
resolution_factor (int) – Factor to increase the spatial resolution of the grid
used to estimate the stabilization points. Default is 1.
Returns:
sampling_interior – Coordinates of the stabilization points
For the Lebedev grid [13], the number of points \(Q\) can be
approximated by the spherical harmonic order \(N\) (parameter n_max)
\(Q \approx 1.3 \, (N+1)^2\)
For a list of available orders n_max and the exact number of points call
lebedev without any arguments. This will print available
orders and number of points to the console.
Note
This is intended to be a quadrature sampling with positive sampling
weights summing to \(4\pi\). For unknown reasons, this is not the
case in the original sources [14] and the Matlab code [15] on which
this Python version is based for orders 6, 12, and 13. For this reason,
the respective weights are not returned regardless of the order.
Parameters:
n_max (int, optional) – Maximum applicable spherical harmonic order between 1 and 65. Because
not all orders are available, the default None prints possible
orders to the console.
radius (number, optional) – Radius of the sampling grid in meters. The default is 1.
Returns:
sampling – Sampling positions without sampling weights (see note above).
condition_num (double) – Desired maximum condition number of the spherical harmonic basis
matrix. Default is 2.5.
n_points (int, optional) – Number of points to start the condition number optimization. If set to
None the value (n_max+1)**2 will be used as start.
Default is None.
Returns:
sampling – SamplingSphere object containing all sampling points
For detailed information, see [17].
For a spherical harmonic order \(n_{sh}\), a t-Design of degree
\(t=2n_{sh}\) for constant energy or \(t=2n_{sh}+1\) additionally
ensuring a constant angular spread of energy is required [18]. For a given
degree t
\[L = \lceil \frac{(t+1)^2}{2} \rceil+1,\]
points will be generated, except for t = 3, 5, 7, 9, 11, 13, and 15.
T-designs allow for an inverse spherical harmonic transform matrix
calculated as \(D = \frac{4\pi}{L} \mathbf{Y}^\mathrm{H}\) with
\(\mathbf{Y}^\mathrm{H}\) being the hermitian transpose of the
spherical harmonics matrix.
Parameters:
n_max (int) – Maximum applicable spherical harmonic order. Related to the degree
by degree=2*n_max (const_energy) and
degree=2*n_max+1 (const_angular_spread).
Must be between 1 and 90 for const_energy and between
1 and 89 for const_angular_spread.
criterion (const_energy, const_angular_spread) – Design criterion ensuring only a constant energy or additionally
constant angular spread of energy. The default is const_energy.
radius (number, optional) – Radius of the sampling grid in meters. The default is 1.
This function downloads a pre-calculated set of points from [19] . The data
up to degree=20 are loaded the first time this function is called.
The remaining data is loaded upon request.