ppftpy.rppft3#
- ppftpy.rppft3(data, /, *, vectorized=False, scipy_fft=False)[source]#
Compute the 3D Pseudo-Polar Fourier Transform for real input.
This function computes the 3-dimensional Pseudo-Polar Fourier Transform [Averbuch2003] for real input. The real PPFT3D 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 3D matrix (shape(N, N, N)) or a batch of 3D matrices (shape(V, N, N, N)). Each matrix must be cubical 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 3D Pseudo-Polar Fourier Transform. The output shape depends on the input:
If data has shape
(N, N, N), the output has shape(3, 3N+1, N+1, N+1).If data has shape
(V, N, N, N), the output has shape(V, 3, 3N+1, N+1, N+1).
- Raises:
ValueError – If the input shape is not
(N, N, N)(single 3D matrix) or(V, N, N, N)(multiple 3D matrices) with evenNand arbitraryV.ModuleNotFoundError – If scipy_fft=True but SciPy is not installed.
TypeError – If the input data is complex.
See also
References
[Averbuch2003]A. Averbuch and Y. Shkolnisky, “3D Fourier based discrete Radon transform,” Applied and Computational Harmonic Analysis, vol. 15, no. 1, pp. 33-69, Jul. 2003, issn: 1063-5203. doi:10.1016/s1063-5203(03)00030-7.
Examples
>>> from ppftpy import rppft3 >>> import numpy as np >>> arr = np.random.default_rng().random((4, 4, 4)) >>> rppft3(arr).shape (3, 7, 5, 5)
Compute PPFT3D for 2 arrays.
>>> from ppftpy import rppft3 >>> import numpy as np >>> arr = np.random.default_rng().random((2, 4, 4, 4)) >>> rppft3(arr).shape (2, 3, 7, 5, 5)