neurodsp.timefrequency.freq_by_time

neurodsp.timefrequency.freq_by_time(sig, fs, f_range=None, remove_edges=True, **filter_kwargs)[source]

Compute the instantaneous frequency of a time series.

Parameters
sig1d array

Time series.

fsfloat

Sampling rate, in Hz.

f_rangetuple of float or None, optional default: None

Filter range, in Hz, as (low, high). If None, no filtering is applied.

remove_edgesbool, optional, default: True

If True, replace samples that are within half of the filter’s length to the edge with nan. This removes edge artifacts from the filtered signal. Only used if f_range is defined.

**filter_kwargs

Keyword parameters to pass to filter_signal.

Returns
i_f1d array

Instantaneous frequency time series.

Notes

This function assumes monotonic phase, so phase slips will be processed as high frequencies.

Examples

Compute the instantaneous frequency, for the alpha range:

>>> from neurodsp.sim import sim_combined
>>> sig = sim_combined(n_seconds=10, fs=500,
...                    components={'sim_powerlaw': {}, 'sim_oscillation' : {'freq': 10}})
>>> instant_freq = freq_by_time(sig, fs=500, f_range=(8, 12))

Examples using neurodsp.timefrequency.freq_by_time

Time-frequency analysis

Time-frequency analysis