bycycle-tools / bycycle

Cycle-by-cycle analysis of neural oscillations.

Home Page:https://bycycle-tools.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Burst classification on parts of the signal vs. whole signal

rahul-jayaram1 opened this issue · comments

Hello,

I have been using cycle-by-cycle analysis on our data, which is epoched at 600 ms intervals. We had been in touch about navigating this analysis before, and I am currently looking into how we can use cycle-by-cycle to determine differences is oscillations before and after a beta event.

I am in the process of optimizing the burst detection parameters, and I was wondering if it would be possible to run the analysis such that certain oscillations are disregarded if they don’t meet the threshold requirements? From my understanding, this code classifies a signal as oscillatory or not depending on a set minimum value of valid oscillations, 3 being the default. However, in our data, for each trial there are regions that are rhythmic and regions that are not. Classifying the entire trial as either a burst or not may lead us to miss out on some of the oscillatory data on the trials that are not classified as bursts. Is there a way to not reject the entire signal, but instead only reject the areas that violate the threshold parameters, when running statistics on our data?

Thank you so much for all of your help.

  • Rahul Jayaram

Hi @rahul-jayaram1,

Our team had a discussion about epoched data last week, and I believe the consensus was to run bycycle on the full, non-epoched signal first (i.e. flatten the epochs into a continuous 1d array), when the epochs are short (tagging in @sydney-smith to confirm this). The bycycle dataframe output may then be epoched, rather than the signal, for more accurate burst detection.

The reasons for this are noted in #58 and being worked on in #59. This issue involves: 1) signal edge (beginning/end) artifacts with internal filtering leading to missing zero-crossing cyclepoints 2) first/last oscillation labeled as non-burst due to amplitude and period consistency measure nans (consistency is based on adjacent cycles and cannot be determined for the first/last cycle). Epoching data into short intervals prior to using bycycle will increase the effects of these issues, leading to a greater number of incorrectly labeled bursts.

Lastly, cycles should be classified as burst or non-burst, not the entire epoch (assuming a given epoch contains more than 1 cycle). Regions of the signal that violate threshold params may be visualized using bycycle.burst.plot_burst_detect_params and thresholds may be adjusted using the burst_detection_kwargs argument (note: this is for pypi version 0.1.3, not the master branch which is undergoing a breaking refactor). When parameters drop below these threshold, a cycle will get a False in the is_burst column. Lowering these burst_detection_kwargs dictionary values results in more detected burst, but this will also increase the risk for false positives.

# Adjust these params to adjust burst detection
burst_detection_kwargs = {'amplitude_fraction_threshold': .2,
                'amplitude_consistency_threshold': .5,
                'period_consistency_threshold': .5,
                'monotonicity_threshold': .8,
                'N_cycles_min': 3} 

df = compute_features(signal, Fs, f_alpha, burst_detection_kwargs=burst_detection_kwargs)

#  Restrict the dataframe to only cycles the meet `burst_detection_kwargs` thresholds:
df_bursts = df[df['is_burst']==True]

I hope this helps. If any thing is unclear or you still are having problems, I can attempt to tune bycycle parameters for a sample of your data.

Hi @rahul-jayaram1, feel free to reopen if you have further questions. I hope my response was use helpful.