ENH: Add Zernike polynomials to scipy.special

Hi!

I’m a first year student of MSc in Astrophysics and Cosmology and i would like to add to scipy.special the radial (R^m_n) and circle (Z^m_n) Zernike polynomials defined as follow:

\displaystyle R^m_n(\rho) = \sum_{k=0}^{\tfrac{n-m}{2}} \frac{(-1)^k\,(n-k)!}{k!\left (\tfrac{n+m}{2}-k \right )! \left (\tfrac{n-m}{2}-k \right)!} \;\rho^{n-2k}

or, equivalently through the Jacobi polynomials

\displaystyle R_n^m(\rho) = (-1)^{(n-m)/2} \rho^mP_{(n-m)/2}^{(m,0)}(1-2\rho^2)

The even Zernike polynomials are defined as

Z^{m}_n(\rho,\varphi) = R^m_n(\rho)\,\cos(m\,\varphi)

(even function over the azimuthal angle \varphi), and the odd Zernike polynomials are defined as

Z^{-m}_n(\rho,\varphi) = R^m_n(\rho)\,\sin(m\,\varphi)

I first met these polynomials while attending the course “Astronomial Optics” for wavefront aberration modeling, and discovered that they are also used for the out-of-focus (OOF) holography in sigle-dish radio telescopes.

Being widly used in optics, it would be really nice having them in scipy, given the huge variety of polynomials already included in scipy.special, and an implementation in C/C++/Cython can really make the difference especially when performing OOF holography when code speed is essential.

Sorry if my english is not perfect!

1 Like