Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question on workflow regarding continuous time scalp EEG #231

Open
adam2392 opened this issue Sep 21, 2021 · 4 comments
Open

Question on workflow regarding continuous time scalp EEG #231

adam2392 opened this issue Sep 21, 2021 · 4 comments
Labels

Comments

@adam2392
Copy link

Hi,

I wasn't sure where the best place to ask was, so posting here. I have continuous time scalp EEG (not trials of a task) over say 5-10 minutes. These are just resting state EEG of non-seizing epilepsy patients in the EMU. During these 5-10 minutes the subject might move or have periods of very bad artifacts. I have three goals:

i) detect the time points and channels at which these occur
ii) (optionally) repair these time points
iii) downstream, I will use this EEG and feed into ICA to further remove noise artifacts

Question 1:

Rn auto reject operates under the assumption that you have Epochs. Would the correct thing to do be: make fixed length epochs and feed it in? How long should my epochs generally be?

Question 2:

If I only care about the detected bad time points/channels, would I just do autoreject.fit() and then call some private parameter in https://autoreject.github.io/generated/autoreject.AutoReject.html#autoreject.AutoReject?

@jasmainak
Copy link
Member

hey @adam2392 ! yes this is the right place to ask the questions

What will you use these data for? I am assuming for some time-frequency analysis? In that case you might want to make epochs that are long enough to avoid edge artifacts. But the longer you make epochs, the more chances you have of marking them as bad and rejecting them because of an artifact. So it's a bit of a trade-off.

If you care only about the detected bad time points/channels you can do something like this:

ar = Autoreject(n_interpolates=0)
ar.fit(epochs)
_, reject_log = ar.transform(epochs, return_log=True)

this might do the job for you. Since you mentioned ICA, let me also drop this link for you:

https://890-59485140-gh.circle-artifacts.com/0/html/auto_examples/plot_autoreject_workflow.html#sphx-glr-auto-examples-plot-autoreject-workflow-py

let me know if this does the job for you. If your workflow needs some small tweaks to the autoreject API I'm open to that.

@jasmainak
Copy link
Member

also reminds me of this issue: #127

@adam2392
Copy link
Author

adam2392 commented Oct 25, 2021

@jasmainak I have a few questions:

  1. when I do
ar = Autoreject(n_interpolates=0)
ar.fit(epochs)
_, reject_log = ar.transform(epochs, return_log=True)

and then inspect reject_log.bad_epochs, how are bad Epochs defined? Is it if there are enough electrodes that are considered bad? I couldn't find this in the FAQ, or explanation?

Is there a way to modify that threshold? Thanks!

  1. Is there a way to re-load in the autoreject object after doing ar.save(fname)?

@jasmainak
Copy link
Member

  1. It should be determined by ar.consensus_ that basically says what fraction of channels need to be bad for the epoch to be considered bad. You can just do Autoreject(n_interpolates=0, consensus=0.8) or something like that to modify the threshold

  2. You should use the function read_auto_reject

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants