Skip to content

Commit

Permalink
[MRG] _part- -> _split- to conform with BIDS (#417)
Browse files Browse the repository at this point in the history
* improve citation info

* _part- -> _split- to conform with BIDS

* fix comments

* add whatsnew [skip ci]

* move changelog to API section

* bump validator version
  • Loading branch information
sappelhoff authored May 19, 2020
1 parent 102de3e commit fb6e670
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ matrix:
env:
global:
# can be "stable", or anything that can be used with git checkout
- VALIDATOR_VERSION="8887074e5f5f48a768842ffcf96fb2952dbe0e38"
- VALIDATOR_VERSION="e457907ca9af4c32aede828117ea5a43737b4597"
# can be any branch of MNE-Python (e.g., "maint/0.18", "master", ...)

before_install:
Expand Down
10 changes: 6 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -210,17 +210,19 @@ Please see our `contributing guide <https://github.com/mne-tools/mne-bids/blob/m
Cite
----

If you use ``mne-bids`` in your work, please cite:
If you use ``mne-bids`` in your work, please cite our
`publication in JOSS <https://doi.org/10.21105/joss.01896>`_.

.. code-block:: Text
Appelhoff, S., Sanderson, M., Brooks, T., Vliet, M., Quentin, R., Holdgraf, C.,
Chaumon, M., Mikulan, E., Tavabi, K., Höchenberger, R., Welke, D., Brunner, C.,
Rockhill, A., Larson, E., Gramfort, A. and Jas, M. (2019). MNE-BIDS: Organizing
electrophysiological data into the BIDS format and facilitating their analysis.
Journal of Open Source Software 4: (1896).
Journal of Open Source Software 4: (1896). https://doi.org/10.21105/joss.01896
and one of the following papers, depending on which modality you used:
and one of the following papers to credit BIDS, depending on which modality you
used:

`MEG <http://doi.org/10.1038/sdata.2018.110>`_
##############################################
Expand All @@ -231,7 +233,7 @@ and one of the following papers, depending on which modality you used:
Henson, R. N., Jas, M., Litvak, V., Moreau, J., Oostenveld, R., Schoffelen, J.,
Tadel, F., Wexler, J., Baillet, S. (2018). MEG-BIDS, the brain imaging data
structure extended to magnetoencephalography. Scientific Data, 5, 180110.
http://doi.org/10.1038/sdata.2018.110
https://doi.org/10.1038/sdata.2018.110
`EEG <https://doi.org/10.1038/s41597-019-0104-8>`_
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ environment:
# latter case, you MUST adjust VALIDATOR_EXECUTABLE to the following value:
# "C:\\projects\\mne-bids\\bids-validator\\bids-validator\\bin\\bids-validator"
# ... whereas for "stable", VALIDATOR_EXECUTABLE MUST be set to "n/a"
VALIDATOR_VERSION: "8887074e5f5f48a768842ffcf96fb2952dbe0e38"
VALIDATOR_VERSION: "e457907ca9af4c32aede828117ea5a43737b4597"
# can be any branch of MNE-Python (e.g., "maint/0.18", "master", ...)
MNE_VERSION: "maint/0.20"
VALIDATOR_EXECUTABLE: "C:\\projects\\mne-bids\\bids-validator\\bids-validator\\bin\\bids-validator"
Expand Down
1 change: 1 addition & 0 deletions doc/whats_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ API
- :func:`read_raw_bids` now expects `bids_basename` as the first argument and gains a `kind` parameter. The name of the file to read will be inferred automatically, and can no longer be passed to the function directly. This ensures better API consistency with :func:`write_raw_bids`, by `Richard Höchenberger`_ (`#410 <https://github.com/mne-tools/mne-bids/pull/410>`_)
- :func:`get_matched_empty_room` now expects `bids_basename` as the first argument and returns the `bids_basename` of the best-matching empty-room recording (instead of its filename before). The `bids_fname` argument has been dropped, by `Richard Höchenberger`_ (`#410 <https://github.com/mne-tools/mne-bids/pull/410>`_)
- :func:`get_head_mri_trans` now expects `bids_basename` as the first argument. The `bids_fname` argument has been dropped, by `Richard Höchenberger`_ (`#410 <https://github.com/mne-tools/mne-bids/pull/410>`_)
- BIDS conformity: The ``_part-%d`` entity is now called ``_split-`` throughout BIDS, MNE, and MNE-BIDS, by `Stefan Appelhoff`_ (`#417 <https://github.com/mne-tools/mne-bids/pull/417>`_)

.. _changes_0_4:

Expand Down
12 changes: 6 additions & 6 deletions mne_bids/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,11 @@ def test_parse_ext():


@pytest.mark.parametrize('fname', [
'sub-01_ses-02_task-test_run-3_part-01_meg.fif',
'sub-01_ses-02_task-test_run-3_part-01.fif',
'sub-01_ses-02_task-test_run-3_part-01',
'sub-01_ses-02_task-test_run-3_split-01_meg.fif',
'sub-01_ses-02_task-test_run-3_split-01.fif',
'sub-01_ses-02_task-test_run-3_split-01',
('/bids_root/sub-01/ses-02/meg/' +
'sub-01_ses-02_task-test_run-3_part-01_meg.fif'),
'sub-01_ses-02_task-test_run-3_split-01_meg.fif'),
])
def test_parse_bids_filename(fname):
"""Test parsing entities from a bids filename."""
Expand All @@ -286,9 +286,9 @@ def test_parse_bids_filename(fname):
assert params['ses'] == '02'
assert params['run'] == '3'
assert params['task'] == 'test'
assert params['part'] == '01'
assert params['split'] == '01'
assert list(params.keys()) == ['sub', 'ses', 'task', 'acq', 'run', 'proc',
'space', 'recording', 'part', 'kind']
'space', 'recording', 'split', 'kind']


