From fba860902b9667aa269f9804ad1d6c9c8f0e988d Mon Sep 17 00:00:00 2001 From: Simon Kern <14980558+skjerns@users.noreply.github.com> Date: Tue, 22 Oct 2024 23:26:47 +0200 Subject: [PATCH] Fix warning given if no events are written and task is resting state (#1327) * add chpi to known channel list * removed some ch types from testing * change chpi to BIDS type HLU * adapt changelog * remove myself from authors again? * fix logic in warning if no events are written * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * adapt changelog * revert removal of empty line --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- doc/whats_new.rst | 1 + mne_bids/read.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/whats_new.rst b/doc/whats_new.rst index cb0048152..41ecdcfc9 100644 --- a/doc/whats_new.rst +++ b/doc/whats_new.rst @@ -62,6 +62,7 @@ Detailed list of changes - When processing subject_info data that MNE Python imports as numpy arrays with only one item, MNE-BIDS now unpacks these, resulting in a correct participants.tsv, by `Thomas Hartmann`_ (:gh:`1310`) - Fixed broken links in examples 7 and 8, by `William Turner`_ (:gh:`1316`) - All valid extensions for ``README`` files are now accepted. This prevents an extra ``README`` file being created, when one with a ``.txt``, ``.md``, or ``.rst`` extension is already present. By `Thomas Hartmann`_ (:gh:`1318`) +- A warning was given if no events were provided but the task was starting with 'rest' as recommended by `Simon Kern`_ (:gh:`1327`) ⚕️ Code health ^^^^^^^^^^^^^^ diff --git a/mne_bids/read.py b/mne_bids/read.py index b216b03cd..a19860c23 100644 --- a/mne_bids/read.py +++ b/mne_bids/read.py @@ -227,7 +227,7 @@ def _read_events(events, event_id, raw, bids_path=None): # Warn about missing events if not rest or empty-room data if (all_events.size == 0 and bids_path.task is not None) and ( not bids_path.task.startswith("rest") - or not (bids_path.subject == "emptyroom" and bids_path.task == "noise") + and not (bids_path.subject == "emptyroom" and bids_path.task == "noise") ): warn( "No events found or provided. Please add annotations to the raw "