bycycle.objs.BycycleGroup

class bycycle.objs.BycycleGroup(center_extrema='peak', burst_method='cycles', burst_kwargs=None, thresholds=None, find_extrema_kwargs=None, return_samples=True)[source]

Compute bycycle features for a 2d or 3d signal.

Attributes:
modelslist of Bycycle

Fit Bycycle objects.

sigs2d or 3d array

Voltage time series.

fsfloat

Sampling rate, in Hz.

f_rangetuple of (float, float)

Frequency range for narrowband signal of interest (Hz).

center_extrema{‘peak’, ‘trough’}

The center extrema in the cycle.

  • ‘peak’ : cycles are defined trough-to-trough

  • ‘trough’ : cycles are defined peak-to-peak

burst_method{‘cycles’, ‘amp’}

Method for detecting bursts.

  • ‘cycles’: detect bursts based on the consistency of consecutive periods & amplitudes

  • ‘amp’: detect bursts using an amplitude threshold

burst_kwargsdict, optional, default: None

Additional keyword arguments defined in compute_burst_fraction() for dual amplitude threshold burst detection (i.e. when burst_method=’amp’).

threshold_kwargsdict, optional, default: None

Feature thresholds for cycles to be considered bursts, matching keyword arguments for:

find_extrema_kwargsdict, optional, default: None

Keyword arguments for function to find peaks an troughs (find_extrema()) to change filter parameters or boundary. By default, the filter length is set to three cycles of the low cutoff frequency (f_range[0]).

axis{0, 1, (0, 1), None}

For 2d arrays:

  • axis=0 : Iterates over each row/signal in an array independently (i.e. for each

channel in (n_channels, n_timepoints)). - axis=None : Flattens rows/signals prior to computing features (i.e. across flatten epochs in (n_epochs, n_timepoints)).

For 3d arrays:

  • axis=0 : Iterates over 2D slices along the zeroth dimension, (i.e. for each

channel in (n_channels, n_epochs, n_timepoints)). - axis=1 : Iterates over 2D slices along the first dimension (i.e. across flatten epochs in (n_epochs, n_channels, n_timepoints)). - axis=(0, 1) : Iterates over 1D slices along the zeroth and first dimensions (i.e across each signal independently in (n_participants, n_channels, n_timepoints)).

return_samplesbool, optional, default: True

Returns samples indices of cyclepoints used for determining features if True.

__init__(center_extrema='peak', burst_method='cycles', burst_kwargs=None, thresholds=None, find_extrema_kwargs=None, return_samples=True)[source]

Initialize object settings.

Methods

__init__([center_extrema, burst_method, ...])

Initialize object settings.

fit(sigs, fs, f_range[, axis, n_jobs, progress])

Run the bycycle algorithm on a 2D or 3D array of signals.

recompute_edges([reduction])

Recomputes features for cycles on the edge of bursts.

reduce_thresholds(reduction)

Adjust thresholds by a given amount.

fit(sigs, fs, f_range, axis=0, n_jobs=-1, progress=None)[source]

Run the bycycle algorithm on a 2D or 3D array of signals.

Parameters:
sigs3d array

Voltage time series, with 2d or 3d shape.

fsfloat

Sampling rate, in Hz.

f_rangetuple of (float, float)

Frequency range for narrowband signal of interest, in Hz.

recompute_edgesbool, optional, default: False

Recomputes features for cycles on the edge of bursts.

axis{0, 1, (0, 1), None}

For 2d arrays:

  • axis=0 : Iterates over each row/signal in an array independently (i.e. for each

channel in (n_channels, n_timepoints)). - axis=None : Flattens rows/signals prior to computing features (i.e. across flatten epochs in (n_epochs, n_timepoints)).

For 3d arrays:

  • axis=0 : Iterates over 2D slices along the zeroth dimension, (i.e. for each

channel in (n_channels, n_epochs, n_timepoints)). - axis=1 : Iterates over 2D slices along the first dimension (i.e. across flatten epochs in (n_epochs, n_channels, n_timepoints)). - axis=(0, 1) : Iterates over 1D slices along the zeroth and first dimensions (i.e across each signal independently in (n_participants, n_channels, n_timepoints)).

n_jobsint, optional, default: -1

The number of jobs to compute features in parallel.

progress{None, ‘tqdm’, ‘tqdm.notebook’}

Specify whether to display a progress bar. Uses ‘tqdm’, if installed.

recompute_edges(reduction=None)[source]

Recomputes features for cycles on the edge of bursts.

Parameters:
reductionfloat, optional, default: None

Reduces all float thresholds by given amount.

reduce_thresholds(reduction)

Adjust thresholds by a given amount.

Parameters:
reductionfloat, optional, default: None

Reduces all float thresholds by given amount.

Returns:
reduced_thresholdsdict

Copy of thresholds with reduction applied.