spaudiopy.grids

Sampling grids.

import numpy as np
import matplotlib.pyplot as plt
plt.rcParams['axes.grid'] = True

import spaudiopy as spa

Functions

calculate_grid_weights(azi, zen[, order])

Approximate quadrature weights by pseudo-inverse.

equal_angle(n)

Equi-angular sampling points on a sphere.

equal_polar_angle(n)

Equi-angular sampling points on a circle.

gauss(n)

Gauss-Legendre sampling points on sphere.

load_Fliege_Maier_nodes(grid_order)

Return Fliege-Maier grid nodes with associated weights.

load_lebedev(degree)

Return the unit coordinates of Lebedev grid.

load_maxDet(degree)

Return Maximum Determinant (Fekete, Extremal) points on the sphere.

load_n_design(degree)

Return the unit coordinates of spherical N-design (Chebyshev-type quadrature rules).

load_t_design(degree)

Return the unit coordinates of minimal T-designs.

spaudiopy.grids.calculate_grid_weights(azi, zen, order=None)[source]

Approximate quadrature weights by pseudo-inverse.

Parameters:
  • azi ((Q,) array_like) – Azimuth.

  • zen ((Q,) array_like) – Zenith / Colatitude.

  • order (int, optional) – Supported order N, searched if not provided.

Returns:

weights ((Q,) array_like) – Grid / Quadrature weights.

References

Fornberg, B., & Martel, J. M. (2014). On spherical harmonics based numerical quadrature over the surface of a sphere. Advances in Computational Mathematics.

spaudiopy.grids.load_t_design(degree)[source]

Return the unit coordinates of minimal T-designs.

Parameters:

degree (int) – T-design degree between 1 and 21.

Returns:

vecs ((M, 3) numpy.ndarray) – Coordinates of points.

Notes

Degree must be >= 2 * SH_order for spherical harmonic transform (SHT).

References

The designs have been copied from: http://neilsloane.com/sphdesigns/ and should be referenced as:

“McLaren’s Improved Snub Cube and Other New Spherical Designs in Three Dimensions”, R. H. Hardin and N. J. A. Sloane, Discrete and Computational Geometry, 15 (1996), pp. 429-441.

Examples

vecs = spa.grids.load_t_design(degree=2*5)
spa.plot.hull(spa.decoder.get_hull(*vecs.T))

(png, hires.png, pdf)

_images/spaudiopy-grids-2.png
spaudiopy.grids.load_n_design(degree)[source]

Return the unit coordinates of spherical N-design (Chebyshev-type quadrature rules). Seem to be equivalent but more modern t-designs.

Parameters:

degree (int) – Degree of exactness N between 1 and 124.

Returns:

vecs ((M, 3) numpy.ndarray) – Coordinates of points.

References

The designs have been copied from: https://homepage.univie.ac.at/manuel.graef/quadrature.php

Examples

vecs = spa.grids.load_n_design(degree=2*5)
spa.plot.hull(spa.decoder.get_hull(*vecs.T))

(png, hires.png, pdf)

_images/spaudiopy-grids-3.png
spaudiopy.grids.load_lebedev(degree)[source]

Return the unit coordinates of Lebedev grid.

Parameters:

degree (int) – Degree of precision p between 3 and 131.

Returns:

  • vecs ((M, 3) numpy.ndarray) – Coordinates of points.

  • weights (array_like) – Quadrature weights.

References

The designs have been copied from: https://people.sc.fsu.edu/~jburkardt/datasets/sphere_lebedev_rule/sphere_lebedev_rule.html

Examples

vecs, weights = spa.grids.load_lebedev(degree=2*5)
spa.plot.hull(spa.decoder.get_hull(*vecs.T))

(png, hires.png, pdf)

_images/spaudiopy-grids-4.png
spaudiopy.grids.load_Fliege_Maier_nodes(grid_order)[source]

Return Fliege-Maier grid nodes with associated weights.

Parameters:

grid_order (int) – Grid order between 2 and 30

Returns:

  • vecs ((M, 3) numpy.ndarray) – Coordinates of points.

  • weights (array_like) – Quadrature weights.

References

The designs have been copied from: http://www.personal.soton.ac.uk/jf1w07/nodes/nodes.html and should be referenced as:

“A two-stage approach for computing cubature formulae for the sphere.”, Jorg Fliege and Ulrike Maier, Mathematik 139T, Universitat Dortmund, Fachbereich Mathematik, Universitat Dortmund, 44221. 1996.

Examples

vecs, weights = spa.grids.load_Fliege_Maier_nodes(grid_order=5)
spa.plot.hull(spa.decoder.get_hull(*vecs.T))

(png, hires.png, pdf)

_images/spaudiopy-grids-5.png
spaudiopy.grids.load_maxDet(degree)[source]

Return Maximum Determinant (Fekete, Extremal) points on the sphere.

Parameters:

degree (int) – Degree between 1 and 200.

Returns:

  • vecs ((M, 3) numpy.ndarray) – Coordinates of points.

  • weights (array_like) – Quadrature weights.

References

The designs have been copied from: https://web.maths.unsw.edu.au/~rsw/Sphere/MaxDet/

Examples

vecs, weights = spa.grids.load_maxDet(degree=5)
spa.plot.hull(spa.decoder.get_hull(*vecs.T))

(png, hires.png, pdf)

_images/spaudiopy-grids-6.png
spaudiopy.grids.equal_angle(n)[source]

Equi-angular sampling points on a sphere.

Parameters:

n (int) – Maximum order.

Returns:

  • azi (array_like) – Azimuth.

  • zen (array_like) – Colatitude.

  • weights (array_like) – Quadrature weights.

References

Rafaely, B. (2015). Fundamentals of Spherical Array Processing., sec.3.2

Examples

azi, zen, weights = spa.grids.equal_angle(n=5)
spa.plot.hull(spa.decoder.get_hull(*spa.utils.sph2cart(azi, zen)))

(png, hires.png, pdf)

_images/spaudiopy-grids-7.png
spaudiopy.grids.gauss(n)[source]

Gauss-Legendre sampling points on sphere.

Parameters:

n (int) – Maximum order.

Returns:

  • azi (array_like) – Azimuth.

  • zen (array_like) – Colatitude.

  • weights (array_like) – Quadrature weights.

References

Rafaely, B. (2015). Fundamentals of Spherical Array Processing., sec.3.3

Examples

azi, zen, weights = spa.grids.gauss(n=5)
spa.plot.hull(spa.decoder.get_hull(*spa.utils.sph2cart(azi, zen)))

(png, hires.png, pdf)

_images/spaudiopy-grids-8.png
spaudiopy.grids.equal_polar_angle(n)[source]

Equi-angular sampling points on a circle.

Parameters:

n (int) – Maximum order

Returns:

  • pol (array_like) – Polar angle.

  • weights (array_like) – Weights.