
- 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 - ifft() Function
This function is used to calculate the 1-D n-point discrete Fourier transform.
Syntax
The syntax for the Scipy ifft() method is as follows −
.ifft(x, n=None, axis=-1, norm=None, overwrite_x=False, workers=None, *, plan=None)
Parameters
This method accepts the following parameters −
x (array_like) − Input array in the frequency domain to be transformed back into the time domain. Can be complex or real.
n (int, optional) − Length of the transformed axis. If n is larger than the input, the array is zero-padded. If smaller, the array is truncated. Default is the length of the input.
axis (int, optional) − Axis along which the IFFT is performed. Default is -1 (the last axis).
norm ("backward", "ortho", "forward", optional) − The normalization mode for IFFT allows control over scaling: "backward" (default, no scaling), "ortho" (unitary scaling for energy preservation), and "forward" (scales the output by 1/n, where n is the transform length).
overwrite_x (bool, optional) − If True, allows the input array x to be overwritten for improved performance. Default is False.
workers (int, optional) − Number of parallel workers to use for computation. Default is None, which means a single thread is used. Use a higher value for faster computation with large arrays.
plan (optional) − Precomputed plan for FFT optimization (advanced use). Default is None.
Return Value
y (ndarray) − The result of the inverse FFT, which is the reconstructed signal in the time domain. The output is complex, even if the input is real.
Example 1
The ifft() metho reconstructs the time-domain signal from its frequency-domain representation. This example demonstrates the basic usage of ifft() to transform data back to the time domain.
import numpy as np from scipy.fft import ifft # Frequency domain signal freq_data = np.array([4, 2+1j, 0, 2-1j]) # Compute the inverse FFT time_data = ifft(freq_data) print("Time-domain signal:", time_data)
When we run above program, it produces following result
Time-domain signal: [2. +0.j 0.5+0.j 0. +0.j 1.5+0.j]
Example 2
import numpy as np from scipy.fft import ifft # Frequency domain signal freq_data = np.array([1, 2, 3]) # Compute the inverse FFT with zero-padding time_data = ifft(freq_data, n=6) print("Zero-padded time-domain signal:", time_data)
Following is an output of the above code −
Zero-padded time-domain signal: [ 1. -0.j 0.08333333+0.72168784j -0.25 -0.14433757j 0.33333333-0.j -0.25 +0.14433757j 0.08333333-0.72168784j]
Example 3
import numpy as np from scipy.fft import fft, ifft # Original time-domain signal time_data = np.array([1, 2, 3, 4]) # Transform to frequency domain and back to time domain freq_data = fft(time_data) reconstructed_data = ifft(freq_data) print("Original signal:", time_data) print("Reconstructed signal:", reconstructed_data)
Output of the above code is as follows −
Original signal: [1 2 3 4] Reconstructed signal: [1.+0.j 2.+0.j 3.-0.j 4.+0.j]