twistpy.utils.stransform#

stransform(signal, dsfacf: int = 1, k: float = 1) Tuple[ndarray, ndarray][source]#

Compute the discrete S-transform of the input signal.

The S-transform or Stockwell transform provides a time-frequency representation of a signal. It is an extension of the continuous wavelet transform (CWT), obtained using a scalable localizing Gaussian window [1]. It is defined as:

\[S(\tau,\ f)\ =\ \frac{\left|f\right|}{k\sqrt{2\pi}} \int_{-\infty}^{\infty}{u(t)exp\left(\frac{{-f}^2{(\tau-t)}^2}{2k^2}\right)}e^{-i2\pi ft}dt,\]

where \(u\) is the signal as a continuous function of time \(t\), \(\tau\) is the translation of the Gaussian window, \(f\) is frequency, and \(k\) is a user-set constant specifying a scaling factor controlling the number of oscillations in the window. When \(k\) increases, the frequency resolution increases, with a corresponding loss of time resolution [2].

Hint

[1] Stockwell, R. G., Mansinha, L., and Lowe, R. P. (1996). Localization of the complex spectrum: the S transform, IEEE Transactions on Signal Processing, 44(4), https://ieeexplore.ieee.org/document/492555

[2] Simon, C., Ventosa, S., Schimmel, M., Heldring, A., Dañobeitia, J. J., Gallart, J., & Mànuel, A. (2007). The S-transform and its inverses: Side effects of discretizing and filtering.IEEE Transactions on Signal Processing, 55(10), 4928–4937. https://doi.org/10.1109/TSP.2007.897893

Parameters
signalnumpy.ndarray of float

Real signal

dsfacfint, default=1

Down-sampling factor in the frequency direction -> enables efficient computation for long signals.

Warning

Downsampling of the frequency axis (dsfacf > 1) prevents the accurate computation of the inverse transform!

kfloat, default=1.

Scaling factor that controls the number of oscillations in the window. When k increases, the frequency resolution increases, with a corresponding loss of time resolution [2].

Returns
strannumpy.ndarray of numpy.complex128

S-transform of the signal.

fnumpy.ndarray of float

Normalized frequency vector (divide by sampling interval dt to get frequency in Hz).

Examples using twistpy.utils.stransform#

3-C Polarization analysis and filtering in the time-frequency domain

3-C Polarization analysis and filtering in the time-frequency domain

3-C Polarization analysis and filtering: Real data example using a marsquake recorded by InSight

3-C Polarization analysis and filtering: Real data example using a marsquake recorded by InSight

6-C wave type fingerprinting

6-C wave type fingerprinting

S-transform

S-transform