neurodsp.timefrequency.compute_wavelet_transform

neurodsp.timefrequency.compute_wavelet_transform(sig, fs, freqs, n_cycles=7, scaling=0.5, norm='amp')[source]

Compute the time-frequency representation of a signal using morlet wavelets.

Parameters
sig1d array

Time series.

fsfloat

Sampling rate, in Hz.

freqs1d array or list of float

If array, frequency values to estimate with morlet wavelets. If list, define the frequency range, as [freq_start, freq_stop, freq_step]. The freq_step is optional, and defaults to 1. Range is inclusive of freq_stop value.

n_cyclesfloat or 1d array

Length of the filter, as the number of cycles for each frequency. If 1d array, this defines n_cycles for each frequency.

scalingfloat

Scaling factor.

norm{‘sss’, ‘amp’}, optional

Normalization method:

  • ‘sss’ - divide by the square root of the sum of squares

  • ‘amp’ - divide by the sum of amplitudes

Returns
mwt2d array

Time frequency representation of the input signal.

Notes

This computes the continuous wavelet transform at specified frequencies across time.

Examples

Compute a Morlet wavelet time-frequency representation of a signal:

>>> from neurodsp.sim import sim_combined
>>> sig = sim_combined(n_seconds=10, fs=500,
...                    components={'sim_powerlaw': {}, 'sim_oscillation' : {'freq': 10}})
>>> mwt = compute_wavelet_transform(sig, fs=500, freqs=[1, 30])

Examples using neurodsp.timefrequency.compute_wavelet_transform

Morlet Wavelet Analysis

Morlet Wavelet Analysis