bycycle.cyclepoints.extrema_interpolated_phase

bycycle.cyclepoints.extrema_interpolated_phase(sig, peaks, troughs, rises=None, decays=None)[source]

Use extrema and (optionally) zero-crossings to estimate instantaneous phase.

Parameters:
sig1d array

Time series.

peaks1d array

Samples of oscillatory peaks.

troughs1d array

Samples of oscillatory troughs.

rises1d array, optional

Samples of oscillatory rising zero-crossings.

decays1d array, optional

Samples of oscillatory decaying zero-crossings.

Returns:
pha1d array

Instantaneous phase time series.

Notes

  • Phase is encoded as:
    • phase 0 for peaks

    • phase pi/2 for decay zero-crossing

    • phase pi/-pi for troughs

    • phase -pi/2 for rise zero-crossing

  • Extrema and zero-crossing estimation can be poor if, for example, the signal is noisy. In such cases, the same index may be assigned to both a peak and a decaying zero-crossing. To address this, we first assign phase values by zero-crossings, and then may overwrite them with extrema phases.

  • Using burst detection helps avoid analyzing oscillatory properties of non-oscillatory sections of the signal.

Examples

Estimate phase from peaks and troughs:

>>> from neurodsp.sim import sim_bursty_oscillation
>>> from bycycle.cyclepoints import find_extrema
>>> fs = 500
>>> sig = sim_bursty_oscillation(10, fs, freq=10)
>>> peaks, troughs = find_extrema(sig, fs, f_range=(8, 12))
>>> pha = extrema_interpolated_phase(sig, peaks, troughs)