superlet module
- QhX.algorithms.superlets.superlet.FASLT(data_arr, samplerate, scales, order_max, order_min=1, c_1=3)[source]
Performs a Fractional Adaptive Superlet Transform (FASLT) on time-series data.
FASLT computes a time-frequency representation using a set of Morlet wavelets with fractional orders. The order of wavelets increases linearly with frequency, allowing for a more adaptive analysis across a range of frequencies.
- Parameters:
data_arr (ndarray) – Time-series data for analysis.
samplerate (float) – Sampling rate of the data in Hz.
scales (ndarray) – Array of scales for the wavelet transform.
order_max (int) – Maximum order of the superlet set.
order_min (int, optional) – Minimum order of the superlet set, default is 1.
c_1 (int, optional) – Number of cycles for the base Morlet wavelet, default is 3.
- Returns:
ndarray
- Return type:
Result of the Fractional Adaptive Superlet Transform.
- QhX.algorithms.superlets.superlet.compute_adaptive_order(freq, order_min, order_max)[source]
Computes the superlet order for given frequencies in the Fractional Adaptive SLT.
This is a linear mapping between the minimal and maximal order onto the respective minimal and maximal frequencies.
- Parameters:
(ndarray) (- freq) – Array of frequencies of interest.
(int) (- order_max) – Minimal order in the superlet set.
(int) – Maximal order in the superlet set.
- Returns:
ndarray
- Return type:
Array of computed orders for the given frequencies.
- QhX.algorithms.superlets.superlet.cwtSL(data, wavelet, scales, dt)[source]
Performs Continuous Wavelet Transform using a specified wavelet and scales.
- Parameters:
data (-) – Time-series data for analysis.
wavelet (-) – Morlet wavelet object used for the transform.
scales (-) – Array of scales for the wavelet transform.
dt (-) – Time step of the data.
- Returns:
ndarray
- Return type:
Continuous wavelet transform of the input data.
- QhX.algorithms.superlets.superlet.fourier_period(scale)[source]
Calculates the approximate Fourier period for a given scale using Morlet wavelet.
- Parameters:
(float) (-scale) –
- Returns:
float
Approximate Fourier period corresponding to the given scale.
- QhX.algorithms.superlets.superlet.gen_superlet_testdata(freqs=[20, 40, 60], cycles=11, fs=1000, eps=0)[source]
Generates test data for superlet analysis, consisting of harmonic superpositions.
This function creates a signal composed of multiple oscillations with specified frequencies. Each oscillation is a few-cycle harmonic with an optional addition of white noise. It is useful for demonstrating and testing superlet transform functionality.
- Parameters:
float (- freqs (list of) – Frequencies of the oscillations to be included in the signal. Default is [20, 40, 60] Hz.
optional) – Frequencies of the oscillations to be included in the signal. Default is [20, 40, 60] Hz.
(int (- fs) – Number of cycles for each oscillation. Default is 11.
optional) – Number of cycles for each oscillation. Default is 11.
(int – Sampling frequency in Hz. Default is 1000 Hz.
optional) – Sampling frequency in Hz. Default is 1000 Hz.
(float (- eps) – Standard deviation of additive white noise. Default is 0 (no noise).
optional) – Standard deviation of additive white noise. Default is 0 (no noise).
- Returns:
ndarray
- Return type:
Generated 1D signal array containing harmonic superpositions with optional noise.
Examples
>>> import numpy as np >>> from mymodule import gen_superlet_testdata >>> signal = gen_superlet_testdata(freqs=[20, 40, 60], cycles=10, fs=1000, eps=0.1)
- QhX.algorithms.superlets.superlet.multiplicativeSLT(data_arr, samplerate, scales, order_max, order_min=1, c_1=3)[source]
Performs a multiplicative Superlet Transform on time-series data.
This function computes the multiplicative Superlet Transform by combining Morlet wavelets with increasing cycles, resulting in a super-resolution time-frequency representation.
- Parameters:
data_arr (ndarray) – Time-series data for analysis.
samplerate (float) – Sampling rate of the data in Hz.
scales (ndarray) – Array of scales for the wavelet transform.
order_max (int) – Maximum order of the superlet set.
order_min (int, optional) – Minimum order of the superlet set, default is 1.
c_1 (int, optional) – Number of cycles for the base Morlet wavelet, default is 3.
- Returns:
ndarray
- Return type:
Result of the multiplicative Superlet Transform.
- QhX.algorithms.superlets.superlet.scale_from_period(period)[source]
Determines the scale corresponding to a given Fourier period using Morlet wavelet.
- Parameters:
(float) (-period) –
- Returns:
float
- Return type:
Scale corresponding to the given Fourier period.
- QhX.algorithms.superlets.superlet.superlet(data_arr, samplerate, scales, order_max, order_min=1, c_1=3, adaptive=False)[source]
Performs Superlet Transform (SLT) on time-series data.
This function computes either a multiplicative SLT or a fractional adaptive SLT (FASLT), based on the ‘adaptive’ flag. Multiplicative SLT is recommended for analysis within a narrow frequency band, while FASLT is suitable for a broader range of frequencies. The transform combines multiple Morlet wavelets with varying cycles to achieve super-resolution in time-frequency analysis.
- Parameters:
data_arr (ndarray) – Uniformly sampled time-series data. The first dimension is treated as the time axis.
samplerate (float) – Sampling rate of the time-series data in Hz.
scales (ndarray) – Array of scales for the wavelet transform, ordered from high to low for adaptive=True.
order_max (int) – Maximum order for the superlet set, dictating the highest number of cycles.
order_min (int, optional) – Minimum order for the superlet set, default is 1.
c_1 (int, optional) – Base number of cycles for the lowest-order Morlet wavelet, default is 3.
adaptive (bool, optional) – Flag to choose between multiplicative SLT and FASLT, default is False.
- Returns:
ndarray
- Return type:
Geometric mean of the complex time-frequency representation of the input data.
References
This module provides a suite of functions for time-frequency analysis using superlet transforms. Functions include methods for generating test data, scaling from periods, performing the superlet transform, and other related utilities.