From 583265444d5c0fe047b6bdfcf0b803736b055f41 Mon Sep 17 00:00:00 2001 From: Julius Welzel Date: Mon, 27 May 2024 13:11:54 +0200 Subject: [PATCH 01/28] [ADD] describing fields in `event.json` file for the REQUIRED onset and duration columns --- mne_bids/write.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/mne_bids/write.py b/mne_bids/write.py index eb989dc2df..c3a1b301fe 100644 --- a/mne_bids/write.py +++ b/mne_bids/write.py @@ -338,7 +338,30 @@ def _events_json(fname, overwrite=False): Whether to overwrite the output file if it exists. """ new_data = { - "sample": {"Description": "The event onset time in number of sampling points."}, + "onset": { + "Requirement Level": "REQUIRED", + "Data type": "number", + "Description": ( + "Onset (in seconds) of the event from the beginning of the first data point. " + "Negative onsets account for events before the first stored data point. " + "This column must appear first in the file." + ) + }, + "duration": { + "Requirement Level": "REQUIRED", + "Data type": "number or 'n/a'", + "Description": ( + "Duration of the event in seconds from onset. Must be zero, positive, or 'n/a' if unavailable. " + "A zero value indicates an impulse event.\n" + "This column must appear second in the file." + ) + }, + "sample": { + "Data type": "number", + "Description": ( + "The event onset time in number of sampling points." + ) + }, "value": { "Description": ( "The event code (also known as trigger code or event ID) " From 9860744f0e632ab933913972aec53d1c8072a023 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 27 May 2024 11:14:53 +0000 Subject: [PATCH 02/28] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- mne_bids/write.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/mne_bids/write.py b/mne_bids/write.py index c3a1b301fe..2dce0e5edd 100644 --- a/mne_bids/write.py +++ b/mne_bids/write.py @@ -345,7 +345,7 @@ def _events_json(fname, overwrite=False): "Onset (in seconds) of the event from the beginning of the first data point. " "Negative onsets account for events before the first stored data point. " "This column must appear first in the file." - ) + ), }, "duration": { "Requirement Level": "REQUIRED", @@ -354,13 +354,11 @@ def _events_json(fname, overwrite=False): "Duration of the event in seconds from onset. Must be zero, positive, or 'n/a' if unavailable. " "A zero value indicates an impulse event.\n" "This column must appear second in the file." - ) + ), }, "sample": { "Data type": "number", - "Description": ( - "The event onset time in number of sampling points." - ) + "Description": ("The event onset time in number of sampling points."), }, "value": { "Description": ( From b1ef7fe079980f9dd009a69f1bbb743d36408666 Mon Sep 17 00:00:00 2001 From: Julius Welzel Date: Mon, 27 May 2024 13:20:12 +0200 Subject: [PATCH 03/28] fix line length <88 --- mne_bids/write.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/mne_bids/write.py b/mne_bids/write.py index 2dce0e5edd..99416534dd 100644 --- a/mne_bids/write.py +++ b/mne_bids/write.py @@ -342,19 +342,20 @@ def _events_json(fname, overwrite=False): "Requirement Level": "REQUIRED", "Data type": "number", "Description": ( - "Onset (in seconds) of the event from the beginning of the first data point. " - "Negative onsets account for events before the first stored data point. " - "This column must appear first in the file." - ), + "Onset (in seconds) of the event from the beginning of the first data " + "point. Negative onsets account for events before the first stored " + "data point. This column must appear first in the file." + ) }, "duration": { "Requirement Level": "REQUIRED", "Data type": "number or 'n/a'", "Description": ( - "Duration of the event in seconds from onset. Must be zero, positive, or 'n/a' if unavailable. " - "A zero value indicates an impulse event.\n" + "Duration of the event in seconds from onset. " + "Must be zero, positive, or 'n/a' if unavailable. " + "A zero value indicates an impulse event. " "This column must appear second in the file." - ), + ) }, "sample": { "Data type": "number", From 208885b7eb053aacba9800f29ca71c40a984d2fb Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 27 May 2024 11:20:21 +0000 Subject: [PATCH 04/28] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- mne_bids/write.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mne_bids/write.py b/mne_bids/write.py index 99416534dd..644af22387 100644 --- a/mne_bids/write.py +++ b/mne_bids/write.py @@ -345,7 +345,7 @@ def _events_json(fname, overwrite=False): "Onset (in seconds) of the event from the beginning of the first data " "point. Negative onsets account for events before the first stored " "data point. This column must appear first in the file." - ) + ), }, "duration": { "Requirement Level": "REQUIRED", @@ -355,7 +355,7 @@ def _events_json(fname, overwrite=False): "Must be zero, positive, or 'n/a' if unavailable. " "A zero value indicates an impulse event. " "This column must appear second in the file." - ) + ), }, "sample": { "Data type": "number", From 8895caff522d055ae25d2fcf55b833eccb2eda85 Mon Sep 17 00:00:00 2001 From: Julius Welzel Date: Mon, 27 May 2024 13:24:17 +0200 Subject: [PATCH 05/28] remove column position from description --- mne_bids/write.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mne_bids/write.py b/mne_bids/write.py index 644af22387..11d101c52c 100644 --- a/mne_bids/write.py +++ b/mne_bids/write.py @@ -342,9 +342,9 @@ def _events_json(fname, overwrite=False): "Requirement Level": "REQUIRED", "Data type": "number", "Description": ( - "Onset (in seconds) of the event from the beginning of the first data " + "Onset (in seconds) of the event from the beginning of the first data" "point. Negative onsets account for events before the first stored " - "data point. This column must appear first in the file." + "data point." ), }, "duration": { @@ -354,7 +354,6 @@ def _events_json(fname, overwrite=False): "Duration of the event in seconds from onset. " "Must be zero, positive, or 'n/a' if unavailable. " "A zero value indicates an impulse event. " - "This column must appear second in the file." ), }, "sample": { From 61030eb25387fe06a9c7c22dbcdd5d8f7454991f Mon Sep 17 00:00:00 2001 From: Julius Welzel Date: Tue, 28 May 2024 17:12:04 +0200 Subject: [PATCH 06/28] only provide description and onset for the json --- mne_bids/write.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/mne_bids/write.py b/mne_bids/write.py index 11d101c52c..ca0b2ee054 100644 --- a/mne_bids/write.py +++ b/mne_bids/write.py @@ -339,25 +339,22 @@ def _events_json(fname, overwrite=False): """ new_data = { "onset": { - "Requirement Level": "REQUIRED", - "Data type": "number", "Description": ( "Onset (in seconds) of the event from the beginning of the first data" "point. Negative onsets account for events before the first stored " "data point." ), + "Units": "s", }, "duration": { - "Requirement Level": "REQUIRED", - "Data type": "number or 'n/a'", "Description": ( "Duration of the event in seconds from onset. " "Must be zero, positive, or 'n/a' if unavailable. " "A zero value indicates an impulse event. " ), + "Units": "s", }, "sample": { - "Data type": "number", "Description": ("The event onset time in number of sampling points."), }, "value": { From 3e31c6bc62f0bf5ec1678c52ca772a40607f56ea Mon Sep 17 00:00:00 2001 From: Julius Welzel Date: Tue, 28 May 2024 17:20:19 +0200 Subject: [PATCH 07/28] refine description of sample --- mne_bids/write.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mne_bids/write.py b/mne_bids/write.py index ca0b2ee054..1b29444e9e 100644 --- a/mne_bids/write.py +++ b/mne_bids/write.py @@ -355,7 +355,8 @@ def _events_json(fname, overwrite=False): "Units": "s", }, "sample": { - "Description": ("The event onset time in number of sampling points."), + "Description": ("The event onset time in number of sampling points." + "First sample is 0."), }, "value": { "Description": ( From 6ade344746ab35eae21280db081bc62bde311ae9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 28 May 2024 15:22:53 +0000 Subject: [PATCH 08/28] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- mne_bids/write.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mne_bids/write.py b/mne_bids/write.py index 1b29444e9e..be0a15012c 100644 --- a/mne_bids/write.py +++ b/mne_bids/write.py @@ -355,8 +355,10 @@ def _events_json(fname, overwrite=False): "Units": "s", }, "sample": { - "Description": ("The event onset time in number of sampling points." - "First sample is 0."), + "Description": ( + "The event onset time in number of sampling points." + "First sample is 0." + ), }, "value": { "Description": ( From 64ec71ad5a4b5f9df7afcd608b803212595d4a7a Mon Sep 17 00:00:00 2001 From: Julius Welzel Date: Tue, 28 May 2024 17:30:29 +0200 Subject: [PATCH 09/28] satisfy contributing guidelines --- CITATION.cff | 4 ++++ doc/authors.rst | 1 + doc/whats_new.rst | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CITATION.cff b/CITATION.cff index f17d661fd7..47ab7cc0d4 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -264,6 +264,10 @@ preferred-citation: family-names: Rockhill affiliation: 'University of Oregon, Eugene OR, USA' orcid: 'https://orcid.org/0000-0003-3868-7453' + - given-names: Julius + family-names: Welzel + affiliation: 'Department of Neurology, Kiel University, Germany' + orcid: 'https://orcid.org/0000-0003-4782-5360' - given-names: Eric family-names: Larson affiliation: 'Institute for Learning and Brain Sciences, University of Washington, Seattle, WA, USA' diff --git a/doc/authors.rst b/doc/authors.rst index efad72dbf5..f91fe31399 100644 --- a/doc/authors.rst +++ b/doc/authors.rst @@ -45,3 +45,4 @@ .. _Ford McDonald: https://github.com/fordmcdonald .. _Pierre Guetschel: https://github.com/PierreGtch .. _Mara Wolter: https://github.com/marakw +.. _Julius Welzel: https://github.com/JuliusWelzel \ No newline at end of file diff --git a/doc/whats_new.rst b/doc/whats_new.rst index 66eea1fc80..894fc95f6c 100644 --- a/doc/whats_new.rst +++ b/doc/whats_new.rst @@ -19,6 +19,7 @@ The following authors contributed for the first time. Thank you so much! 🤩 * `Daniel McCloy`_ * `Mara Wolter`_ +* `Julius Welzel`_ The following authors had contributed before. Thank you for sticking around! 🤘 @@ -34,7 +35,7 @@ Detailed list of changes 🚀 Enhancements ^^^^^^^^^^^^^^^ -- nothing yet +- Including a description for ``onset`` and ``duration`` in the ``events.json`` file, by `Julius Welzel`_ (:gh:`1255`) 🧐 API and behavior changes ^^^^^^^^^^^^^^^^^^^^^^^^^^^ From 37faafccf613b9b26877e4921a04444c7961acb2 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 28 May 2024 15:30:58 +0000 Subject: [PATCH 10/28] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- doc/authors.rst | 2 +- doc/whats_new.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/authors.rst b/doc/authors.rst index f91fe31399..a1d5bbe6e5 100644 --- a/doc/authors.rst +++ b/doc/authors.rst @@ -45,4 +45,4 @@ .. _Ford McDonald: https://github.com/fordmcdonald .. _Pierre Guetschel: https://github.com/PierreGtch .. _Mara Wolter: https://github.com/marakw -.. _Julius Welzel: https://github.com/JuliusWelzel \ No newline at end of file +.. _Julius Welzel: https://github.com/JuliusWelzel diff --git a/doc/whats_new.rst b/doc/whats_new.rst index 894fc95f6c..317860aadc 100644 --- a/doc/whats_new.rst +++ b/doc/whats_new.rst @@ -19,7 +19,7 @@ The following authors contributed for the first time. Thank you so much! 🤩 * `Daniel McCloy`_ * `Mara Wolter`_ -* `Julius Welzel`_ +* `Julius Welzel`_ The following authors had contributed before. Thank you for sticking around! 🤘 From 3a37466eaea68f7d179c600ac75aa4a7c4f7b1b8 Mon Sep 17 00:00:00 2001 From: Julius Welzel Date: Tue, 28 May 2024 17:56:31 +0200 Subject: [PATCH 11/28] move author to correct position in CITATION.cff --- CITATION.cff | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CITATION.cff b/CITATION.cff index 47ab7cc0d4..8da27d6362 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -175,6 +175,10 @@ authors: family-names: Wolter orcid: 'https://orcid.org/0000-0002-6785-9886' affiliation: 'Centre for Integrative Neuroscience, Tübingen, Germany' + - given-names: Julius + family-names: Welzel + affiliation: 'Department of Neurology, Kiel University, Germany' + orcid: 'https://orcid.org/0000-0003-4782-5360' - given-names: Alexandre family-names: Gramfort affiliation: 'Université Paris-Saclay, Inria, CEA, Palaiseau, France' @@ -264,10 +268,6 @@ preferred-citation: family-names: Rockhill affiliation: 'University of Oregon, Eugene OR, USA' orcid: 'https://orcid.org/0000-0003-3868-7453' - - given-names: Julius - family-names: Welzel - affiliation: 'Department of Neurology, Kiel University, Germany' - orcid: 'https://orcid.org/0000-0003-4782-5360' - given-names: Eric family-names: Larson affiliation: 'Institute for Learning and Brain Sciences, University of Washington, Seattle, WA, USA' From a693a4ed318b93eb303cb8ec0688e9a9540bf062 Mon Sep 17 00:00:00 2001 From: jwelzel <52565341+JuliusWelzel@users.noreply.github.com> Date: Mon, 25 Aug 2025 09:06:39 +0200 Subject: [PATCH 12/28] [ADD] adapt the config file to include motion data type --- README.md | 1 + mne_bids/config.py | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a71df0c1b0..cb8144442f 100644 --- a/README.md +++ b/README.md @@ -58,3 +58,4 @@ Please also cite one of the following papers to credit BIDS, depending on which - [EEG-BIDS](https://doi.org/10.1038/s41597-019-0104-8) - [iEEG-BIDS](https://doi.org/10.1038/s41597-019-0105-7) - [NIRS-BIDS](https://doi.org/10.31219/osf.io/7nmcp) +- [Motion-BIDS](https://doi.org/10.1038/s41597-024-03559-8) diff --git a/mne_bids/config.py b/mne_bids/config.py index 5888f3f11c..3c267c89fa 100644 --- a/mne_bids/config.py +++ b/mne_bids/config.py @@ -6,7 +6,7 @@ from mne import io from mne.io.constants import FIFF -BIDS_VERSION = "1.7.0" +BIDS_VERSION = "1.9.0" PYBV_VERSION = "0.7.3" EEGLABIO_VERSION = "0.0.2" @@ -15,17 +15,19 @@ EPHY_ALLOWED_DATATYPES = ["meg", "eeg", "ieeg", "nirs"] -ALLOWED_DATATYPES = EPHY_ALLOWED_DATATYPES + ["anat", "beh"] +ALLOWED_DATATYPES = EPHY_ALLOWED_DATATYPES + ["anat", "beh", "motion"] MEG_CONVERT_FORMATS = ["FIF", "auto"] EEG_CONVERT_FORMATS = ["BrainVision", "auto"] IEEG_CONVERT_FORMATS = ["BrainVision", "auto"] NIRS_CONVERT_FORMATS = ["auto"] +MOTION_CONVERT_FORMATS = ["tsv", "auto"] CONVERT_FORMATS = { "meg": MEG_CONVERT_FORMATS, "eeg": EEG_CONVERT_FORMATS, "ieeg": IEEG_CONVERT_FORMATS, "nirs": NIRS_CONVERT_FORMATS, + "motion": MOTION_CONVERT_FORMATS, } # Orientation of the coordinate system dependent on manufacturer @@ -147,12 +149,17 @@ ".snirf", # SNIRF ] +allowed_extensions_motion = [ + ".tsv", # Tab-separated values +] + # allowed extensions (data formats) in BIDS spec ALLOWED_DATATYPE_EXTENSIONS = { "meg": allowed_extensions_meg, "eeg": allowed_extensions_eeg, "ieeg": allowed_extensions_ieeg, "nirs": allowed_extensions_nirs, + "motion": allowed_extensions_motion, } # allow additional extensions that are not BIDS @@ -190,6 +197,7 @@ "physio", "stim", # behavioral "nirs", + "motion", # motion ] # converts suffix to known path modalities @@ -227,6 +235,7 @@ "description", "suffix", "extension", + "tracking-system", ) ALLOWED_PATH_ENTITIES_SHORT = { "sub": "subject", @@ -239,6 +248,7 @@ "recording": "recording", "split": "split", "desc": "description", + "track-sys": "tracking_system", } # Annotations to never remove during reading or writing @@ -316,6 +326,7 @@ ALLOWED_SPACES["ieeg"] = BIDS_SHARED_COORDINATE_FRAMES + BIDS_IEEG_COORDINATE_FRAMES ALLOWED_SPACES["anat"] = None ALLOWED_SPACES["beh"] = None +ALLOWED_SPACES["motion"] = None # See: https://bids-specification.readthedocs.io/en/latest/appendices/entity-table.html#encephalography-eeg-ieeg-and-meg # noqa: E501 ENTITY_VALUE_TYPE = { From 31fe43c43ceba4b3236f1e6014bc6a98f272d16d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 25 Aug 2025 07:14:06 +0000 Subject: [PATCH 13/28] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- mne_bids/write.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mne_bids/write.py b/mne_bids/write.py index a38ee89446..add369d6c1 100644 --- a/mne_bids/write.py +++ b/mne_bids/write.py @@ -368,8 +368,7 @@ def _events_json(fname, extra_columns=None, has_trial_type=True, overwrite=False }, "sample": { "Description": ( - "The event onset time in number of sampling points." - "First sample is 0." + "The event onset time in number of sampling points.First sample is 0." ), }, "value": { From 5780de7f34e51b514922dd173c234e6e851997ca Mon Sep 17 00:00:00 2001 From: jwelzel <52565341+JuliusWelzel@users.noreply.github.com> Date: Tue, 26 Aug 2025 08:32:42 +0200 Subject: [PATCH 14/28] [ADD] include tracking_system in ENTITY_VALUE_TYPE and BIDSPath class --- mne_bids/config.py | 1 + mne_bids/path.py | 1 + 2 files changed, 2 insertions(+) diff --git a/mne_bids/config.py b/mne_bids/config.py index 3c267c89fa..0818c43ae1 100644 --- a/mne_bids/config.py +++ b/mne_bids/config.py @@ -342,6 +342,7 @@ "description": "label", "suffix": "label", "extension": "label", + "tracking_system": "label", } # mapping from supported BIDs coordinate frames -> MNE diff --git a/mne_bids/path.py b/mne_bids/path.py index 2d3d0088c5..92a0cdded2 100644 --- a/mne_bids/path.py +++ b/mne_bids/path.py @@ -385,6 +385,7 @@ def __init__( space=None, split=None, description=None, + tracking_system=None, root=None, suffix=None, extension=None, From 49b5c02d114852c3bfdbada8aa0cbfc152336a15 Mon Sep 17 00:00:00 2001 From: Daniel McCloy Date: Wed, 27 Aug 2025 10:45:57 -0500 Subject: [PATCH 15/28] fix tests --- mne_bids/path.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mne_bids/path.py b/mne_bids/path.py index 92a0cdded2..28d62cef87 100644 --- a/mne_bids/path.py +++ b/mne_bids/path.py @@ -882,7 +882,9 @@ def fpath(self): if self.suffix is None or self.suffix in ALLOWED_DATATYPES: # now only use valid datatype extension if self.extension is None: - valid_exts = sum(ALLOWED_DATATYPE_EXTENSIONS.values(), []) + valid_exts = ALLOWED_DATATYPE_EXTENSIONS.get( + self.datatype, sum(ALLOWED_DATATYPE_EXTENSIONS.values(), []) + ) else: valid_exts = [self.extension] matching_paths = [ From 2bcb5b283ae46cc5f78983ba82d07bb16966d572 Mon Sep 17 00:00:00 2001 From: jwelzel <52565341+JuliusWelzel@users.noreply.github.com> Date: Mon, 8 Sep 2025 08:42:40 +0200 Subject: [PATCH 16/28] [FIX] update spelling of 'tracking-system' in test_path.py with corresponding change in 'ALLOWED_PATH_ENTITIES_SHORT' --- mne_bids/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mne_bids/config.py b/mne_bids/config.py index 0818c43ae1..30a0139160 100644 --- a/mne_bids/config.py +++ b/mne_bids/config.py @@ -248,7 +248,7 @@ "recording": "recording", "split": "split", "desc": "description", - "track-sys": "tracking_system", + "tracksys": "tracking-system", } # Annotations to never remove during reading or writing From c5a18a15ba705c9d2db7d2e564a80467e2d2e0af Mon Sep 17 00:00:00 2001 From: jwelzel <52565341+JuliusWelzel@users.noreply.github.com> Date: Mon, 8 Sep 2025 08:42:55 +0200 Subject: [PATCH 17/28] [ADD] include 'tracking-system' in the list of valid entity values in test_get_entities_from_fname_errors --- mne_bids/tests/test_path.py | 1 + 1 file changed, 1 insertion(+) diff --git a/mne_bids/tests/test_path.py b/mne_bids/tests/test_path.py index 60434fdf41..0424e54978 100644 --- a/mne_bids/tests/test_path.py +++ b/mne_bids/tests/test_path.py @@ -537,6 +537,7 @@ def test_get_entities_from_fname_errors(fname): "recording", "split", "description", + "tracking-system" ] assert params["subject"] == "01" From 60e7661998cfb5d47b31f129e90fbab322184723 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 8 Sep 2025 06:45:27 +0000 Subject: [PATCH 18/28] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- mne_bids/tests/test_path.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mne_bids/tests/test_path.py b/mne_bids/tests/test_path.py index e0165884f5..7d62b581b5 100644 --- a/mne_bids/tests/test_path.py +++ b/mne_bids/tests/test_path.py @@ -537,7 +537,7 @@ def test_get_entities_from_fname_errors(fname): "recording", "split", "description", - "tracking-system" + "tracking-system", ] assert params["subject"] == "01" From 0373d1888011ee7fd22b6e4286ed19e7a1da1eee Mon Sep 17 00:00:00 2001 From: jwelzel <52565341+JuliusWelzel@users.noreply.github.com> Date: Mon, 8 Sep 2025 09:42:56 +0200 Subject: [PATCH 19/28] [FIX] correct spelling of 'tracking-system' to 'tracking_system' in ALLOWED_PATH_ENTITIES and ALLOWED_PATH_ENTITIES_SHORT --- mne_bids/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mne_bids/config.py b/mne_bids/config.py index 30a0139160..5e356bf218 100644 --- a/mne_bids/config.py +++ b/mne_bids/config.py @@ -235,7 +235,7 @@ "description", "suffix", "extension", - "tracking-system", + "tracking_system", ) ALLOWED_PATH_ENTITIES_SHORT = { "sub": "subject", @@ -248,7 +248,7 @@ "recording": "recording", "split": "split", "desc": "description", - "tracksys": "tracking-system", + "tracksys": "tracking_system", } # Annotations to never remove during reading or writing From c581f89d12644ce113772903eb319bd477f6151b Mon Sep 17 00:00:00 2001 From: jwelzel <52565341+JuliusWelzel@users.noreply.github.com> Date: Mon, 8 Sep 2025 09:48:51 +0200 Subject: [PATCH 20/28] [FIX] update entity name from 'tracking-system' to 'tracking_system' and add it to valid entities --- mne_bids/tests/test_path.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mne_bids/tests/test_path.py b/mne_bids/tests/test_path.py index 7d62b581b5..7f1feb70e3 100644 --- a/mne_bids/tests/test_path.py +++ b/mne_bids/tests/test_path.py @@ -500,6 +500,7 @@ def test_get_entities_from_fname(fname): "recording", "split", "description", + "tracking_system" ] @@ -537,7 +538,7 @@ def test_get_entities_from_fname_errors(fname): "recording", "split", "description", - "tracking-system", + "tracking_system", ] assert params["subject"] == "01" From 8f1ff0eb8a72d22e8d27d9524c0d9efeef24e552 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 8 Sep 2025 07:50:31 +0000 Subject: [PATCH 21/28] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- mne_bids/tests/test_path.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mne_bids/tests/test_path.py b/mne_bids/tests/test_path.py index 7f1feb70e3..effbb1644e 100644 --- a/mne_bids/tests/test_path.py +++ b/mne_bids/tests/test_path.py @@ -500,7 +500,7 @@ def test_get_entities_from_fname(fname): "recording", "split", "description", - "tracking_system" + "tracking_system", ] From b508ff44562dc5e717b93b441f86a930994ea7fc Mon Sep 17 00:00:00 2001 From: Julius Welzel Date: Sun, 28 Sep 2025 21:21:50 +0200 Subject: [PATCH 22/28] fix whats_new.rst --- doc/whats_new.rst | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/doc/whats_new.rst b/doc/whats_new.rst index bc4c6a7470..cc991e0ddd 100644 --- a/doc/whats_new.rst +++ b/doc/whats_new.rst @@ -19,19 +19,13 @@ Version 0.18 (unreleased) The following authors contributed for the first time. Thank you so much! 🤩 -* `Christian O'Reilly`_ -* `Berk Gerçek`_ -* `Arne Gottwald`_ -* `Matthias Dold`_ -* `Harrison Ritz`_ * `Julius Welzel`_ -* `Nathan Azrak`_ * `Alex Lopez Marquez`_ The following authors had contributed before. Thank you for sticking around! 🤘 -* TBD +* `Stefan Appelhoff`_ Detailed list of changes @@ -41,11 +35,12 @@ Detailed list of changes ^^^^^^^^^^^^^^^ - :func:`mne_bids.write_raw_bids()` has a new parameter `electrodes_tsv_task` which allows adding the `task` entity to the `electrodes.tsv` filepath, by `Alex Lopez Marquez`_ (:gh:`1424`) +- Extended the configuration to recognise `motion` as a valid BIDS datatype by `Julius Welzel`_ (:gh:`1430`) 🧐 API and behavior changes ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -- None yet +- `mne_bids.BIDSPath.__init__` now accepts an optional `tracking_system` argument by `Julius Welzel`_ (:gh:`1430`) 🛠 Requirements ^^^^^^^^^^^^^^^ From 14069fb7d14b86fc0fe415a254fd57ddab90d1e6 Mon Sep 17 00:00:00 2001 From: Julius Welzel Date: Sun, 28 Sep 2025 21:31:30 +0200 Subject: [PATCH 23/28] FIX: tracking_system update in BIDSPath class --- mne_bids/path.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mne_bids/path.py b/mne_bids/path.py index f8e667b8dc..4c2f59b073 100644 --- a/mne_bids/path.py +++ b/mne_bids/path.py @@ -422,6 +422,7 @@ def __init__( space=space, split=split, description=description, + tracking_system=tracking_system, root=root, datatype=datatype, suffix=suffix, @@ -443,6 +444,7 @@ def entities(self): "recording": self.recording, "split": self.split, "description": self.description, + "tracking_system": self.tracking_system, } @property @@ -576,6 +578,15 @@ def description(self) -> str | None: def description(self, value): self.update(description=value) + @property + def tracking_system(self) -> str | None: + """The tracking system entity.""" + return self._tracking_system + + @tracking_system.setter + def tracking_system(self, value): + self.update(tracking_system=value) + @property def suffix(self) -> str | None: """The filename suffix.""" From 35ab863d20ed0a0d843791b03878bca4a309ae76 Mon Sep 17 00:00:00 2001 From: Julius Welzel Date: Sun, 28 Sep 2025 21:33:39 +0200 Subject: [PATCH 24/28] FIX: correct path reference for BIDSPath initialization in whats_new.rst --- doc/whats_new.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/whats_new.rst b/doc/whats_new.rst index cc991e0ddd..7c1b944b5d 100644 --- a/doc/whats_new.rst +++ b/doc/whats_new.rst @@ -40,7 +40,7 @@ Detailed list of changes 🧐 API and behavior changes ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -- `mne_bids.BIDSPath.__init__` now accepts an optional `tracking_system` argument by `Julius Welzel`_ (:gh:`1430`) +- `mne_bids.path.BIDSPath.__init__` now accepts an optional `tracking_system` argument by `Julius Welzel`_ (:gh:`1430`) 🛠 Requirements ^^^^^^^^^^^^^^^ From 8849b2226a15bb1ca6cfafe2b750301068b485e2 Mon Sep 17 00:00:00 2001 From: Julius Welzel Date: Sun, 28 Sep 2025 21:49:37 +0200 Subject: [PATCH 25/28] FEAT: add tracking_system parameter to _filter_fnames function --- mne_bids/path.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mne_bids/path.py b/mne_bids/path.py index 4c2f59b073..0fffc53c8d 100644 --- a/mne_bids/path.py +++ b/mne_bids/path.py @@ -2339,6 +2339,7 @@ def _filter_fnames( description=None, suffix=None, extension=None, + tracking_system=None, ): """Filter a list of BIDS filenames / paths based on BIDS entity values. @@ -2365,6 +2366,7 @@ def _filter_fnames( description = _ensure_tuple(description) suffix = _ensure_tuple(suffix) extension = _ensure_tuple(extension) + tracking_system = _ensure_tuple(tracking_system) leading_path_str = r".*\/?" # nothing or something ending with a `/` sub_str = r"sub-(" + "|".join(subject) + ")" if subject else r"sub-([^_]+)" @@ -2389,6 +2391,9 @@ def _filter_fnames( ) suffix_str = r"_(" + "|".join(suffix) + ")" if suffix else r"_([^_]+)" ext_str = r"(" + "|".join(extension) + ")$" if extension else r"\.([^_]+)" + tracksys_str = ( + r"tracksys-(" + "|".join(tracking_system) + ")" if tracking_system else r"(|tracksys-([^_]+))" + ) regexp = ( leading_path_str @@ -2404,6 +2409,7 @@ def _filter_fnames( + desc_str + suffix_str + ext_str + + tracksys_str ) # Convert to str so we can apply the regexp ... From 712424292f9718b9a5d97e7f0263456f248f136e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 28 Sep 2025 19:49:40 +0000 Subject: [PATCH 26/28] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- mne_bids/path.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mne_bids/path.py b/mne_bids/path.py index 0fffc53c8d..f3329880fe 100644 --- a/mne_bids/path.py +++ b/mne_bids/path.py @@ -2392,7 +2392,9 @@ def _filter_fnames( suffix_str = r"_(" + "|".join(suffix) + ")" if suffix else r"_([^_]+)" ext_str = r"(" + "|".join(extension) + ")$" if extension else r"\.([^_]+)" tracksys_str = ( - r"tracksys-(" + "|".join(tracking_system) + ")" if tracking_system else r"(|tracksys-([^_]+))" + r"tracksys-(" + "|".join(tracking_system) + ")" + if tracking_system + else r"(|tracksys-([^_]+))" ) regexp = ( From 04bbe041e8a941f6e829f37d6340b7e160562911 Mon Sep 17 00:00:00 2001 From: Julius Welzel Date: Sun, 28 Sep 2025 22:09:10 +0200 Subject: [PATCH 27/28] fix whats_new.rst to ref BIDSPath --- doc/whats_new.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/whats_new.rst b/doc/whats_new.rst index 7c1b944b5d..f70b64cc0a 100644 --- a/doc/whats_new.rst +++ b/doc/whats_new.rst @@ -40,7 +40,7 @@ Detailed list of changes 🧐 API and behavior changes ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -- `mne_bids.path.BIDSPath.__init__` now accepts an optional `tracking_system` argument by `Julius Welzel`_ (:gh:`1430`) +- `tracksys` accepted as argument in :class:`mne_bids.path.BIDSPath()` by `Julius Welzel`_ (:gh:`1430`) 🛠 Requirements ^^^^^^^^^^^^^^^ From c235ca2d1be37e3fbc94d4a687552c0fa2a15e19 Mon Sep 17 00:00:00 2001 From: Julius Welzel Date: Sun, 28 Sep 2025 22:19:21 +0200 Subject: [PATCH 28/28] fix whats_new.rst to ref BIDSPath --- doc/whats_new.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/whats_new.rst b/doc/whats_new.rst index f70b64cc0a..fd7e7a938f 100644 --- a/doc/whats_new.rst +++ b/doc/whats_new.rst @@ -40,7 +40,7 @@ Detailed list of changes 🧐 API and behavior changes ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -- `tracksys` accepted as argument in :class:`mne_bids.path.BIDSPath()` by `Julius Welzel`_ (:gh:`1430`) +- `tracksys` accepted as argument in :class:`mne_bids.BIDSPath()` by `Julius Welzel`_ (:gh:`1430`) 🛠 Requirements ^^^^^^^^^^^^^^^