I had a similar experience … the reason is that the function only looks for peak-to-peak in consecutive samples as mentioned in the fine print. What you need is a function that finds peak-to-peak in a longer time window. Your best bet is to provide a rejection threshold during epoching. You can use get_rejection_threshold function in autoreject to make your life a little simpler.
However, if you cannot work with epoched data, you may find this function I wrote with a collaborator useful. This is a bit buggy, so please check carefully before using … I haven’t found the time to fix the bugs. If you do manage to fix the edge cases, do share the code!
I think we should have a way to annotate using a rolling peak to peak estimator. You provide
the window length and then you double its length to build the annotations.
I tried using the code you provided - it worked like a charm in my case (at least), not sure about other edge cases. Although one needs to chose hyper-parameters carefully. But I just have one more question, now that I have annotated the bad segments, how do I reject them?
I’m sorry if its a silly question. I don’t have much prior experience working with raw EEG data.
Segments annotated as anything starting with “BAD_” will be automatically ignored by MNE in all subsequent processing steps (filtering, epoching etc) so there’s nothing more you need to do!
PR means pull request — Alex was asking whether you could contribute the code you used to get those annotations to MNE-Python via a GitHub Pull Request
So, I understand that while the segment is marked as ‘BAD_’, mne won’t process that segment. But my question/problem is when I am extracting data from ‘raw’ into a numpy array that annotated data is also getting extracted.
So is there a way to either extract data without the annotated segment or to completely reject (or delete) the annotated segment?
It’s on my todo but I will likely not get to it soon enough. If anyone else wants to take the initiative, please feel free to create a PR. A feature in autoreject to export the reject log as an annotation is also needed …