bycycle.burst.recompute_edges¶
- bycycle.burst.recompute_edges(df_features, threshold_kwargs, burst_method='cycles', burst_kwargs=None)[source]¶
Recompute the is_burst column for cycles on the edges of bursts.
- Parameters:
- df_featurespandas.DataFrame
A dataframe containing shape and burst features for each cycle.
- threshold_kwargsdict
Feature thresholds for cycles to be considered bursts, matching keyword arguments for:
detect_bursts_cycles()
for consistency burst detection (i.e. when burst_method == ‘cycles’)
- Returns:
- df_features_edgespandas.DataFrame
An cycle feature dataframe with an updated
is_burst
column for edge cycles.
Notes
df_features must be computed using consistency burst detection.
Examples
Lower the amplitude consistency threshold to zero for cycles on the edges of bursts:
>>> from neurodsp.sim import sim_combined >>> from bycycle.features import compute_features >>> sig = sim_combined(n_seconds=4, fs=1000, components={'sim_bursty_oscillation': {'freq': 10}, ... 'sim_powerlaw': {'exp': 2}}) >>> threshold_kwargs = {'amp_fraction_threshold': 0., 'amp_consistency_threshold': .5, ... 'period_consistency_threshold': .5, 'monotonicity_threshold': .4, ... 'min_n_cycles': 3} >>> df_features = compute_features(sig, fs=1000, f_range=(8, 12), ... threshold_kwargs=threshold_kwargs) >>> threshold_kwargs['amp_consistency_threshold'] = 0 >>> df_features_edges = recompute_edges(df_features, threshold_kwargs)