Skip to main content

FFTLog

A Python implementation of FFTLog for fast logarithmic FFT transforms, developed for PyBird.

Installation

pip install fftlog-lss

With JAX acceleration

pip install "fftlog-lss[jax]"

From source

git clone https://github.com/pierrexyz/fftlog.git
cd fftlog
pip install --editable .

From source with JAX

git clone https://github.com/pierrexyz/fftlog.git
cd fftlog
pip install --editable ".[jax]"

Dependencies

Required

  • Python >= 3.8
  • numpy >= 1.20.0
  • scipy >= 1.7.0

Optional (for JAX acceleration)

  • jax >= 0.4.0
  • jaxlib >= 0.4.0
  • interpax >= 0.3.0

Quickstart

Basic Usage (without JAX)

import numpy as np
from scipy.stats import lognorm
from fftlog import FFTLog

# Create test function (power spectrum)
k = np.logspace(-4, 0, 200)
pk = lognorm.pdf(k, 2.1)

# Initialize FFTLog
fft = FFTLog(
    Nmax=512,       # Number of points
    xmin=1e-5,      # Minimum k value
    xmax=1e3,       # Maximum k value
    bias=-0.1,      # Bias parameter
    complex=False,  # Use real FFT
    window=0.1      # Anti-aliasing window
)

# FFTLog decomposition and reconstruction
pk_reconstructed = fft.rec(k, pk, k)

# Spherical Bessel Transform
s = np.arange(1., 1e3, 5.)
xi = fft.sbt(k, pk, s)  # Fast O(N log N) transform

With JAX Acceleration

import numpy as np
from scipy.stats import lognorm
from fftlog import FFTLog
from fftlog.config import set_jax_enabled
from jax import jit
import jax.numpy as jnp

# Enable JAX mode
set_jax_enabled(True)

# Create test function
k = np.logspace(-4, 0, 200)
pk = lognorm.pdf(k, 2.1)

# Initialize FFTLog (same as above)
fft = FFTLog(
    Nmax=512, xmin=1e-5, xmax=1e3, 
    bias=-0.1, complex=False, window=0.1
)

# Convert to JAX arrays and JIT compile
k_jax, pk_jax = jnp.array(k), jnp.array(pk)
get_coef_jit = jit(fft.Coef)

# Now much faster for repeated calls
coefficients = get_coef_jit(k_jax, pk_jax)

Features

  • Fast logarithmic FFT transforms
  • Support for both real and complex transforms
  • Spherical Bessel transforms
  • Anti-aliasing windows
  • Optional JAX acceleration for GPU/TPU support

Documentation

For more detailed examples and documentation, see the notebooks in the notebooks/ directory.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Metadata

Release files for fftlog-lss 0.1.3

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

Source distribution (sdist)

Source distribution for fftlog-lss 0.1.3
File Size Uploaded Provenance Actions
fftlog_lss-0.1.3.tar.gz 11.2 kB Without provenance Details for fftlog_lss-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fftlog-lss 0.1.3
File Interpreter ABI Platform Actions
fftlog_lss-0.1.3-py3-none-any.whl Python 3 none any Details for fftlog_lss-0.1.3-py3-none-any.whl

Total release size: 21.6 kB

Release files / fftlog_lss-0.1.3.tar.gz

Download URL fftlog_lss-0.1.3.tar.gz
Size 11.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ebb7b692053b47222e9428514774b3b27818b16f84ac61de7fd4d5d1dc09a848
BLAKE2b-256 checksum
How to use checksums
072bebce97e07026edac1c87d6347397a07da9c6b5d50d4bb69c388b5cc5b140
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / fftlog_lss-0.1.3-py3-none-any.whl

Download URL fftlog_lss-0.1.3-py3-none-any.whl
Size 10.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
53cf238681ed2fec102d200f54c62769653e5bfcde0f427db03cdb8d6019a908
BLAKE2b-256 checksum
How to use checksums
10c36445160868d55b8cc09e501d4f820350813b84990332b5d61eb07c0c55f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Security for fftlog-lss 0.1.3

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.

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