From 16d9c7afde7bce7582b9ca05641c95ab451bf035 Mon Sep 17 00:00:00 2001 From: Stefan Appelhoff Date: Thu, 22 Feb 2024 11:33:43 +0100 Subject: [PATCH] fully prune 'events_data' from codebase --- doc/whats_new.rst | 2 ++ mne_bids/commands/mne_bids_raw_to_bids.py | 4 --- mne_bids/tests/test_write.py | 38 ----------------------- mne_bids/write.py | 19 ------------ 4 files changed, 2 insertions(+), 61 deletions(-) diff --git a/doc/whats_new.rst b/doc/whats_new.rst index d87fb95ca..447163df8 100644 --- a/doc/whats_new.rst +++ b/doc/whats_new.rst @@ -67,6 +67,8 @@ Detailed list of changes changed runtime behavior, by `Richard Höchenberger`_ (:gh:`1204`) - Display of the version number on the website is now truncated for over-long version strings, by `Daniel McCloy`_ (:gh:`1206`) +- The long deprecated ``events_data`` parameter has been fully removed from + :func:`~mne_bids.write_raw_bids` in favor of ``events``, by `Stefan Appelhoff`_ (:gh:`1229`) :doc:`Find out what was new in previous releases ` diff --git a/mne_bids/commands/mne_bids_raw_to_bids.py b/mne_bids/commands/mne_bids_raw_to_bids.py index 955cb8a44..b2fefe22f 100644 --- a/mne_bids/commands/mne_bids_raw_to_bids.py +++ b/mne_bids/commands/mne_bids_raw_to_bids.py @@ -45,9 +45,6 @@ def run(): parser.add_option( "--acq", dest="acq", help="acquisition parameter for this dataset" ) - parser.add_option( - "--events_data", dest="events_data", help="Deprecated. Pass --events instead." - ) parser.add_option("--events", dest="events", help="events file (events.tsv)") parser.add_option( "--event_id", dest="event_id", help="event id dict", metavar="eid" @@ -120,7 +117,6 @@ def run(): event_id=opt.event_id, events=opt.events, overwrite=opt.overwrite, - events_data=opt.events_data, verbose=True, ) diff --git a/mne_bids/tests/test_write.py b/mne_bids/tests/test_write.py index fc7830bbd..92c601fc4 100644 --- a/mne_bids/tests/test_write.py +++ b/mne_bids/tests/test_write.py @@ -4051,44 +4051,6 @@ def test_repeat_write_location(tmpdir): write_raw_bids(raw, bids_path, overwrite=True, verbose=False) -@testing.requires_testing_data -def test_events_data_deprecation(tmp_path): - """Test that passing events_data raises a FutureWarning.""" - bids_root = tmp_path / "bids" - bids_path = _bids_path.copy().update(root=bids_root) - raw_path = data_path / "MEG" / "sample" / "sample_audvis_trunc_raw.fif" - events_path = data_path / "MEG" / "sample" / "sample_audvis_trunc_raw-eve.fif" - event_id = { - "Auditory/Left": 1, - "Auditory/Right": 2, - "Visual/Left": 3, - "Visual/Right": 4, - "Smiley": 5, - "Button": 32, - } - - # Drop unknown events. - events = mne.read_events(events_path) - events = events[events[:, 2] != 0] - - raw = _read_raw_fif(raw_path) - with pytest.warns(FutureWarning, match="will be removed"): - write_raw_bids( - raw=raw, bids_path=bids_path, events_data=events, event_id=event_id - ) - - with pytest.raises( - ValueError, match="Only one of events and events_data can be passed" - ): - write_raw_bids( - raw=raw, - bids_path=bids_path, - events=events, - events_data=events, - event_id=event_id, - ) - - @testing.requires_testing_data def test_unknown_extension(_bids_validate, tmp_path): """Write data with unknown extension to BIDS.""" diff --git a/mne_bids/write.py b/mne_bids/write.py index 9799a0757..c42d0179c 100644 --- a/mne_bids/write.py +++ b/mne_bids/write.py @@ -1368,7 +1368,6 @@ def write_raw_bids( montage=None, acpc_aligned=False, overwrite=False, - events_data=None, verbose=None, ): """Save raw data to a BIDS-compliant folder structure. @@ -1551,9 +1550,6 @@ def write_raw_bids( and ``participants.tsv`` by a user will be retained. If ``False``, no existing data will be overwritten or replaced. - events_data - .. deprecated:: 0.11 - Use ``events`` instead. %(verbose)s @@ -1614,21 +1610,6 @@ def write_raw_bids( mne.events_from_annotations """ - if events_data is not None and events is not None: - raise ValueError("Only one of events and events_data can be passed.") - - if events_data is not None: - warn( - message="The events_data parameter has been deprecated in favor " - "the new events parameter, to ensure better consistency " - "with MNE-Python. The events_data parameter will be " - "removed in MNE-BIDS 0.14. Please use the events " - "parameter instead.", - category=FutureWarning, - ) - events = events_data - del events_data - if not isinstance(raw, BaseRaw): raise ValueError( "raw_file must be an instance of BaseRaw, " "got %s" % type(raw)