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

BUG: Fix bug with regress_artifact picking #12389

Merged
merged 6 commits into from
Jan 26, 2024
Merged

Conversation

larsoner
Copy link
Member

  1. Make EOGRegression check for projections only applicable to the channels being processed. So if you want to regress MEG sensors using a reference channel for example, it shouldn't matter whether or not there is an average EEG reference projector.
  2. As part of (1), make pick_info remove any projectors that are no longer relevant to the data. So if you start with M/EEG data and remove all EEG channels, you should no longer have an EEG reference projector in info. I went back and forth on this one a bit but I think this is the most reasonable behavior.

@larsoner larsoner added this to the 1.7 milestone Jan 25, 2024
@larsoner
Copy link
Member Author

... and I realized I could greatly simplify some stuff and make the dataset dual-use for mne-tools/mne-bids-pipeline#837 by BIDSifying it, so those changes are in here, too.

Copy link
Member

@drammock drammock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM other than my 2 comments.

@@ -687,6 +688,15 @@ def pick_info(info, sel=(), copy=True, verbose=None):
if info.get("custom_ref_applied", False) and not _electrode_types(info):
with info._unlock():
info["custom_ref_applied"] = FIFF.FIFFV_MNE_CUSTOM_REF_OFF
# remove unused projectors
if info.get("projs", []):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I stumbled over this line, because seeing the [] in foo.get("bar", []) made me expect that the result was being assigned or iterated over. Here we're only (effectively) passing it to bool() for the duration of this one line; so I think it's clearer to default to False rather than a (falsey) empty list.

Suggested change
if info.get("projs", []):
if info.get("projs", False):

Comment on lines 67 to 68
# Now we can figure out our epoching parameters and epoch the data, sanity checking
# some values along the way knowing how the stimulation was done.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like this text may need to be updated? Looks like the "sanity checking" is all deleted now

@larsoner larsoner enabled auto-merge (squash) January 26, 2024 19:49
@larsoner
Copy link
Member Author

Done, marking for merge when green, thanks for the quick look @drammock !

@larsoner larsoner merged commit 4ccd30f into mne-tools:main Jan 26, 2024
29 checks passed
@larsoner larsoner deleted the regress branch January 26, 2024 20:39
snwnde pushed a commit to snwnde/mne-python that referenced this pull request Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants