bycycle.features.compute_cyclepoints

bycycle.features.compute_cyclepoints(sig, fs, f_range, **find_extrema_kwargs)[source]

Compute sample indices of cyclepoints.

Parameters:
sig1d array

Time series.

fsfloat

Sampling rate, in Hz.

f_rangetuple of (float, float)

Frequency range, in Hz, to narrowband filter the signal. Used to find zero-crossings.

find_extrema_kwargsdict, optional, default: None

Keyword arguments for the function to find peaks and troughs (find_extrema()) that change filter parameters or boundary. By default, the boundary is set to zero.

Returns:
df_samplespandas.DataFrame

Dataframe containing sample indices of cyclepoints. Columns (listed for peak-centered cycles):

  • peaks : signal indices of oscillatory peaks

  • troughs : signal indices of oscillatory troughs

  • rises : signal indices of oscillatory rising zero-crossings

  • decays : signal indices of oscillatory decaying zero-crossings

  • sample_peak : sample at which the peak occurs

  • sample_zerox_decay : sample of the decaying zero-crossing

  • sample_zerox_rise : sample of the rising zero-crossing

  • sample_last_trough : sample of the last trough

  • sample_next_trough : sample of the next trough

Examples

Compute the signal indices of cyclepoints:

>>> from neurodsp.sim import sim_bursty_oscillation
>>> fs = 500
>>> sig = sim_bursty_oscillation(10, fs, freq=10)
>>> df_samples = compute_cyclepoints(sig, fs, f_range=(8, 12))