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

MAINT: Split bad-finding step #666

Merged
merged 7 commits into from
Nov 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/source/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@ authors:
- Make report generation happen within relevant steps instead of at the end
of all steps
({{ gh(652) }} by {{ authors.larsoner }})
- Initial raw data plots are now added to reports and bad channel detection
is executed in a dedicated step
({{ gh(666) }} by {{ authors.larsoner }})

### Behavior changes

Expand Down
5 changes: 3 additions & 2 deletions mne_bids_pipeline/_config_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def _import_config(
overrides=overrides,
log=log,
)

# Check it
if check:
_check_config(config)
Expand All @@ -59,9 +60,9 @@ def _import_config(
# Caching
'memory_location', 'memory_verbose', 'memory_file_method',
# Misc
'deriv_root',
'deriv_root', 'config_path',
)
in_both = {'deriv_root', 'interactive'}
in_both = {'deriv_root'}
exec_params = SimpleNamespace(**{k: getattr(config, k) for k in keys})
for k in keys:
if k not in in_both:
Expand Down
7 changes: 4 additions & 3 deletions mne_bids_pipeline/_config_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,9 @@ def get_channels_to_analyze(
# Return names of the channels of the channel types we wish to analyze.
# We also include channels marked as "bad" here.
# `exclude=[]`: keep "bad" channels, too.
kwargs = dict(eog=True, ecg=True, exclude=())
if get_datatype(config) == 'meg' and _meg_in_ch_types(config.ch_types):
pick_idx = mne.pick_types(info, eog=True, ecg=True, exclude=[])
pick_idx = mne.pick_types(info, **kwargs)

if 'mag' in config.ch_types:
pick_idx = np.concatenate(
Expand All @@ -270,8 +271,8 @@ def get_channels_to_analyze(
pick_idx = np.concatenate(
[pick_idx, mne.pick_types(info, meg='grad', exclude=[])])
if 'meg' in config.ch_types:
pick_idx = mne.pick_types(info, meg=True, eog=True, ecg=True,
exclude=[])
pick_idx = mne.pick_types(info, meg=True, exclude=[])
pick_idx.sort()
elif config.ch_types == ['eeg']:
pick_idx = mne.pick_types(info, meg=False, eeg=True, eog=True,
ecg=True, exclude=[])
Expand Down
Loading