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

MRG: In BIDSPath, don't infer the datatype from the suffix #1030

Merged
merged 2 commits into from
Jul 30, 2022

Conversation

hoechenberger
Copy link
Member

@hoechenberger hoechenberger commented Jul 30, 2022

I needed to set datatype to None to make find_emptyroom() deal with the inheritance principle correctly, but turns out it never took effect because BIDSPath.update() would silently replace my datatype=None with an inferred datatype='meg'.

This PR stops this automated inference.

This will likely break user code, but it's the right thing to do as we've been trying to be too clever in the past.

Merge checklist

Maintainer, please confirm the following before merging:

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

I needed to set datatype to None to make `find_emptyroom()`
deal with the inheritance principle correctly, but turns out it
never took effect because `BIDSPath.update()` would silently
replace my `datatype=None` with an inferred `datatype='meg'`.
@hoechenberger hoechenberger marked this pull request as ready for review July 30, 2022 10:30
@codecov
Copy link

Codecov bot commented Jul 30, 2022

Codecov Report

Merging #1030 (feede17) into main (fc28eae) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #1030   +/-   ##
=======================================
  Coverage   95.18%   95.18%           
=======================================
  Files          25       25           
  Lines        3777     3778    +1     
=======================================
+ Hits         3595     3596    +1     
  Misses        182      182           
Impacted Files Coverage Δ
mne_bids/sidecar_updates.py 98.09% <ø> (ø)
mne_bids/path.py 97.67% <100.00%> (+<0.01%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us.

@hoechenberger hoechenberger changed the title In BIDSPath.update(), don't infer the datatype from the suffix MRG: In BIDSPath.update(), don't infer the datatype from the suffix Jul 30, 2022
@hoechenberger
Copy link
Member Author

This PR is a blocker for mne-tools/mne-bids-pipeline#576

@hoechenberger hoechenberger changed the title MRG: In BIDSPath.update(), don't infer the datatype from the suffix MRG: In BIDSPath, don't infer the datatype from the suffix Jul 30, 2022
doc/whats_new.rst Outdated Show resolved Hide resolved
@@ -1237,14 +1233,15 @@ def _parse_ext(raw_fname):
return fname, ext


def _infer_datatype_from_path(fname):
def _infer_datatype_from_path(fname: Path):
Copy link
Member Author

Choose a reason for hiding this comment

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

this function is used by get_bids_path_from_fname()

IMHO it's doing too much magic too, but here I only ensured it keeps on working

@agramfort agramfort merged commit c3527fa into mne-tools:main Jul 30, 2022
@agramfort
Copy link
Member

Thanks @hoechenberger

@hoechenberger hoechenberger deleted the be-less-clever branch July 30, 2022 11:15
sappelhoff added a commit that referenced this pull request Aug 26, 2022
)

* Updated the BIDSPath in-place update example

I updated the `BIDSPath` in-place update example to perhaps make it clearer to users what in-place updating means.
It's a small change, but should make the message clearer.

* Missing printout in BIDSPath example and indentation

* Remove additional tab at EOL

* Added datatype to BIDSPath update after #1030

Co-authored-by: Stefan Appelhoff <stefan.appelhoff@mailbox.org>

* Added BHV name to CITATION.cff

Co-authored-by: Stefan Appelhoff <stefan.appelhoff@mailbox.org>
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.

2 participants