Skip to main content

ENUFFT

PyPI Python License DOI

ENUFFT computes local Fourier spectra of scattered two-dimensional samples, such as irregular terrain inside a mesh cell, and compresses them with Elastic Mode Selection (EMS). It has three parts.

  • A type-1 non-uniform FFT on a periodic rectangle, with the Kaiser-Bessel, exponential-of-semicircle, Gaussian and B-spline kernels.
  • Square analysis windows around a cell, with a square, cell-shaped or circular support and clipped Voronoi quadrature weights.
  • EMS, which keeps an adaptive number of conjugate mode pairs.

The research code, derivations and test cases are in TridibBanerjee/Elastic-Non-Uniform-FFT.

Install

pip install enufft

ENUFFT needs Python 3.10 or newer, NumPy and SciPy.

Quick start

import numpy as np
import enufft

rng = np.random.default_rng(0)
points = rng.uniform(0.0, 100.0, size=(5000, 2))                       # sample positions (km)
heights = 500.0 * np.cos(2 * np.pi * (points[:, 0] + 2 * points[:, 1]) / 60.0)
cell = np.array([[20.0, 25.0], [80.0, 30.0], [45.0, 75.0]])             # one mesh cell

window = enufft.Window.around(cell, alignment="edge", support="polygon", expansion=1.5)
inside = window.contains(points)
x, y = window.local(points[inside])
weights = enufft.voronoi_weights(x, y, window)

h_hat = enufft.nufft(x, y, heights[inside], 8, 8, window.L, window.L, kernel="kb", sigma=1.5, w=8, weights=weights)
sparse, pairs, result = enufft.select_modes(h_hat, k_max=8)
print(result.k_star, pairs)

h_hat[m + M, n + N] is the coefficient of the mode (m, n), with the wave vector 2 pi (m, n) / L in the rotated window frame.

Kernels

Family Name Shape Default parameter
Kaiser-Bessel "kb" I0(gamma sqrt(1 - t^2)) gamma of Beatty et al. (2005); "potts", "fessler" or a number
Exponential of semicircle "es" exp(beta [sqrt(1 - t^2) - 1]) beta = pi w (1 - 1 / 2 sigma)
Gaussian "gauss" exp(-u^2 / 2 s^2), cut at the half-width s^2 = (w / 2) / (pi (2 - 1 / sigma))
B-spline "bspline" cardinal B-spline of order w none

w is the kernel width and sigma the oversampling factor of the auxiliary grid. The Kaiser-Bessel kernel is the most accurate for a given width.

See docs/API.md for every function.

Citation

Please cite the Zenodo record 10.5281/zenodo.20544458.

License

Apache-2.0.

Metadata

Release files for enufft 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for enufft 2.0.0
File Size Uploaded Provenance Actions
enufft-2.0.0.tar.gz 18.3 kB Without provenance Details for enufft-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for enufft 2.0.0
File Interpreter ABI Platform Actions
enufft-2.0.0-py3-none-any.whl Python 3 none any Details for enufft-2.0.0-py3-none-any.whl

Total release size: 33.8 kB

Release files / enufft-2.0.0.tar.gz

Download URL enufft-2.0.0.tar.gz
Size 18.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a7c544c728b2fc634cd4fa78549d50c26d0ba07af171a74071d93962ace28304
BLAKE2b-256 checksum
How to use checksums
cb8b3eca36e1179cbe77954e7f95141863c1fd4159f02995892d721bba3f349a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Release files / enufft-2.0.0-py3-none-any.whl

Download URL enufft-2.0.0-py3-none-any.whl
Size 15.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
12901eb413665affaf65c3a8ad14878851ff1c34369f4d8bbd018ccfe7fdee39
BLAKE2b-256 checksum
How to use checksums
c273aafc506ae4be9da34bfe1c7eecd91a3479d211e2a82ca9d2cb0d55f1a5c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Security for enufft 2.0.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page