ppftpy.rppft2#
- ppftpy.rppft2(data, /, *, vectorized=False, scipy_fft=False)[source]#
Compute the 2D Pseudo-Polar Fourier Transform for real input.
This function computes the 2-dimensional Pseudo-Polar Fourier Transform [Averbuch2001] for real input. The real PPFT2D computes only the non-redundant half of the spectrum.
- Parameters:
data (
ndarray[tuple[Any,...],dtype[TypeVar(_ScalarT, bound=generic)]]) – The input data, either a single 2D matrix (shape(N, N)) or a batch of 2D matrices (shape(V, N, N)). Each matrix must be square with even length. The data can be either real or complex.scipy_fft (
bool) – IfTrue, uses SciPy’s FFT backend (scipy.fft) or a registered backend via SciPy’s backend control instead of the native array’s FFT implementation (e.g.,numpy.fft). This may improve performance but requires SciPy to be installed.vectorized (
bool) – IfTrue, computes the transform using a fully vectorized approach. This is significantly faster but requires more memory. Use with caution for large datasets.
- Return type:
- Returns:
The computed 2D Pseudo-Polar Fourier Transform. The output shape depends on the input:
If data has shape
(N, N), the output has shape(2, N+1, N+1).If data has shape
(V, N, N), the output has shape(V, 2, N+1, N+1).
- Raises:
ValueError – If the input shape is not
(N, N)(single 2D matrix) or(V, N, N)(multiple 2D matrices) with evenNand arbitraryV.ModuleNotFoundError – If scipy_fft=True but SciPy is not installed.
TypeError – If the input data is complex.
See also
References
[Averbuch2001]A. Averbuch, R. Coifman, D. Donoho, M. Israeli, and J. Waldén, “Fast Slant Stack: A notion of Radon Transform for Data in a Cartesian Grid which is Rapidly Computible, Algebraically Exact, Geometrically Faithful and Invertible,” 2001.
Examples
>>> from ppftpy import rppft2 >>> import numpy as np >>> arr = np.random.default_rng().random((4, 4)) >>> rppft2(arr).shape (2, 5, 5)
Compute PPFT2D for 3 arrays.
>>> from ppftpy import rppft2 >>> import numpy as np >>> arr = np.random.default_rng().random((3, 4, 4)) >>> rppft2(arr).shape (3, 2, 5, 5)