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

Deprecate write_raw_bids()'s events_data parameter in favor of "events" #1054

Merged
merged 13 commits into from
Aug 21, 2022

Conversation

hoechenberger
Copy link
Member

@hoechenberger hoechenberger commented Aug 19, 2022

For more consistency with MNE-Python.

This is WIP.

Raises a FutureWarning if events_data is used. The idea is to have a very long deprecation cycle here (2, 3 releases?)

WDYT?

Merge checklist

Maintainer, please confirm the following before merging.
If applicable:

  • All comments are resolved
  • This is not your own PR
  • All CIs are happy
  • PR title starts with [MRG]
  • whats_new.rst is updated
  • New contributors have been added to CITATION.cff
  • PR description includes phrase "closes <#issue-number>"

Comment on lines 1251 to 1252
events=None,
events_data=None,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now we accept both parameters. Passing events_data will emit a FutureWarning.

mne_bids/write.py Outdated Show resolved Hide resolved
For more consistency with MNE-Python.

This is WIP.

WDYT?
@hoechenberger
Copy link
Member Author

hoechenberger commented Aug 19, 2022

Doc builds are failing with:

ImportError: cannot import name 'sphinx_compatibility' from 'sphinx_gallery' 
(/home/circleci/mne_bids_env/lib/python3.9/site-packages/sphinx_gallery/__init__.py)

Copy link
Member

@agramfort agramfort left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok for me. I had thought about this in the past but it was loo priority for me.

@sappelhoff what are you thoughts on this?

@@ -81,7 +83,7 @@ def run():
line_freq = None if opt.line_freq == "None" else opt.line_freq
raw.info['line_freq'] = line_freq
write_raw_bids(raw, bids_path, event_id=opt.event_id,
events_data=opt.events_data, overwrite=opt.overwrite,
events=opt.events, overwrite=opt.overwrite,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break backward compat if you don’t pass events_data no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in f6de206

def write_raw_bids(
raw,
bids_path,
*,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not backward compatible. I would add events_data as the end of the parameter list like done in the good old days

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 65f181d, better now..? I'm still introducing kw-only arguments, but now only after the 4th parameter

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 a future release of MNE-BIDS. Please use the '
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you deprecate say which version will drop support

Copy link
Member Author

@hoechenberger hoechenberger Aug 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to decide upon that :) Proposals?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say 0.14!

@codecov
Copy link

codecov bot commented Aug 20, 2022

Codecov Report

Merging #1054 (2067021) into main (7607a0e) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #1054   +/-   ##
=======================================
  Coverage   95.20%   95.21%           
=======================================
  Files          25       25           
  Lines        3815     3822    +7     
=======================================
+ Hits         3632     3639    +7     
  Misses        183      183           
Impacted Files Coverage Δ
mne_bids/commands/mne_bids_raw_to_bids.py 94.73% <100.00%> (+0.14%) ⬆️
mne_bids/inspect.py 98.79% <100.00%> (ø)
mne_bids/read.py 96.09% <100.00%> (ø)
mne_bids/write.py 97.16% <100.00%> (+0.01%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@hoechenberger hoechenberger marked this pull request as ready for review August 20, 2022 08:12
Copy link
Member

@agramfort agramfort left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sappelhoff I let you have the 2nd look

Copy link
Member

@sappelhoff sappelhoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this improvement in consistency is great, thanks for the work!

@agramfort agramfort merged commit 18999ca into mne-tools:main Aug 21, 2022
@agramfort
Copy link
Member

thx @hoechenberger

@hoechenberger hoechenberger deleted the events branch August 21, 2022 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants