bycycle.cyclepoints.find_zerox

bycycle.cyclepoints.find_zerox(sig, peaks, troughs)[source]

Find zero-crossings within each cycle, from identified peaks and troughs.

Parameters:
sig1d array

Time series.

peaks1d array

Samples of oscillatory peaks.

troughs1d array

Samples of oscillatory troughs.

Returns:
rises1d array

Samples at which oscillatory rising zero-crossings occur.

decays1d array

Samples at which oscillatory decaying zero-crossings occur.

Notes

  • Zero-crossings are defined as when the voltage crosses midway between one extrema and the next. For example, a ‘rise’ is halfway from the trough to the peak.

  • If this halfway voltage is crossed at multiple times, the temporal median is taken as the zero-crossing.

  • Sometimes, due to noise in estimating peaks and troughs when the oscillation is absent, the estimated peak might be lower than an adjacent trough. If this occurs, the rise and decay zero-crossings will be set to be halfway between the peak and trough.

  • Burst detection should be used to restrict phase estimation to periods with oscillations present, in order to ignore periods of the signal in which estimation is poor.

Examples

Find the rise and decay zero-crossings locations of a simulated signal:

>>> 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))
>>> rises, decays = find_zerox(sig, peaks, troughs)

Examples using bycycle.cyclepoints.find_zerox

2. Cycle-by-cycle algorithm

2. Cycle-by-cycle algorithm