
- 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 - idst() Function
The scipy.fft.idst() method calculates the Inverse Discrete Sine Transform (IDST), which converts frequency-domain data back to spatial domain. It reverses the DST transformation to recover the original data, emphasizing odd-symmetric components.
IDST is essential for reconstructing signals, it proves vital in audio processing applications and vibration analysis or the numerical problem solving field to have data altered by DST perfectly rebuilt.
There are four types of transforms possible with the idst method. Type 1 is self-inverse and corresponds to DST Type 1. Type 2 is used most commonly and acts as the inverse of DST Type 3. Type 3 is the inverse of DST Type 2 but Type 4 is built for applications that require tight symmetry.
IDST is perfectly compatible with DST, and it provides lossless transformation and reconstruction. It is also used with FFT for the evaluation and handling of mixed-symmetry signals.
Syntax
The syntax for the SciPy idst() method is as follows −
.idst(x, type=2, n=None, axis=-1, norm=None, overwrite_x=False, workers=None, orthogonalize=None)
Parameters
This method accepts the following parameters −
x − Input array to be transformed from the frequency domain to the spatial domain.
type − Specifies the type of IDST (1, 2, 3, or 4).
n − Length of the transform; pads or truncates input data if specified.
axis − Axis for the IDST in multi-dimensional arrays (default: last axis).
norm − The normalization mode 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 − Modifies input to save memory if True. Fact: IDCT, when paired with DCT, provides perfect reconstruction of the original data if no coefficients are modified.
workers − Number of threads to use for parallel computation. Default is 1.
orthogonalize − Allows explicit orthogonalization for advanced use cases. Default is None.
Return Value
Transformed Array − Returns the IDST-transformed array in the spatial domain, corresponding to the original input before the DST transformation.
Example 1
This example demonstrates how the IDST may recover spatial-domain data from frequency-domain coefficients, thereby reversing the DST transformation.
In the below code, the frequency-domain array is fed into idst(), and the rebuilt spatial data is printed. The result corresponds to the original data before the DST transformation.
import numpy as np import scipy.fft from scipy.fft import idst freq_data = [19.52241113, -10.3354213, -4, 1.20368834] result = scipy.fft.idst(freq_data) print("Reconstructed data using IDST:", result)
When we run above program, it produces following result
Reconstructed data using IDST: [-0.73275429 2.91424979 6.86929511 2.62044687]
Example 2
The n parameter in idst() controls the length of the transform, allowing the input data to be padded with zeros or truncated to match the specified length.
In this code, the length of the frequency-domain array is 5. The IDST reconstructs the spatial-domain data with n=5 and retains any padding or truncation applied in the DST transformation. The output is the original values along with zero-padding for elements beyond the length of the input data set.
import numpy as np import scipy.fft from scipy.fft import idst freq_data = [32.84612239, -19.08678615, -7.5, 1.11489023, 0] result = idst(freq_data, n=5) print("Reconstructed data with padded input:", result)
Following is an output of the above code −
Reconstructed data with padded input: [-1.21524505 1.08950308 8.06922448 8.61267443 2.84819807]
Example 3
This example demonstrates the perfect reconstruction property of the combination of DST and IDST.
in the below code, the original data is modified using dst() and then rebuilt using idst(). The final output is that of the input, so data integrity is maintained.
from scipy.fft import dst original_data = [3, 6, 9, 12] freq_data = dst(original_data, norm='ortho') reconstructed_data = dst(freq_data, norm='ortho') print("Original Data:", original_data) print("Frequency Data (DST):", freq_data) print("Reconstructed Data (IDST):", reconstructed_data)
Output of the above code is as follows −
Original Data: [3, 6, 9, 12] Frequency Data (DST): [13.85819299 -6. 5.74025149 -3. ] Reconstructed Data (IDST): [ 3. 6. 9. 12.]