This release is a pre-release and may not be stable for production use.
PyHank - Quasi-Discrete Hankel Transforms for Python
Edward Rogers
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
Installation
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 pyhank
For development and running tests:
pip install -e .[dev]
For building documentation:
pip install -e .[docs]
Bugs & Contribution
Please use Github to report bugs, feature requests and submit your code: http://github.com/etfrogers/pyhank
Documentation
The documentation for PyHank can be found at Read the docs
Usage
See the Usage examples at ReadTheDocs
Release files for pyhank 3.0.0rc2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyhank-3.0.0rc2-cp310-cp310-win_amd64.whl | CPython 3.10 | CPython 3.10 | Windows x86-64 | Details |
| pyhank-3.0.0rc2-cp310-cp310-manylinux_2_28_x86_64.whl | CPython 3.10 | CPython 3.10 | Linux glibc 2.28+ x86-64 | Details |
| pyhank-3.0.0rc2-cp310-cp310-macosx_10_12_x86_64.whl | CPython 3.10 | CPython 3.10 | macOS 10.12+ x86-64 | Details |
Total release size: 1.6 MB
Release files / pyhank-3.0.0rc2-cp310-cp310-win_amd64.whl
| Download URL | pyhank-3.0.0rc2-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 441.8 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
6f7db4945973b52684cbed90e590df13b93fe936e04160150f61707dbb050b9d
|
|
BLAKE2b-256 checksum How to use checksums |
4ee735568d7ceeb45c9af7f45978074427574bccdb343d69de7f61d0f0b4cff5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.
Transparency logRelease files / pyhank-3.0.0rc2-cp310-cp310-manylinux_2_28_x86_64.whl
| Download URL | pyhank-3.0.0rc2-cp310-cp310-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 582.3 kB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
6b090a1b40efdaf334829499fc631e094a8e44f28b9c07461c3209a9f59779ed
|
|
BLAKE2b-256 checksum How to use checksums |
9ee2673cfe0fb29ade7c3be42609872b0b199f6a08f86a51160e3bba75cd7cab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.
Transparency logRelease files / pyhank-3.0.0rc2-cp310-cp310-macosx_10_12_x86_64.whl
| Download URL | pyhank-3.0.0rc2-cp310-cp310-macosx_10_12_x86_64.whl |
|---|---|
| Size | 544.6 kB |
| Tags | CPython 3.10 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
7b6c80db47f9124fee4d4e340b73d57c72fe20ea1c9fe1eb7bf67f5c7ec3d27f
|
|
BLAKE2b-256 checksum How to use checksums |
1c4d8c03791f5197af4a7bcc5a178281dfb344e070d7f27b40fae550eee51977
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.
Transparency log