def test_age_on_date():
Expand Down
8 changes: 4 additions & 4 deletions mne_bids/tests/test_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,14 +327,14 @@ def test_fif(_bids_validate):

assert op.exists(op.join(bids_root, 'participants.tsv'))

# asserting that single fif files do not include the part key
# asserting that single fif files do not include the split key
files = glob(op.join(bids_output_path, 'sub-' + subject_id2,
'ses-' + subject_id2, 'meg', '*.fif'))
for ii, FILE in enumerate(files):
assert 'part' not in FILE
assert 'split' not in FILE
assert ii < 1

# check that split files have part key
# check that split files have split key
raw = mne.io.read_raw_fif(raw_fname)
data_path3 = _TempDir()
raw_fname3 = op.join(data_path3, 'sample_audvis_raw.fif')
Expand All @@ -348,7 +348,7 @@ def test_fif(_bids_validate):
files = glob(op.join(bids_output_path, 'sub-' + subject_id3,
'ses-' + subject_id3, 'meg', '*.fif'))
for FILE in files:
assert 'part' in FILE
assert 'split' in FILE

# test unknown extension
raw = mne.io.read_raw_fif(raw_fname)
Expand Down
2 changes: 1 addition & 1 deletion mne_bids/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ def _parse_ext(raw_fname, verbose=False):
def _parse_bids_filename(fname, verbose):
"""Get dict from BIDS fname."""
keys = ['sub', 'ses', 'task', 'acq', 'run', 'proc', 'run', 'space',
'recording', 'part', 'kind']
'recording', 'split', 'kind']
params = {key: None for key in keys}
idx_key = 0
for match in re.finditer(param_regex, op.basename(fname)):
Expand Down
2 changes: 1 addition & 1 deletion mne_bids/write.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ def _write_raw_fif(raw, bids_fname):
split_naming = 'bids'
raw.save(bids_fname, split_naming=split_naming, overwrite=True)
else:
# This ensures that single FIF files do not have the part param
# This ensures that single FIF files do not have the split param
raw.save(bids_fname, split_naming='neuromag', overwrite=True)


Expand Down

0 comments on commit fb6e670

Please sign in to comment.