Skip to main content

High-performance vectorized FFTLog implementation for fast Hankel transforms in pure Python

Project description

fftloggin

Vectorized FFTLog in pure python

Installation

# Install with uv
uv add fftloggin

# Or with pip
pip install fftloggin

Optional PyFFTW backend

If you want FFTW-based plans and buffer reuse, install the optional dependency and use the PyFFTW backend.

# With uv
uv add "fftloggin[fftw]"

# Or with pip
pip install "fftloggin[fftw]"
from fftloggin import FFTLog, PyFFTWBackend
from fftloggin.kernels import BesselJKernel

fftlog = FFTLog(kernel=BesselJKernel(0), n=128, dlog=0.05, backend=PyFFTWBackend())

Development

Setup

# Clone the repository
git clone https://github.com/binado/fftloggin.git
cd fftloggin

# Install dependencies
uv sync --all-groups

Running Tests

# Run standard tests (fast)
uv run pytest

# Run all tests excluding benchmarks
uv run pytest -m "not benchmark"

# Run with verbose output
uv run pytest -v

Benchmark Tests

Benchmark tests compare the Python implementation against the original Fortran FFTLog code. These tests are optional and require a Fortran compiler.

Prerequisites

  • Have gfortran installed on your PATH

Running Benchmarks

# Generate benchmark reference files
python scripts/generate_benchmarks.py

# Run benchmark tests
uv run pytest --run-benchmarks

# Or run only benchmark tests
uv run pytest tests/test_benchmark.py --run-benchmarks -v

# Generate and run benchmarks in one command
uv run pytest --generate-benchmarks --run-benchmarks

Regenerating Benchmarks

If you need to regenerate the benchmark files:

# Remove old benchmarks
rm -rf tests/benchmarks/*.txt

# Generate fresh benchmarks
python scripts/generate_benchmarks.py

Linting

# Check code style
uv run ruff check .

# Format code
uv run ruff format .

References

  • Hamilton, A. J. S. "Uncorrelated modes of the non-linear power spectrum." Monthly Notices of the Royal Astronomical Society 312.2 (2000): 257-284. [astro-ph/9905191]
  • Assassi, Valentin, Marko Simonović, and Matias Zaldarriaga. "Efficient Evaluation of Cosmological Angular Statistics." arXiv preprint arXiv:1705.05022 (2017). [1705.05022]
  • Schöneberg, Nils, et al. "Beyond the traditional Line-of-Sight approach of cosmological angular statistics." Journal of Cosmology and Astroparticle Physics 2018.10 (2018): 047. [1807.09540]
  • Fang, Xiao, et al. "Beyond Limber: Efficient computation of angular power spectra for galaxy clustering and weak lensing." Journal of Cosmology and Astroparticle Physics 2020.05 (2020): 010. [1911.11947]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fftloggin-0.3.1.tar.gz (149.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fftloggin-0.3.1-py3-none-any.whl (26.1 kB view details)

Uploaded Python 3

File details

Details for the file fftloggin-0.3.1.tar.gz.

File metadata

  • Download URL: fftloggin-0.3.1.tar.gz
  • Upload date:
  • Size: 149.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for fftloggin-0.3.1.tar.gz
Algorithm Hash digest
SHA256 d4aab858c1ab3470c0b1e90121f15553c7ff4b72418b1605c8d9a5c4e9e331cb
MD5 d772eb63448136b5fe1d1b0b6af7ecc7
BLAKE2b-256 e882e783565e62c78509dd9b83bd7c021f5fd872b8b4cb129e9f0d93fa8a0bfd

See more details on using hashes here.

File details

Details for the file fftloggin-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: fftloggin-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 26.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for fftloggin-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 46dcef6dd9a8c94b6e7cbc3f50ea35a1fe03d645d8247f04cf0043e3c1b4278c
MD5 8512c781c504d5ebd92cba37ba9b2ed5
BLAKE2b-256 5deba27cdafddb037a9761dcec2e0edb18f3c02d127a26a6b03c9800d429f8c4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page