Skip to content

Commit

Permalink
BUG: Fix bug with mf_reference_run
Browse files Browse the repository at this point in the history
  • Loading branch information
larsoner committed Jun 15, 2023
1 parent b74f056 commit 67bf6eb
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 8 deletions.
2 changes: 2 additions & 0 deletions docs/source/changes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{% include-markdown "./v1.4.md.inc" %}

{% include-markdown "./v1.3.md.inc" %}

{% include-markdown "./v1.2.md.inc" %}
Expand Down
4 changes: 2 additions & 2 deletions docs/source/v1.3.md.inc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## v1.3.0 (unreleased)
## v1.3.0 (released 2023/06/01)

### :new: New features & enhancements

Expand All @@ -15,7 +15,7 @@

- Avoid using deprecated `openpyxl` API when working with Excel spreadsheets (#735 by @larsoner)

### :bug: Bug fixes)
### :bug: Bug fixes

- Fix pandas 2.0 compatibility (#732 by @larsoner)
- Fix bug with `mne.sys_info` insertion in reports (#732 by @larsoner)
Expand Down
17 changes: 17 additions & 0 deletions docs/source/v1.4.md.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## v1.4.0 (unreleased)

[//]: # (### :new: New features & enhancements)

[//]: # (- Whatever (#000 by @whoever))

[//]: # (### :warning: Behavior changes)

[//]: # (- Whatever (#000 by @whoever))

[//]: # (### :medical_symbol: Code health)

[//]: # (- Whatever (#000 by @whoever))

### :bug: Bug fixes

- Fix bug when `mf_reference_run != runs[0]` (#742 by @larsoner)
14 changes: 11 additions & 3 deletions mne_bids_pipeline/_import_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,9 +561,17 @@ def _get_raw_paths(
if task == "rest":
raw_fname = bids_path_in.copy().update(run=None, task=task)
else:
raw_fname = _read_json(_empty_room_match_path(bids_path_in, cfg))[
"fname"
]
# This must match the logic of _02_find_empty_room.py
update_kwargs = dict()
if cfg.use_maxwell_filter:
update_kwargs["run"] = cfg.mf_reference_run
raw_fname = _read_json(
_empty_room_match_path(
bids_path_in.copy().update(**update_kwargs),
cfg,
)
)
raw_fname = raw_fname["fname"]
if raw_fname is not None:
raw_fname = get_bids_path_from_fname(raw_fname)
if raw_fname is None:
Expand Down
1 change: 1 addition & 0 deletions mne_bids_pipeline/steps/preprocessing/_01_data_quality.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ def get_config(
)
extra_kwargs["mf_reference_run"] = get_mf_reference_run(config=config)
extra_kwargs["mf_head_origin"] = config.mf_head_origin
extra_kwargs["use_maxwell_filter"] = config.use_maxwell_filter
cfg = SimpleNamespace(
process_empty_room=config.process_empty_room,
process_rest=config.process_rest,
Expand Down
6 changes: 3 additions & 3 deletions mne_bids_pipeline/tests/configs/config_ds000117.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
raw_resample_sfreq = 125.0
crop_runs = (0, 300) # Reduce memory usage on CI system

find_flat_channels_meg = False
find_noisy_channels_meg = False
find_flat_channels_meg = True
find_noisy_channels_meg = True
use_maxwell_filter = True

mf_reference_run = "01"
mf_reference_run = "02"
mf_cal_fname = bids_root + "/derivatives/meg_derivatives/sss_cal.dat"
mf_ctc_fname = bids_root + "/derivatives/meg_derivatives/ct_sparse.fif"

Expand Down

0 comments on commit 67bf6eb

Please sign in to comment.