neurodsp.timefrequency.compute_instantaneous_measure¶
- neurodsp.timefrequency.compute_instantaneous_measure(sig, fs, measure, f_range=None, remove_edges=True, **filter_kwargs)[source]¶
Compute an instantaneous measure.
- Parameters:
- sig1d array
Time series.
- fsfloat
Sampling rate, in Hz.
- measure{‘phase’, ‘amp’, ‘freq’}
Which instantaneous measure to compute.
- 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:
- measure1d array
Computed instantaneous measure.
Examples
Simulate an example signal, with an alpha oscillation:
>>> from neurodsp.sim import sim_combined >>> sig = sim_combined(n_seconds=10, fs=500, ... components={'sim_powerlaw': {}, 'sim_oscillation': {'freq': 10}})
Compute the instantaneous phase of the signal:
>>> i_phase = compute_instantaneous_measure(sig, fs=500, measure='phase', f_range=(8, 12))
Compute the instantaneous amplitude of the signal:
>>> i_amp = compute_instantaneous_measure(sig, fs=500, measure='amp', f_range=(8, 12))