Skip to content

Commit a1f79d4

Browse files
authored
Merge branch 'main' into main
2 parents 2ea92db + 122f268 commit a1f79d4

File tree

18 files changed

+114
-108
lines changed

18 files changed

+114
-108
lines changed

.github/workflows/unit_tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
- uses: actions/cache@v3
6060
with:
6161
path: ${{ env.pythonLocation }}
62-
key: build-0-${{ env.pythonLocation }}-${{ hashFiles('setup.cfg') }}-${{ hashFiles('test_requirements.txt') }}
62+
key: build-1-${{ env.pythonLocation }}-${{ hashFiles('setup.cfg') }}-${{ hashFiles('test_requirements.txt') }}
6363

6464
- name: Install dependencies
6565
run: |
@@ -174,7 +174,7 @@ jobs:
174174
- name: Install MNE (stable)
175175
if: "matrix.mne-version == 'mne-stable'"
176176
run: |
177-
git clone --depth 1 https://github.com/mne-tools/mne-python.git -b maint/0.24
177+
git clone --depth 1 https://github.com/mne-tools/mne-python.git -b maint/1.0
178178
python -m pip install -e ./mne-python
179179
180180
- name: Install MNE (main)

doc/install.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Dependencies
1212

1313
Required:
1414

15-
* ``mne`` (>=0.24)
15+
* ``mne`` (>=1.0)
1616
* ``numpy`` (>=1.16.0)
1717
* ``scipy`` (>=1.2.0, or >=1.5.0 for certain operations with EEGLAB data)
1818
* ``setuptools`` (>=46.4.0)

doc/whats_new.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ Detailed list of changes
4747

4848
- :func:`~mne_bids.write_raw_bids` now stores participant weight and height in ``participants.tsv``, by `Richard Höchenberger`_ (:gh:`1031`)
4949

50-
- :func:`~mne_bids.write_raw_bids` now supports EGI format by `Anand Saini`_, `Scott Huberty`_ and `Mathieu Scheltienne`_ (:gh:`1006`)
50+
- :func:`~mne_bids.write_raw_bids` now supports EGI format, by `Anand Saini`_, `Scott Huberty`_ and `Mathieu Scheltienne`_ (:gh:`1006`)
51+
52+
- TSV files that are empty (i.e., only a header row is present) are now handled more robustly and a warning is issued, by `Stefan Appelhoff`_ (:gh:`1038`)
5153

5254
🧐 API and behavior changes
5355
^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -63,6 +65,8 @@ Detailed list of changes
6365
🛠 Requirements
6466
^^^^^^^^^^^^^^^
6567

68+
- MNE-BIDS now requires MNE-Python 1.0 or newer.
69+
6670
- Writing BrainVision files now requires ``pybv`` version ``0.7.3``, by `Stefan Appelhoff`_ (:gh:`1011`)
6771

6872
🪲 Bug fixes
@@ -84,6 +88,8 @@ Detailed list of changes
8488

8589
- Writing and copying CTF files now works on Windows when files already exist (``overwrite=True``), by `Stefan Appelhoff`_ (:gh:`1035`)
8690

91+
- Instead of deleting files and raising cryptic errors, an intentional error message is now sent when calling :func:`~mne_bids.write_raw_bids` with the source file identical to the destination file, unless ``format`` is specified, by `Adam Li`_ and `Stefan Appelhoff`_ (:gh:`889`)
92+
8793
:doc:`Find out what was new in previous releases <whats_new_previous_releases>`
8894

8995
.. include:: authors.rst

examples/convert_eeg_to_bids.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
1818
.. currentmodule:: mne_bids
1919
20-
.. _BrainVision format: https://www.brainproducts.com/productdetails.php?id=21&tab=5
20+
.. _BrainVision format: https://www.brainproducts.com/support-resources/brainvision-core-data-format-1-0/
2121
.. _CapTrak: https://www.fieldtriptoolbox.org/faq/coordsys/#details-of-the-captrak-coordinate-system
2222
2323
""" # noqa: E501

examples/rename_brainvision_files.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,7 @@
2626
For the command line version of this tool, see the :code:`cp` tool in the docs
2727
for the :ref:`Python Command Line Interface <python_cli>`.
2828
29-
References
30-
----------
31-
.. [1] Pernet, C.R., Appelhoff, S., Gorgolewski, K.J. et al. EEG-BIDS, an
32-
extension to the brain imaging data structure for
33-
electroencephalography. Sci Data 6, 103 (2019).
34-
https://doi.org/10.1038/s41597-019-0104-8
35-
.. _BrainVision data format: https://www.brainproducts.com/productdetails.php?id=21&tab=5
29+
.. _BrainVision data format: https://www.brainproducts.com/support-resources/brainvision-core-data-format-1-0/
3630
""" # noqa:E501
3731

