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

FIX: Use "recording" for recording entity, not "rec" #1359

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions doc/whats_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Detailed list of changes
^^^^^^^^^^^^

- :func:`mne_bids.read_raw_bids` can optionally return an ``event_id`` dictionary suitable for use with :func:`mne.events_from_annotations`, and if a ``values`` column is present in ``events.tsv`` it will be used as the source of the integer event ID codes, by `Daniel McCloy`_ (:gh:`1349`)
- BIDS dictates that the recording entity should be displayed as "_recording-" in the filename. This PR makes :class:`mne_bids.BIDSPath` correctly display "_recording-" (instead of "_rec-") in BIDSPath.fpath. By `Scott Huberty`_ (:gh:`1348`)

⚕️ Code health
^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion mne_bids/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@
"run": "run",
"proc": "processing",
"space": "space",
"rec": "recording",
"recording": "recording",
"split": "split",
"desc": "description",
}
Expand Down
8 changes: 6 additions & 2 deletions mne_bids/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -2088,7 +2088,7 @@ def get_entity_vals(
):
continue
if ignore_recordings and any(
[f"_rec-{a}_" in filename.stem for a in ignore_recordings]
[f"_recording-{a}_" in filename.stem for a in ignore_recordings]
):
continue
if ignore_splits and any(
Expand Down Expand Up @@ -2280,7 +2280,11 @@ def _filter_fnames(
r"_proc-(" + "|".join(processing) + ")" if processing else r"(|_proc-([^_]+))"
)
space_str = r"_space-(" + "|".join(space) + ")" if space else r"(|_space-([^_]+))"
rec_str = r"_rec-(" + "|".join(recording) + ")" if recording else r"(|_rec-([^_]+))"
rec_str = (
r"_recording-(" + "|".join(recording) + ")"
if recording
else r"(|_recording-([^_]+))"
)
split_str = r"_split-(" + "|".join(split) + ")" if split else r"(|_split-([^_]+))"
desc_str = (
r"_desc-(" + "|".join(description) + ")" if description else r"(|_desc-([^_]+))"
Expand Down
4 changes: 2 additions & 2 deletions mne_bids/tests/test_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ def test_make_filenames():
datatype="ieeg",
)
expected_str = (
"sub-one_ses-two_task-three_acq-four_run-1_proc-six_rec-seven_ieeg.json"
"sub-one_ses-two_task-three_acq-four_run-1_proc-six_recording-seven_ieeg.json"
)
assert BIDSPath(**prefix_data).basename == expected_str
assert (
Expand Down Expand Up @@ -896,7 +896,7 @@ def test_make_filenames():
basename = BIDSPath(**prefix_data, check=False)
assert (
basename.basename
== "sub-one_ses-two_task-three_acq-four_run-1_proc-six_rec-seven_ieeg.h5"
== "sub-one_ses-two_task-three_acq-four_run-1_proc-six_recording-seven_ieeg.h5"
)

# what happens with scans.tsv file
Expand Down
Loading