neurodsp.timefrequency.phase_by_time

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

Compute the instantaneous phase 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
pha1d array

Instantaneous phase time series.

Examples

Compute the instantaneous phase, 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}})
>>> pha = phase_by_time(sig, fs=500, f_range=(8, 12))

Examples using neurodsp.timefrequency.phase_by_time

Time-frequency analysis

Time-frequency analysis