Add support for dictionary-type ref_channels in set_eeg_reference()#12366
Add support for dictionary-type ref_channels in set_eeg_reference()#12366larsoner merged 72 commits intomne-tools:mainfrom
ref_channels in set_eeg_reference()#12366Conversation
|
@AlexLepauvre I've come up with a short to-do list of things we may need to change to complete the PR. Feel free to modify it! My initial commit only changed the doc and slightly changed |
The current implementation is based on a dictionary mapping a list to each channel. The list contains the channels to average and take as reference for the respective channel. I have also implemented an assertion to make sure that the channels in the dict correspond to the channels in the instance. We might want to implement something about bad channels. If bad channels are present in the mapping, they should probably be skipped
for more information, see https://pre-commit.ci
|
Do you think we need a formal test for the addition (in test_reference)? |
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
|
@drammock When you have time would you mind re-reviewing? Thanks! |
|
@drammock @hoechenberger @larsoner @cbrnr Hi developers, how would you like us to proceed with this PR? Thanks! |
|
Sorry for the slow response, I should be able to look in the coming days! |
mne/_fiff/reference.py
Outdated
| inst._projector, _ = setup_proj(inst.info, add_eeg_ref=False, activate=False) | ||
|
|
||
|
|
||
| def _check_before_reference(inst, ref_from, ref_to, ch_type): |
There was a problem hiding this comment.
Can you move this back up? Moving it below _check_ssp will mess up git blame without any tangible benefit AFAICT?
|
@larsoner Thanks! Glad to see this feature implemented :D |
|
Seems Ubuntu pip test is having some difficulty configuring its dependency. Hope it's irrelevant to the PR |
|
Yes should be okay so I restarted the test -- I'll keep and eye on it! |
|
Thanks @qian-chu ! |
* upstream/main: Add support for dictionary-type `ref_channels` in `set_eeg_reference()` (mne-tools#12366) [MRG] Remove impedances in ant reader in favor of an example using antio (mne-tools#12868) [pre-commit.ci] pre-commit autoupdate (mne-tools#12869)
Implement #12283
To do list:
docdict["ref_channels_set_eeg_reference"]inmne/utils/docs.pyto includedictset_eeg_reference()to implementdictbased re-referencing_check_before_referenceor create new_check_before_dict_reference_apply_reference()or create new_apply_dict_reference()