Skip to main content

Highly optimized Pseudo-Polar Fourier Transform in Python

Project description

ppft-py

PyPI - Python Version PyPI - Implementation ci ReadtheDocs codecov uv Ruff

Highly optimized Pseudo-Polar Fourier Transform in Python.

This repository provides a Python implementation of the Pseudo-Polar Fourier Transform (PPFT) in both 2D (PPFT2D) and 3D (PPFT3D), based on the methods presented in the following papers:

  • Averbuch et al., 2001 — Fast Slant Stack: A notion of Radon Transform for Data in a Cartesian Grid which is Rapidly Computable, Algebraically Exact, Geometrically Faithful and Invertible.
  • Averbuch & Shkolnisky, 20033D Fourier based discrete Radon transform, Applied and Computational Harmonic Analysis, Vol. 15, No. 1, pp. 33–69.

Features

  • GPU-accelerated computation for enhanced performance.
  • Backend-agnostic implementation using the Array API Standard with no direct dependencies.
  • Memory-efficient and fully vectorized modes available.
  • Optimized handling of real-valued input data for improved efficiency.
  • Supports additional FFT backends using SciPy for extended flexibility and performance.

Usage

To transform data with the Pseudo-Polar Fourier Transform, import the function from ppftpy and apply it to the input data:

2D Pseudo-Polar Fourier Transform:

import numpy as np

from ppftpy import ppft2

data = np.random.default_rng().random((128, 128))

transformed = ppft2(data)

3D Pseudo-Polar Fourier Transform:

import numpy as np

from ppftpy import ppft3

data = np.random.default_rng().random((32, 32, 32))

transformed = ppft3(data)

Note: The example uses NumPy arrays for the Pseudo-Polar Fourier Transform. However, this library supports all backends that implement the Array API Standard and its FFT extension (via the array-api-compat compatibility layer). See backends for a list of tested backends.

SciPy FFT Backends

Additionally, implementations of the SciPy FFT interface can be used as backends for the underlying FFT:

2D Pseudo-Polar Fourier Transform with SciPy backend:

import numpy as np

from ppftpy import ppft2

data = np.random.default_rng().random((128, 128))

transformed = ppft2(data, scipy_fft=True)

2D Pseudo-Polar Fourier Transform with pyFFTW backend:

import numpy as np
import pyfftw.interfaces.scipy_fft as pyfftw
from scipy import fft

from ppftpy import ppft2

data = np.random.default_rng().random((128, 128))

with fft.set_backend(pyfftw):
    transformed = ppft2(data, scipy_fft=True)

Note: For more information on using custom FFT backends with SciPy, check out the backend control section of the SciPy documentation. See backends for a list of tested backends.

Backends

The following implementations of the Array API Standard have been tested to work:

Backend Devices Minimum Version
NumPy CPU 1.23.0
CuPy GPU 10.0.0
DPNP CPU / GPU 0.17.0[^1]
Dask CPU / GPU 2024.8.1
PyTorch CPU / GPU 1.13.0
JAX CPU / GPU 0.4.32

[^1]: Released, but not yet available on PyPI.

The following implementations of the SciPy FFT interface have been tested to work:

Backend Supports Minimum Version
SciPy NumPy (incl. Dask/JAX with NumPy arrays) 1.8.0
mkl_fft NumPy (incl. Dask/JAX with NumPy arrays) 1.3.6
pyFFTW NumPy (incl. Dask/JAX with NumPy arrays) 0.13.0
CuPy CuPy (incl. Dask with CuPy arrays) 10.0.0

Acknowledgments

This project utilizes concepts from the reference implementations and for generating test data for regression tests:

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

ppft_py-0.1.0.tar.gz (5.6 MB view details)

Uploaded Source

Built Distribution

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

ppft_py-0.1.0-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file ppft_py-0.1.0.tar.gz.

File metadata

  • Download URL: ppft_py-0.1.0.tar.gz
  • Upload date:
  • Size: 5.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ppft_py-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e57b44d8748900c167314b2eb93dca0afacb283884877573230e815f0e3d72d8
MD5 1ec1632890eb32a0671c142b4d04c2c6
BLAKE2b-256 d3c830724e3686550c3e157b2fed31a801fe258259258528c7e2c2b4e8ccde14

See more details on using hashes here.

Provenance

The following attestation bundles were made for ppft_py-0.1.0.tar.gz:

Publisher: publish.yml on jnk22/ppft-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ppft_py-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ppft_py-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ppft_py-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e9d43cb3f04654075a8c34eae9f7f1b6d6a26be03b6017e9f00232b447756630
MD5 906fbf856d73a15bb926c15de57a4a49
BLAKE2b-256 d46e021d875da8ffb54a9e6e28dfac7129ed1616c1abe2ee9b8f8a7398018208

See more details on using hashes here.

Provenance

The following attestation bundles were made for ppft_py-0.1.0-py3-none-any.whl:

Publisher: publish.yml on jnk22/ppft-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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