-
Notifications
You must be signed in to change notification settings - Fork 70
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
WIP: ICA clean raw data #296
Changes from all commits
f146494
80a2cb4
b4eed0d
5cc2c15
e7ff1f5
2f08f07
af1c120
8bf7eea
59907cb
abf6d05
1c70e09
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,15 +105,28 @@ def make_epochs_for_ica(raw, subject, session): | |
root=config.deriv_root, | ||
check=False) | ||
epochs = mne.read_epochs(epochs_fname) | ||
selection = epochs.selection | ||
|
||
# Should be factorized as it is the same as in 03-make_epochs.py:64, | ||
# but not obvious how | ||
if config.no_epoching: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The base code recreates an epoch object, but I don't understand why. Here I just reuse the epochs created last step, not sure if that's okay There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Because we filter the raw data again with a high-pass filter suitable for ICA. We then create new epochs from the newly-filtered data. You'd have to do the same for the "no epoching" case There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I completely missed that, thanks |
||
stop = raw.times[-1] - config.fixed_length_epochs_duration | ||
events = mne.make_fixed_length_events( | ||
raw, id=3000, start=0, | ||
duration=config.fixed_length_epochs_duration, | ||
overlap=config.fixed_length_epochs_overlap, | ||
stop=stop) | ||
event_id = dict(rest=3000) | ||
else: | ||
events, event_id = mne.events_from_annotations(raw) | ||
|
||
# Now, create new epochs, and only keep the ones we kept in step 3. | ||
# Because some events present in event_id may disappear entirely from the | ||
# data, we pass `on_missing='ignore'` to mne.Epochs. Also note that we do | ||
# not pass the `reject` parameter here. | ||
|
||
events, event_id = mne.events_from_annotations(raw) | ||
selection = epochs.selection | ||
events = events[selection] | ||
|
||
epochs_ica = mne.Epochs(raw, events=events, event_id=event_id, | ||
tmin=epochs.tmin, tmax=epochs.tmax, | ||
baseline=None, | ||
|
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.
Changed because it did not work with file names such as
recon_all.py
or04a-run_ica.py