OverLordGoldDragon / ssqueezepy

Synchrosqueezing, wavelet transforms, and time-frequency analysis in Python
MIT License
618 stars 96 forks source link

Add STFT & Synshrosqueezed STFT #25

Closed OverLordGoldDragon closed 3 years ago

OverLordGoldDragon commented 3 years ago

FEATURES:

BREAKING:

MISC:

OverLordGoldDragon commented 3 years ago

I see this paper's possibly main rationale (though unstated) for ssqueezing according to a Lebesgue measure (ones(Sx.shape)): stability. The STFT implementation takes FFTs along columns rather than rows; this creates extreme sensitivity to imperfections in the phase transform: for a given column, values in rows plot into wavelet-like oscillations, meaning upon summation (ssqueezing), exclusion of even a single value greatly impacts final value in a given Tx location.

I've verified this with a perfectly set up pure sinusoid (no shadow frequencies); perhaps the remedy is in also using a perfect window, but this many perfections are hardly realistic (or generalizable). Since Lebesgue sets all values in Sx to 1, exclusion of any one value is no big deal, and we see a dramatic improvement:

image

lebesgue's main strength is also its main weakness: values away from ridge (STFT max row) are (as should be) much smaller, but are counted as equals, which exacerbates noise energy and general perturbations. A simple compromise, then, is to sum abs(Sx) - which seems to work ideally:

image

Problem is, we may lose invertibility, but not necessarily by a lot. I've yet to gauge effectiveness for other kinds of signals.

OverLordGoldDragon commented 3 years ago

'Modified' STFT solves the problem quite neatly.

image