Skip to content

Commit

Permalink
BUG: Fix bug with Maxwell step when find_noise_channels_meg=False (#847)
Browse files Browse the repository at this point in the history
  • Loading branch information
larsoner authored Feb 7, 2024
1 parent 92be603 commit fe56c01
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions docs/source/v1.6.md.inc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
- Fix bug where EEG `reject` params were not used for `ch_types = ["meg", "eeg"]` (#839 by @larsoner)
- Fix bug where implicit `mf_reference_run` could change across invocations of `mne_bids_pipeline`, breaking caching (#839 by @larsoner)
- Fix bug where `--no-cache` had no effect (#839 by @larsoner)
- Fix bug where the Maxwell filtering step would fail if [`find_noisy_channels_meg = False`][mne_bids_pipeline._config.find_noisy_channels_meg]` was used (#847 by @larsoner)
- Fix bug where raw, empty-room, and custom noise covariances were errantly calculated on data without ICA or SSP applied (#840 by @larsoner)
### :medical_symbol: Code health
Expand Down
3 changes: 2 additions & 1 deletion mne_bids_pipeline/_import_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -683,10 +683,11 @@ def _get_run_rest_noise_path(


def _get_mf_reference_run_path(
*,
cfg: SimpleNamespace,
subject: str,
session: Optional[str],
add_bads: bool,
add_bads: Optional[bool] = None,
) -> dict:
return _get_run_path(
cfg=cfg,
Expand Down
5 changes: 3 additions & 2 deletions mne_bids_pipeline/steps/preprocessing/_03_maxfilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def get_input_fnames_esss(
mf_reference_run=cfg.mf_reference_run,
**kwargs,
)
in_files.update(_get_mf_reference_run_path(add_bads=True, **kwargs))
in_files.update(_get_mf_reference_run_path(**kwargs))
return in_files


Expand Down Expand Up @@ -241,7 +241,8 @@ def get_input_fnames_maxwell_filter(
)

# reference run (used for `destination` and also bad channels for noise)
in_files.update(_get_mf_reference_run_path(add_bads=True, **kwargs))
# use add_bads=None here to mean "add if autobad is turned on"
in_files.update(_get_mf_reference_run_path(**kwargs))

is_rest_noise = run is None and task in ("noise", "rest")
if is_rest_noise:
Expand Down
5 changes: 3 additions & 2 deletions mne_bids_pipeline/tests/configs/config_ds003392.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
subjects = ["01"]

task = "localizer"
find_flat_channels_meg = True
find_noisy_channels_meg = True
# usually a good idea to use True, but we know no bads are detected for this dataset
find_flat_channels_meg = False
find_noisy_channels_meg = False
use_maxwell_filter = True
ch_types = ["meg"]

Expand Down

0 comments on commit fe56c01

Please sign in to comment.