bycycle.features.compute_burst_features

bycycle.features.compute_burst_features(df_shape_features, sig, burst_method='cycles', burst_kwargs=None)[source]

Compute burst features for each cycle.

Parameters:
df_shape_featurespandas.DataFrame

Shape parameters for each cycle, determined using compute_shape_features().

sig1d array

Voltage time series used for determining monotonicity.

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 arguments required for amplitude burst detection. Defined in compute_burst_fraction(), keys include:

  • fs : required for dual amplitude threshold burst detection

  • f_range : required for dual amplitude threshold burst detection

  • amp_threshes : optional, default: (1, 2)

  • min_n_cycles : optional, default: 3

  • min_burst_duration : optional, default: None

  • filter_kwargs : optional, default: None

Returns:
df_burst_featurespandas.DataFrame

Dataframe containing burst features. Each row is one cycle. Columns:

When cycle consistency burst detection is used (i.e. burst_method == ‘cycles’):

  • amp_fraction : normalized amplitude

  • amp_consistency : difference in the rise and decay voltage within a cycle

  • period_consistency : difference between a cycle’s period and the period of the adjacent cycles

  • monotonicity : fraction of monotonic voltage changes in rise and decay phases (positive going in rise and negative going in decay)

When dual threshold burst detection is used (i.e. burst_method == ‘amp’):

  • burst_fraction : fraction of a cycle that is bursting

Examples

Compute burst features:

>>> from bycycle.features import compute_shape_features
>>> from neurodsp.sim import sim_bursty_oscillation
>>> fs  = 500
>>> sig = sim_bursty_oscillation(10, fs, 10)
>>> df_shapes = compute_shape_features(sig, fs, f_range=(8, 12))
>>> df_burst = compute_burst_features(df_shapes, sig, burst_method='amp',
...                                   burst_kwargs={'fs': fs, 'f_range': (8, 12)})