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

fully prune 'events_data' from codebase #1229

Merged
merged 1 commit into from
Feb 22, 2024
Merged
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
2 changes: 2 additions & 0 deletions doc/whats_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <whats_new_previous_releases>`

Expand Down
4 changes: 0 additions & 4 deletions mne_bids/commands/mne_bids_raw_to_bids.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -120,7 +117,6 @@ def run():
event_id=opt.event_id,
events=opt.events,
overwrite=opt.overwrite,
events_data=opt.events_data,
verbose=True,
)

Expand Down
38 changes: 0 additions & 38 deletions mne_bids/tests/test_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down
19 changes: 0 additions & 19 deletions mne_bids/write.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down
Loading