- 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 - Wavelet Transform
Wavelet Transforms in SciPy
In SciPy the Wavelet Transform refers to a mathematical technique provided by the scipy.signal module that allows the decomposition of a signal into different frequency components using wavelets. It provides tools to analyze signals at multiple scales by making it particularly useful for non-stationary signals where frequency content changes over time.
The Key definition of Wavelet Transform in SciPy can be given as Wavelet Transform applies scaled and shifted versions of a chosen wavelet function to the input signal to analyze its frequency and temporal characteristics simultaneously.
Wavelet Transform can be broadly categorized based on how the signal is analyzed and the nature of the wavelet functions used. They are as follows −
Continuous Wavelet Transform (CWT)
The Continuous Wavelet Transform (CWT) provides a continuous time-frequency representation of a signal by scaling and translating a wavelet function continuously.
Key Features
Following are the key features of the Continuous Wavelet Transform(CWT) −
- High resolution but computationally expensive.
- Redundant representation of data.
- Useful for analyzing non-stationary signals.
Applications: Biomedical signal analysis, seismic data, speech processing.
Discrete Wavelet Transform (DWT)
The Discrete Wavelet Transform (DWT) Decomposes a signal into approximation and detail coefficients at discrete scales using filter banks.
Key Features
Here are the key features of the Discrete Wavelet Transform(DWT) −
- Efficient, non-redundant multi-resolution analysis.
- Downsampling reduces data size at each level.
- It is used in compression and denoising.
Applications: Image compression (JPEG2000), feature extraction, signal processing.
Stationary Wavelet Transform (SWT)
The Stationary Wavelet Transform (SWT) is a modification of DWT that avoids downsampling by preserving the signal length at each decomposition level.
Key Features
Below are the key features of the Stationary Wavelet Transform(SWT) −
- Efficient, non-redundant multi-resolution analysis.
- Downsampling reduces data size at each level.
- It is used in compression and denoising.
Applications: Biomedical signal denoising, image texture analysis.
Wavelet Packet Transform (WPT)
The Wavelet Packet Transform (WPT) is the extended DWT by recursively decomposing both approximation and detail coefficients, offering a full binary tree representation.
Key Features
Following are the key features of the Wavelet Packet Transform (WPT) −
- Provides finer frequency resolution.
- Computationally intensive but useful for detailed analysis.
- Useful in high-precision applications.
Applications: Speech and vibration analysis, pattern recognition.
Multi-Resolution Analysis (MRA)
Multi-Resolution Analysis (MRA) is a framework in wavelet analysis that represents signals at different resolutions by iterative decomposition.
Key Features
Below are the key features of the Multi-Resolution Analysis (MRA) −
- Hierarchical representation of signals.
- Provides insight into features at different scales.
- Often used with DWT.
Applications: Data compression, image processing.
Example
Here is the basic example shows how the DWT breaks a signal down into different frequency components which can be useful for many applications such as signal compression and noise removal.
import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import convolve
# Generate a sample signal: a sum of two sine waves with different frequencies
t = np.linspace(0, 1, 1000, endpoint=False)
signal = np.sin(2 * np.pi * 50 * t) + np.sin(2 * np.pi * 120 * t)
# Manually create a Morlet wavelet
def morlet_wavelet(t, w=5):
return np.exp(2j * np.pi * t) * np.exp(-t**2 / (2 * w**2))
# Create Morlet wavelet (using real part only)
wavelet = np.real(morlet_wavelet(t, w=5))
# Convolve the signal with the Morlet wavelet to perform a simple wavelet-based transform
convolved_signal = convolve(signal, wavelet, mode='same')
# Plot original signal and convolved signal
plt.figure(figsize=(12, 6))
# Plot the original signal
plt.subplot(2, 1, 1)
plt.plot(t, signal)
plt.title("Original Signal: Sum of Sine Waves")
plt.xlabel("Time [s]")
plt.ylabel("Amplitude")
# Plot the convolved (wavelet-transformed) signal
plt.subplot(2, 1, 2)
plt.plot(t, convolved_signal)
plt.title("Signal After Convolution with Morlet Wavelet")
plt.xlabel("Time [s]")
plt.ylabel("Amplitude")
plt.tight_layout()
plt.show()
Following is the output of the basic example of Morlet Wavelet Transform −
Here are the functions available in SciPy which are used to perform different Wavelet Transform −
| S.No. | Function & Description |
|---|---|
| 1 | scipy.signal.correlate() Cross-correlation measures the similarity between two signals as a function of the time-lag applied to one of them. |
| 2 | scipy.signal.convolve() Convolution is used to apply a filter to a signal. |
Applications of Wavelet Transform
Here are the applications of the Wavelet Transform −
- Signal Denoising: Suppressing noise while retaining significant features.
- Compression: Reducing data storage by preserving only important coefficients.
- Feature Extraction: Used in machine learning and biomedical applications.
- Time-Frequency Analysis: Identifying transient events in signals.
- Image Processing: Edge detection and compression.