PyHank is a python implementation of the quasi-discrete Hankel transform as developed by Manuel Guizar-Sicairos and Julio C. Guitierrez-Vega:
"Computation of quasi-discrete Hankel transforms of the integer order for propagating optical wave fields" Manuel Guizar-Sicairos and Julio C. Guitierrez-Vega J. Opt. Soc. Am. A 21 (1) 53-58 (2004)
It operates on functions stored in NumPy arrays. If you want a Hankel transform that operates on a callable function, you may be interested in hankel by Steven Murray.
PyHank 3.0 includes a high-performance compiled Rust backend (powered by hankrs), delivering 10x–50x speedups for transform setup and computation across multi-dimensional arrays, with automatic fallback to pure Python where a compiler is unavailable.
I have used this code extensively for beam-propagation-method calculations of radially-symmetric beams. In the radially symmetric case, the 2D FFT over x and y that would be used in a non-symmetric system is replaced by a 1D QDHT over r, making the computational load much lighter and allowing bigger simulations.
PyHank was inspired by Adam Wyatt's Matlab version which I used for many years, before moving to Python and needing my own implementation. It aims to simplify the interface (using Python's object-oriented approach) and utilise existing NumPy/SciPy functions wherever possible.
It has both a simple single-shot interface, and an object-oriented approach that precomputes transform matrices to speed up computation significantly when making multiple transforms on the same grid.
Contributions and comments are welcome using GitHub at: https://github.com/etfrogers/pyhank
Pre-compiled binary wheels (with compiled native Rust acceleration) are provided on PyPI for 64-bit Linux, macOS (Apple Silicon and Intel), and 64-bit Windows:
pip install pyhankFor development and running tests:
pip install -e .[dev]For building documentation:
pip install -e .[docs]Please use Github to report bugs, feature requests and submit your code: http://github.com/etfrogers/pyhank
The documentation for PyHank can be found at Read the docs
See the Usage examples at ReadTheDocs