
- SciPy - Home
- SciPy - Introduction
- SciPy - Environment Setup
- SciPy - Basic Functionality
- SciPy - Relationship with NumPy
- SciPy Clusters
- SciPy - Clusters
- SciPy - Hierarchical Clustering
- SciPy - K-means Clustering
- SciPy - Distance Metrics
- SciPy Constants
- SciPy - Constants
- SciPy - Mathematical Constants
- SciPy - Physical Constants
- SciPy - Unit Conversion
- SciPy - Astronomical Constants
- SciPy - Fourier Transforms
- SciPy - FFTpack
- SciPy - Discrete Fourier Transform (DFT)
- SciPy - Fast Fourier Transform (FFT)
- SciPy Integration Equations
- SciPy - Integrate Module
- SciPy - Single Integration
- SciPy - Double Integration
- SciPy - Triple Integration
- SciPy - Multiple Integration
- SciPy Differential Equations
- SciPy - Differential Equations
- SciPy - Integration of Stochastic Differential Equations
- SciPy - Integration of Ordinary Differential Equations
- SciPy - Discontinuous Functions
- SciPy - Oscillatory Functions
- SciPy - Partial Differential Equations
- SciPy Interpolation
- SciPy - Interpolate
- SciPy - Linear 1-D Interpolation
- SciPy - Polynomial 1-D Interpolation
- SciPy - Spline 1-D Interpolation
- SciPy - Grid Data Multi-Dimensional Interpolation
- SciPy - RBF Multi-Dimensional Interpolation
- SciPy - Polynomial & Spline Interpolation
- SciPy Curve Fitting
- SciPy - Curve Fitting
- SciPy - Linear Curve Fitting
- SciPy - Non-Linear Curve Fitting
- SciPy - Input & Output
- SciPy - Input & Output
- SciPy - Reading & Writing Files
- SciPy - Working with Different File Formats
- SciPy - Efficient Data Storage with HDF5
- SciPy - Data Serialization
- SciPy Linear Algebra
- SciPy - Linalg
- SciPy - Matrix Creation & Basic Operations
- SciPy - Matrix LU Decomposition
- SciPy - Matrix QU Decomposition
- SciPy - Singular Value Decomposition
- SciPy - Cholesky Decomposition
- SciPy - Solving Linear Systems
- SciPy - Eigenvalues & Eigenvectors
- SciPy Image Processing
- SciPy - Ndimage
- SciPy - Reading & Writing Images
- SciPy - Image Transformation
- SciPy - Filtering & Edge Detection
- SciPy - Top Hat Filters
- SciPy - Morphological Filters
- SciPy - Low Pass Filters
- SciPy - High Pass Filters
- SciPy - Bilateral Filter
- SciPy - Median Filter
- SciPy - Non - Linear Filters in Image Processing
- SciPy - High Boost Filter
- SciPy - Laplacian Filter
- SciPy - Morphological Operations
- SciPy - Image Segmentation
- SciPy - Thresholding in Image Segmentation
- SciPy - Region-Based Segmentation
- SciPy - Connected Component Labeling
- SciPy Optimize
- SciPy - Optimize
- SciPy - Special Matrices & Functions
- SciPy - Unconstrained Optimization
- SciPy - Constrained Optimization
- SciPy - Matrix Norms
- SciPy - Sparse Matrix
- SciPy - Frobenius Norm
- SciPy - Spectral Norm
- SciPy Condition Numbers
- SciPy - Condition Numbers
- SciPy - Linear Least Squares
- SciPy - Non-Linear Least Squares
- SciPy - Finding Roots of Scalar Functions
- SciPy - Finding Roots of Multivariate Functions
- SciPy - Signal Processing
- SciPy - Signal Filtering & Smoothing
- SciPy - Short-Time Fourier Transform
- SciPy - Wavelet Transform
- SciPy - Continuous Wavelet Transform
- SciPy - Discrete Wavelet Transform
- SciPy - Wavelet Packet Transform
- SciPy - Multi-Resolution Analysis
- SciPy - Stationary Wavelet Transform
- SciPy - Statistical Functions
- SciPy - Stats
- SciPy - Descriptive Statistics
- SciPy - Continuous Probability Distributions
- SciPy - Discrete Probability Distributions
- SciPy - Statistical Tests & Inference
- SciPy - Generating Random Samples
- SciPy - Kaplan-Meier Estimator Survival Analysis
- SciPy - Cox Proportional Hazards Model Survival Analysis
- SciPy Spatial Data
- SciPy - Spatial
- SciPy - Special Functions
- SciPy - Special Package
- SciPy Advanced Topics
- SciPy - CSGraph
- SciPy - ODR
- SciPy Useful Resources
- SciPy - Reference
- SciPy - Quick Guide
- SciPy - Cheatsheet
- SciPy - Useful Resources
- SciPy - Discussion
SciPy - ihfftn() Function
SciPy's function ihfftn() is a n-dimensional inverse Hermitian Fast Fourier Transform of real-valued frequency-domain data reconstructed from the original spatial domain signal. This is an extension to both ihfft and ihfft2 with the scope of handling multi-dimensional arrays, which also reconstruct the data efficiently and retain the input as real.
ihfftn() is widely applied in multidimensional signal processing, picture reconstruction, and scientific computing. It finds its best application in recreating spatial signals from frequency-domain data in volumetric scanning, 3D image filtering, and simulations.
This method allows exact data manipulation in several dimensions while preserving Hermitian symmetry.
Syntax
The syntax for the SciPy ihfftn() method is as follows −
.ihfftn(x, s=None, axes=None, norm=None, overwrite_x=False, workers=None, *, plan=None)
Parameters
This method accepts the following parameters −
x (array_like) − Input Hermitian symmetric frequency-domain data.
s (sequence of ints, optional) − Shape of the real output; truncates or zero-pads input to match.
axes (sequence of ints, optional) − Axes along which the inverse FFT is computed. Defaults to all axes.
norm ({"backward", "ortho", "forward"}, optional) − Normalization mode: "backward" (default), "ortho" for energy preservation, or "forward".
overwrite_x (bool, optional) − Allows overwriting x to save memory. Default is False.
workers (int, optional) − Number of parallel threads for computation. Default is single-threaded.
plan (optional) − For experimental precomputed FFT plans. Rarely used.
Return Value
out ndarray − Real-valued n-dimensional array reconstructed from the input Hermitian symmetric frequency-domain data.
Example 1
The following code demonstrates how to use ihfftn(), a real-valued 3D array is transformed into the Hermitian symmetric frequency domain using hfftn and then reconstructed by ihfftn into the original spatial data, so that a round-trip transformation is accomplished.
import numpy as np from scipy.fft import hfftn, ihfftn # Create real-valued data and compute Hermitian symmetric frequency data real_data = np.random.rand(2, 2, 2) freq_data = hfftn(real_data) # Perform the inverse Hermitian FFT spatial_data = ihfftn(freq_data) print("Original Real Data:\n", real_data) print("Reconstructed Spatial Data:\n", spatial_data)
When we run above program, it produces following result
Original Real Data: [[[0.15 0.05] [0.69 0.54]] [[0.93 0.64] [0.52 0.51]]] Reconstructed Spatial Data: [[[0.15+0.j 0.05+0.j] [0.69+0.j 0.54+0.j]] [[0.93+0.j 0.64+0.j] [0.52+0.j 0.51+0.j]]]
Example 2
The axis parameter in ihfftn restricts the transformation to some dimensions, which will then have an impact on reconstruction, and norm="ortho" scales the output to conserve energy and induce amplitude variations. All of these settings affect the spatial domain translation of the data from the frequency domain.
This code illustrates the implementation of ihfftn for the reconstruction of spatial data from the Hermitian symmetric frequency-domain input, including default behavior with specific axis transformations using a tuple axes=(2, 0) and using orthogonal normalization norm="ortho" to keep the energy.
import numpy as np from scipy.fft import ihfftn x = np.ones((2, 2, 2)) # Perform inverse FFT with default settings default_axes_output = ihfftn(x) # Perform inverse FFT along specific axes custom_axes_output = ihfftn(x, axes=(2, 0)) # Perform inverse FFT with orthogonal normalization norm_output = ihfftn(x, norm="ortho") print("Default Axes Output:\n", default_axes_output) print("Custom Axes Output (axes=(2, 0)):\n", custom_axes_output) print("Orthogonal Normalization Output:\n", norm_output)
Following is an output of the above code −
Default Axes Output: [[[1.+0.j 0.+0.j] [0.+0.j 0.+0.j]] [[0.+0.j 0.+0.j] [0.+0.j 0.+0.j]]] Custom Axes Output (axes=(2, 0)): [[[1.+0.j 0.+0.j] [1.+0.j 0.+0.j]] [[0.+0.j 0.+0.j] [0.+0.j 0.+0.j]]] Orthogonal Normalization Output: [[[2.83+0.j 0. +0.j] [0. +0.j 0. +0.j]] [[0. +0.j 0. +0.j] [0. +0.j 0. +0.j]]]