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 peakstroughs: signal indices of oscillatory troughsrises: signal indices of oscillatory rising zero-crossingsdecays: signal indices of oscillatory decaying zero-crossingssample_peak: sample at which the peak occurssample_zerox_decay: sample of the decaying zero-crossingsample_zerox_rise: sample of the rising zero-crossingsample_last_trough: sample of the last troughsample_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))