-
Notifications
You must be signed in to change notification settings - Fork 68
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
Add "autoreject_local"
as new option for preprocessing/ptp_reject
#807
Conversation
This comment has been minimized.
This comment has been minimized.
Thanks @larsoner |
This comment has been minimized.
This comment has been minimized.
@larsoner I believe the CI error may have to do with mne-tools/mne-python#12156 |
This comment was marked as outdated.
This comment was marked as outdated.
Tries to fix CI error we get for mne-bids-pipeline: mne-tools/mne-bids-pipeline#807 (comment) This is a followup-fix for mne-tools#12156
a500beb
to
135c7df
Compare
if cfg.reject == "autoreject_local": | ||
import numpy as np | ||
import autoreject | ||
|
||
msg = "Using autoreject to find and repair bad epochs" | ||
logger.info(**gen_log_kwargs(message=msg)) | ||
|
||
ar = autoreject.AutoReject( | ||
n_interpolate=np.array(cfg.autoreject_n_interpolate), | ||
random_state=cfg.random_state, | ||
n_jobs=exec_params.n_jobs, | ||
verbose=False, | ||
) | ||
n_epochs_before_reject = len(epochs) | ||
epochs, reject_log = ar.fit_transform(epochs, return_log=True) | ||
n_epochs_after_reject = len(epochs) | ||
assert ( | ||
n_epochs_before_reject - n_epochs_after_reject | ||
== reject_log.bad_epochs.sum() | ||
) | ||
|
||
msg = ( | ||
f"autoreject marked {reject_log.bad_epochs.sum()} epochs as bad " | ||
f"(cross-validated n_interpolate limit: {ar.n_interpolate_})" | ||
) | ||
logger.info(**gen_log_kwargs(message=msg)) | ||
else: | ||
reject = _get_reject( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The diff doesn't look nice here, but I basically just added this new if
block and moved the previous code into the else
section
Output looks like this now: I just restarted CI to take advantage of mne-tools/mne-python#12167 |
We're green! |
Co-authored-by: Eric Larson <larson.eric.d@gmail.com>
…nto autoreject-local
@larsoner I've addressed your comments |
Before merging …
docs/source/changes.md
)closes #410
cc @dengemann