3832
# Authors: Stefan Appelhoff <[email protected]>
@@ -100,3 +94,10 @@
10094
#
10195
# .. _`pybv`: https://github.com/bids-standard/pybv
10296
# .. _`bv-validator`: https://github.com/sappelhoff/brainvision-validator
97+
#
98+
# References
99+
# ----------
100+
# .. [1] Pernet, C.R., Appelhoff, S., Gorgolewski, K.J. et al. EEG-BIDS, an
101+
# extension to the brain imaging data structure for
102+
# electroencephalography. Sci Data 6, 103 (2019).
103+
# https://doi.org/10.1038/s41597-019-0104-8

mne_bids/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@
155155
['.mrk'] # KIT/Yokogawa/Ricoh marker coil
156156
)
157157

158-
# allowed BIDS path entities
158+
# allowed BIDSPath entities
159159
ALLOWED_PATH_ENTITIES = ('subject', 'session', 'task', 'run',
160160
'processing', 'recording', 'space',
161161
'acquisition', 'split',

mne_bids/path.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ def fpath(self):
568568
# else, return the relative path with the basename
569569
if (self.suffix is None or self.extension is None) and \
570570
self.root is not None:
571-
# get matching BIDS paths inside the bids root
571+
# get matching BIDSPaths inside the bids root
572572
matching_paths = \
573573
_get_matching_bidspaths_from_filesystem(self)
574574

@@ -645,7 +645,7 @@ def update(self, *, check=None, **kwargs):
645645
the existing ``.check`` attribute instead, which is set upon
646646
`mne_bids.BIDSPath` instantiation. Defaults to ``None``.
647647
**kwargs : dict
648-
It can contain updates for valid BIDS path entities:
648+
It can contain updates for valid BIDSPath entities:
649649
'subject', 'session', 'task', 'acquisition', 'processing', 'run',
650650
'recording', 'space', 'suffix', 'split', 'extension',
651651
or updates for 'root' or 'datatype'.
@@ -981,7 +981,7 @@ def meg_crosstalk_fpath(self):
981981

982982

983983
def _get_matching_bidspaths_from_filesystem(bids_path):
984-
"""Get matching file paths for a BIDS path.
984+
"""Get matching file paths for a BIDSPath.
985985
986986
Assumes suffix and/or extension is not provided.
987987
"""
@@ -1264,7 +1264,7 @@ def get_bids_path_from_fname(fname, check=True, verbose=None):
12641264
Returns
12651265
-------
12661266
bids_path : BIDSPath
1267-
The BIDS path object.
1267+
The BIDSPath object.
12681268
"""
12691269
fpath = Path(fname)
12701270
fname = fpath.name

mne_bids/read.py

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@
1010
from pathlib import Path
1111
import json
1212
import re
13-
import warnings
1413
from datetime import datetime, timezone
1514

1615
import numpy as np
1716
import mne
1817
from mne import io, read_events, events_from_annotations
1918
from mne.io.pick import pick_channels_regexp
2019
from mne.utils import (
21-
has_nibabel, logger, warn, get_subjects_dir, check_version
20+
has_nibabel, logger, warn, get_subjects_dir
2221
)
2322
from mne.coreg import fit_matched_points
2423
from mne.transforms import apply_trans
@@ -57,13 +56,6 @@ def _read_raw(raw_path, electrode=None, hsp=None, hpi=None,
5756
raw = reader[ext](raw_path, allow_maxshield, **kwargs)
5857

5958
elif ext in ['.ds', '.vhdr', '.set', '.edf', '.bdf', '.EDF', '.snirf']:
60-
if (
61-
ext == '.snirf' and
62-
not check_version('mne', '1.0')
63-
): # pragma: no cover
64-
raise RuntimeError(
65-
'fNIRS support in MNE-BIDS requires MNE-Python version 1.0'
66-
)
6759
raw_path = Path(raw_path)
6860
raw = reader[ext](raw_path, **kwargs)
6961

@@ -286,17 +278,7 @@ def _handle_scans_reading(scans_fname, raw, bids_path):
286278
# by the MNE documentation, and in fact we cannot load e.g. OpenNeuro
287279
# ds003392 without this combination.
288280
raw.set_meas_date(None)
289-
with warnings.catch_warnings():
290-
# This is to silence a warning emitted by MNE-Python < 0.24. The
291-
# warnings filter can be safely removed once we drop support for
292-
# MNE-Python 0.23 and older.
293-
warnings.filterwarnings(
294-
action='ignore',
295-
message="Input info has 'meas_date' set to None",
296-
category=RuntimeWarning,
297-
module='mne'
298-
)
299-
raw.anonymize(daysback=None, keep_his=True)
281+
raw.anonymize(daysback=None, keep_his=True)
300282
raw.set_meas_date(acq_time)
301283

302284
return raw

mne_bids/report/_report.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ def _summarize_sidecar_json(root, scans_fpaths):
315315

316316
n_scans += 1
317317

318-
# convert to BIDS Path
318+
# convert to BIDSPath
319319
if not isinstance(bids_path, BIDSPath):
320320
bids_path = get_bids_path_from_fname(bids_path)
321321
bids_path.root = root
@@ -401,7 +401,7 @@ def _summarize_channels_tsv(root, scans_fpaths):
401401
if datatype not in ['meg', 'eeg', 'ieeg']:
402402
continue
403403

404-
# convert to BIDS Path
404+
# convert to BIDSPath
405405
if not isinstance(bids_path, BIDSPath):
406406
bids_path = get_bids_path_from_fname(bids_path)
407407
bids_path.root = root

mne_bids/tests/test_path.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Test for the MNE BIDS path functions."""
1+
"""Test for the MNE BIDSPath functions."""
22
# Authors: Adam Li <[email protected]>
33
#
44
# License: BSD-3-Clause
@@ -490,7 +490,7 @@ def test_bids_path(return_bids_test_dir):
490490
f'ses-{session_id}', 'meg')
491491
assert str(bids_path.fpath.parent) == expected_parent_dir
492492

493-
# test bids path without bids_root, suffix, extension
493+
# test BIDSPath without bids_root, suffix, extension
494494
# basename and fpath should be the same
495495
expected_basename = f'sub-{subject_id}_ses-{session_id}_task-{task}_run-{run}' # noqa
496496
assert (op.basename(bids_path.fpath) ==
@@ -853,8 +853,6 @@ def test_find_empty_room(return_bids_test_dir, tmp_path):
853853
'sample_audvis_trunc_raw.fif')
854854
bids_root = tmp_path / "bids"
855855
bids_root.mkdir()
856-
tmp_dir = tmp_path / "tmp"
857-
tmp_dir.mkdir()
858856

859857
raw = _read_raw_fif(raw_fname)
860858
bids_path = BIDSPath(subject='01', session='01',
@@ -870,6 +868,8 @@ def test_find_empty_room(return_bids_test_dir, tmp_path):
870868
# The testing data has no "noise" recording, so save the actual data
871869
# as named as if it were noise. We first need to write the FIFF file
872870
# before reading it back in.
871+
tmp_dir = tmp_path / "tmp"
872+
tmp_dir.mkdir()
873873
er_raw_fname = op.join(tmp_dir, 'ernoise_raw.fif')
874874
raw.copy().crop(0, 10).save(er_raw_fname, overwrite=True)
875875
er_raw = _read_raw_fif(er_raw_fname)
@@ -910,13 +910,12 @@ def test_find_empty_room(return_bids_test_dir, tmp_path):
910910
raw = read_raw_bids(bids_path=bids_path)
911911
raw.set_meas_date(None)
912912
anonymize_info(raw.info)
913-
write_raw_bids(raw, bids_path, overwrite=True)
913+
write_raw_bids(raw, bids_path, overwrite=True, format="FIF")
914914
with pytest.raises(ValueError, match='The provided recording does not '
915915
'have a measurement date set'):
916916
bids_path.find_empty_room()
917917

918918
# test that the `AssociatedEmptyRoom` key in MEG sidecar is respected
919-
920919
bids_root = tmp_path / 'associated-empty-room'
921920
bids_root.mkdir()
922921
raw = _read_raw_fif(raw_fname)

0 commit comments

Comments
 (0)