-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MRG] Raise an error message when src==dest in write_raw_bids (#889)
* Fixing unit tests * some cleanup * fix tests * remove unneeded note * add whatsnew * bump cache * make mne 1.0 a minimum requirement * flake * doc: update links, move ref section * remove mne 1.0 snirf checks * flake and windows fix * rename BIDSPath to BIDS path in BIDSPath docstr * use FileExistsError and black indentation Co-authored-by: Stefan Appelhoff <[email protected]>
- Loading branch information
1 parent
213c378
commit be6bd62
Showing
16 changed files
with
89 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,13 +26,7 @@ | |
For the command line version of this tool, see the :code:`cp` tool in the docs | ||
for the :ref:`Python Command Line Interface <python_cli>`. | ||
References | ||
---------- | ||
.. [1] Pernet, C.R., Appelhoff, S., Gorgolewski, K.J. et al. EEG-BIDS, an | ||
extension to the brain imaging data structure for | ||
electroencephalography. Sci Data 6, 103 (2019). | ||
https://doi.org/10.1038/s41597-019-0104-8 | ||
.. _BrainVision data format: https://www.brainproducts.com/productdetails.php?id=21&tab=5 | ||
.. _BrainVision data format: https://www.brainproducts.com/support-resources/brainvision-core-data-format-1-0/ | ||
""" # noqa:E501 | ||
|
||
# Authors: Stefan Appelhoff <[email protected]> | ||
|
@@ -100,3 +94,10 @@ | |
# | ||
# .. _`pybv`: https://github.com/bids-standard/pybv | ||
# .. _`bv-validator`: https://github.com/sappelhoff/brainvision-validator | ||
# | ||
# References | ||
# ---------- | ||
# .. [1] Pernet, C.R., Appelhoff, S., Gorgolewski, K.J. et al. EEG-BIDS, an | ||
# extension to the brain imaging data structure for | ||
# electroencephalography. Sci Data 6, 103 (2019). | ||
# https://doi.org/10.1038/s41597-019-0104-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
"""Test for the MNE BIDS path functions.""" | ||
"""Test for the MNE BIDSPath functions.""" | ||
# Authors: Adam Li <[email protected]> | ||
# | ||
# License: BSD-3-Clause | ||
|
@@ -490,7 +490,7 @@ def test_bids_path(return_bids_test_dir): | |
f'ses-{session_id}', 'meg') | ||
assert str(bids_path.fpath.parent) == expected_parent_dir | ||
|
||
# test bids path without bids_root, suffix, extension | ||
# test BIDSPath without bids_root, suffix, extension | ||
# basename and fpath should be the same | ||
expected_basename = f'sub-{subject_id}_ses-{session_id}_task-{task}_run-{run}' # noqa | ||
assert (op.basename(bids_path.fpath) == | ||
|
@@ -853,8 +853,6 @@ def test_find_empty_room(return_bids_test_dir, tmp_path): | |
'sample_audvis_trunc_raw.fif') | ||
bids_root = tmp_path / "bids" | ||
bids_root.mkdir() | ||
tmp_dir = tmp_path / "tmp" | ||
tmp_dir.mkdir() | ||
|
||
raw = _read_raw_fif(raw_fname) | ||
bids_path = BIDSPath(subject='01', session='01', | ||
|
@@ -870,6 +868,8 @@ def test_find_empty_room(return_bids_test_dir, tmp_path): | |
# The testing data has no "noise" recording, so save the actual data | ||
# as named as if it were noise. We first need to write the FIFF file | ||
# before reading it back in. | ||
tmp_dir = tmp_path / "tmp" | ||
tmp_dir.mkdir() | ||
er_raw_fname = op.join(tmp_dir, 'ernoise_raw.fif') | ||
raw.copy().crop(0, 10).save(er_raw_fname, overwrite=True) | ||
er_raw = _read_raw_fif(er_raw_fname) | ||
|
@@ -910,13 +910,12 @@ def test_find_empty_room(return_bids_test_dir, tmp_path): | |
raw = read_raw_bids(bids_path=bids_path) | ||
raw.set_meas_date(None) | ||
anonymize_info(raw.info) | ||
write_raw_bids(raw, bids_path, overwrite=True) | ||
write_raw_bids(raw, bids_path, overwrite=True, format="FIF") | ||
with pytest.raises(ValueError, match='The provided recording does not ' | ||
'have a measurement date set'): | ||
bids_path.find_empty_room() | ||
|
||
# test that the `AssociatedEmptyRoom` key in MEG sidecar is respected | ||
|
||
bids_root = tmp_path / 'associated-empty-room' | ||
bids_root.mkdir() | ||
raw = _read_raw_fif(raw_fname) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.