Calculate sampling weights for numeric integration.
This function will be deprecated in pyfar 0.8.0 in favor
of spharpy.samplings.calculate_sampling_weights.
Uses the class method calculate_areas from SphericalVoronoi
to calculate the weights. It requires a spherical sampling grid with a
single radius and uses scipy.spatial.SphericalVoronoi in the
background.
Parameters:
sampling (Coordinates) – Sampling points on a sphere, i.e., all points must have the same
radius.
normalize (boolean, optional) – Normalize the samplings weights to sum(weights)=1. Otherwise the
weights sum to \(4 \pi r^2\). The default is True.
center (list) – Center of the spherical sampling grid. The default is [0,0,0].
round_decimals (int, optional) – Round to round_decimals digits to check for equal radius. The
default is 12.
Returns:
weigths – Sampling weights of size samplings.csize.
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).
Returns:
sampling – Sampling positions. Does not contain sampling weights.
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.
For detailed information, see [2], Chapter 3.2.
This sampling does not contain points at the North and South Pole and is
typically used for spherical harmonics processing. See
sph_equal_angle and sph_great_circle for samplings
containing points at the poles.
Parameters:
n_points (int, tuple of two ints) – Number of sampling points in azimuth and elevation. Either n_points
or sh_order must be provided. The default is None.
sh_order (int) – Maximum applicable spherical harmonic order. If this is provided,
‘n_points’ is set to 2*sh_order+1. Either n_points or
sh_order 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.
After Sloan and Womersley [3]. The samplings are available for
1 <= sh_order <= 200 (n_points=(sh_order+1)^2).
Parameters:
n_points (int) – Number of sampling points in the grid. Related to the spherical
harmonic order by n_points=(sh_order+1)**2. Either n_points
or sh_order must be provided. The default is None.
sh_order (int) – Maximum applicable spherical harmonic order. Related to the number of
points by sh_order=np.sqrt(n_points)-1. Either n_points or
sh_order must be provided. The default is None.
radius (number, optional) – Radius of the sampling grid in meters. The default is 1.
Returns:
sampling – Sampling positions including sampling weights.
This implementation uses precalculated sets of points from [4]. The data
up to sh_order=99 are loaded the first time this function is called.
The remaining data is loaded upon request.
This function will be deprecated in pyfar 0.8.0 in favor
of spharpy.samplings.fliege.
For detailed information, see [5]. Call sph_fliege
for a list of possible values for n_points and sh_order.
Parameters:
n_points (int, optional) – Number of sampling points in the grid. Related to the spherical
harmonic order by n_points=(sh_order+1)**2. Either n_points
or sh_order must be provided. The default is None.
sh_order (int, optional) – Maximum applicable spherical harmonic order. Related to the number of
points by sh_order=np.sqrt(n_points)-1. Either n_points or
sh_order must be provided. The default is None.
radius (number, optional) – Radius of the sampling grid in meters. The default is 1.
Returns:
sampling – Sampling positions including sampling weights.
For detailed information, see [7] (Section 3.3).
This sampling does not contain points at the North and South Pole and is
typically used for spherical harmonics processing. See
sph_equal_angle and sph_great_circle for samplings
containing points at the poles.
Parameters:
n_points (int, tuple of two ints) – Number of sampling points in azimuth and elevation. Either n_points
or sh_order must be provided. The default is None.
sh_order (int) – Maximum applicable spherical harmonic order. If this is provided,
n_points is set to (2*(sh_order+1),sh_order+1). Either
n_points or sh_order must be provided. The default is None.
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.
This function will be deprecated in pyfar 0.8.0 in favor
of spharpy.samplings.great_circle.
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.
This function will be deprecated in pyfar 0.8.0 in favor
of spharpy.samplings.lebedev.
For detailed information, see [9]. For a list of available values
for n_points and sh_order call lebedev.
Parameters:
n_points (int, optional) – Number of sampling points in the grid. Related to the spherical
harmonic order by n_points=(sh_order+1)**2. Either n_points
or sh_order must be provided. The default is None.
sh_order (int, optional) – Maximum applicable spherical harmonic order. Related to the number of
points by sh_order=np.sqrt(n_points)-1. Either n_points or
sh_order must be provided. The default is None.
radius (number, optional) – Radius of the sampling grid in meters. The default is 1.
Returns:
sampling – Sampling positions including sampling weights.
For detailed information, see [11].
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 [12]. 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:
degree (int) – T-design degree between 1 and 180. Either degree or
sh_order must be provided. The default is None.
sh_order (int) – Maximum applicable spherical harmonic order. Related to the degree
by degree=2*sh_order (const_energy) and
degree=2*sh_order+1 (const_angular_spread). Either
degree or sh_order must be provided. The default is None.
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 [13] . The data
up to degree=99 are loaded the first time this function is called.
The remaining data is loaded upon request.