Note
Click here to download the full example code
BIDS conversion for group studies¶
Here, we show how to do BIDS conversion for group studies. The data is available here: https://openfmri.org/dataset/ds000117/
References¶
[1] Wakeman, Daniel G., and Richard N. Henson. “A multi-subject, multi-modal human neuroimaging dataset.” Scientific data, 2 (2015): 150001.
# Authors: Mainak Jas <mainak.jas@telecom-paristech.fr>
# Teon Brooks <teon.brooks@gmail.com>
# License: BSD (3-clause)
Let us import mne_bids
import os.path as op
import mne
from mne_bids import write_raw_bids
from mne_bids.datasets import fetch_faces_data
from mne_bids.utils import print_dir_tree
And fetch the data.
subject_ids = [1]
runs = range(1, 7)
data_path = op.join(op.expanduser('~'), 'mne_data')
repo = 'ds000117'
fetch_faces_data(data_path, repo, subject_ids)
output_path = op.join(data_path, 'ds000117-bids')
Warning
This will download 7.9 GB of data for one subject!
Define event_ids.
event_id = {
'face/famous/first': 5,
'face/famous/immediate': 6,
'face/famous/long': 7,
'face/unfamiliar/first': 13,
'face/unfamiliar/immediate': 14,
'face/unfamiliar/long': 15,
'scrambled/first': 17,
'scrambled/immediate': 18,
'scrambled/long': 19,
}
Let us loop over the subjects and create BIDS-compatible folder
for subject_id in subject_ids:
subject = 'sub%03d' % subject_id
for run in runs:
raw_fname = op.join(data_path, repo, subject, 'MEG',
'run_%02d_raw.fif' % run)
raw = mne.io.read_raw_fif(raw_fname)
bids_basename = ('sub-%02d_ses-01_task-VisualFaces_run-%d'
% (subject_id, run))
write_raw_bids(raw, bids_basename, output_path, event_id=event_id,
overwrite=True)
Out:
Opening raw data file /home/stefanappelhoff/mne_data/ds000117/sub001/MEG/run_01_raw.fif...
Read a total of 8 projection items:
mag_ssp_upright.fif : PCA-mags-v1 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v2 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v3 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v4 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v5 (1 x 306) idle
grad_ssp_upright.fif : PCA-grad-v1 (1 x 306) idle
grad_ssp_upright.fif : PCA-grad-v2 (1 x 306) idle
grad_ssp_upright.fif : PCA-grad-v3 (1 x 306) idle
Range : 268400 ... 815099 = 244.000 ... 740.999 secs
Ready.
Current compensation grade : 0
Opening raw data file /home/stefanappelhoff/mne_data/ds000117/sub001/MEG/run_01_raw.fif...
Read a total of 8 projection items:
mag_ssp_upright.fif : PCA-mags-v1 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v2 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v3 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v4 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v5 (1 x 306) idle
grad_ssp_upright.fif : PCA-grad-v1 (1 x 306) idle
grad_ssp_upright.fif : PCA-grad-v2 (1 x 306) idle
grad_ssp_upright.fif : PCA-grad-v3 (1 x 306) idle
Range : 268400 ... 815099 = 244.000 ... 740.999 secs
Ready.
Current compensation grade : 0
Writing '/home/stefanappelhoff/mne_data/ds000117-bids/participants.tsv'...
participant_id age sex group
0 sub-01 10 M n/a
1 sub-1 10 M n/a
Writing '/home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/sub-01_ses-01_scans.tsv'...
filename acq_time
0 meg/sub-01_ses-01_task-VisualFaces_run-1_meg.fif 2009-04-07T16:39:35
1 meg/sub-01_ses-01_task-VisualFaces_run-2_meg.fif 2009-04-07T16:52:59
2 meg/sub-01_ses-01_task-VisualFaces_run-3_meg.fif 2009-04-07T17:02:25
3 meg/sub-01_ses-01_task-VisualFaces_run-4_meg.fif 2009-04-07T17:17:45
4 meg/sub-01_ses-01_task-VisualFaces_run-5_meg.fif 2009-04-07T17:27:38
296 events found
Event IDs: [ 5 6 7 13 14 15 17 18 19 256 261 262 263 269 270
271 273 274 275 4096 4101 4102 4103 4109 4110 4111 4114]
Writing '/home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-1_events.tsv'...
onset duration trial_type event_value event_sample
0 22.958182 0.0 scrambled/first 17 25254
1 23.731818 0.0 NaN 273 26105
2 26.049091 0.0 scrambled/first 17 28654
3 26.928182 0.0 NaN 273 29621
4 29.222727 0.0 face/unfamiliar/first 13 32145
Writing '/home/stefanappelhoff/mne_data/ds000117-bids/dataset_description.json'...
{
"Name": " ",
"BIDSVersion": "1.1.1 (draft)"
}
Reading 0 ... 546699 = 0.000 ... 496.999 secs...
Writing '/home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-1_meg.json'...
{
"TaskName": "VisualFaces",
"Manufacturer": "Elekta",
"PowerLineFrequency": 50.0,
"SamplingFrequency": 1100.0,
"SoftwareFilters": "n/a",
"RecordingDuration": 496.9990909090909,
"RecordingType": "continuous",
"DewarPosition": "n/a",
"DigitizedLandmarks": false,
"DigitizedHeadPoints": false,
"MEGChannelCount": 306,
"MEGREFChannelCount": 0,
"EEGChannelCount": 74,
"EOGChannelCount": 0,
"ECGChannelCount": 0,
"EMGChannelCount": 0,
"MiscChannelCount": 12,
"TriggerChannelCount": 3
}
Writing '/home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-1_channels.tsv'...
name type units description sampling_frequency \
0 MEG0113 MEGGRADPLANAR T/m Planar Gradiometer 1100.0
1 MEG0112 MEGGRADPLANAR T/m Planar Gradiometer 1100.0
2 MEG0111 MEGMAG T Magnetometer 1100.0
3 MEG0122 MEGGRADPLANAR T/m Planar Gradiometer 1100.0
4 MEG0123 MEGGRADPLANAR T/m Planar Gradiometer 1100.0
low_cutoff high_cutoff status
0 0.0 356.399994 good
1 0.0 356.399994 good
2 0.0 356.399994 good
3 0.0 356.399994 good
4 0.0 356.399994 good
Copying data files to /home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-1_meg.fif
/home/stefanappelhoff/Desktop/bids/mne-bids/examples/convert_group_studies.py:76: RuntimeWarning: This filename (/home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-1_meg.fif) does not conform to MNE naming conventions. All raw files should end with raw.fif, raw_sss.fif, raw_tsss.fif, raw.fif.gz, raw_sss.fif.gz or raw_tsss.fif.gz
overwrite=True)
Overwriting existing file.
Writing /home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-1_meg.fif
Closing /home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-1_meg.fif [done]
Opening raw data file /home/stefanappelhoff/mne_data/ds000117/sub001/MEG/run_02_raw.fif...
Read a total of 8 projection items:
mag_ssp_upright.fif : PCA-mags-v1 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v2 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v3 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v4 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v5 (1 x 306) idle
grad_ssp_upright.fif : PCA-grad-v1 (1 x 306) idle
grad_ssp_upright.fif : PCA-grad-v2 (1 x 306) idle
grad_ssp_upright.fif : PCA-grad-v3 (1 x 306) idle
Range : 30800 ... 580799 = 28.000 ... 527.999 secs
Ready.
Current compensation grade : 0
Opening raw data file /home/stefanappelhoff/mne_data/ds000117/sub001/MEG/run_02_raw.fif...
Read a total of 8 projection items:
mag_ssp_upright.fif : PCA-mags-v1 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v2 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v3 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v4 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v5 (1 x 306) idle
grad_ssp_upright.fif : PCA-grad-v1 (1 x 306) idle
grad_ssp_upright.fif : PCA-grad-v2 (1 x 306) idle
grad_ssp_upright.fif : PCA-grad-v3 (1 x 306) idle
Range : 30800 ... 580799 = 28.000 ... 527.999 secs
Ready.
Current compensation grade : 0
Writing '/home/stefanappelhoff/mne_data/ds000117-bids/participants.tsv'...
participant_id age sex group
0 sub-01 10 M n/a
1 sub-1 10 M n/a
Writing '/home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/sub-01_ses-01_scans.tsv'...
filename acq_time
0 meg/sub-01_ses-01_task-VisualFaces_run-1_meg.fif 2009-04-07T16:39:35
0 meg/sub-01_ses-01_task-VisualFaces_run-2_meg.fif 2009-04-07T16:52:59
2 meg/sub-01_ses-01_task-VisualFaces_run-3_meg.fif 2009-04-07T17:02:25
3 meg/sub-01_ses-01_task-VisualFaces_run-4_meg.fif 2009-04-07T17:17:45
4 meg/sub-01_ses-01_task-VisualFaces_run-5_meg.fif 2009-04-07T17:27:38
296 events found
Event IDs: [ 5 6 7 13 14 15 17 18 19 256 261 262 263 269 270
271 273 274 275 4096 4109 4110 4111]
Writing '/home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-2_events.tsv'...
onset duration trial_type event_value event_sample
0 28.032727 0.0 scrambled/first 17 30836
1 28.837273 0.0 NaN 273 31721
2 31.156364 0.0 face/unfamiliar/first 13 34272
3 32.131818 0.0 NaN 256 35345
4 34.213636 0.0 face/famous/first 5 37635
Writing '/home/stefanappelhoff/mne_data/ds000117-bids/dataset_description.json'...
{
"Name": " ",
"BIDSVersion": "1.1.1 (draft)"
}
Reading 0 ... 549999 = 0.000 ... 499.999 secs...
Writing '/home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-2_meg.json'...
{
"TaskName": "VisualFaces",
"Manufacturer": "Elekta",
"PowerLineFrequency": 50.0,
"SamplingFrequency": 1100.0,
"SoftwareFilters": "n/a",
"RecordingDuration": 499.9990909090909,
"RecordingType": "continuous",
"DewarPosition": "n/a",
"DigitizedLandmarks": false,
"DigitizedHeadPoints": false,
"MEGChannelCount": 306,
"MEGREFChannelCount": 0,
"EEGChannelCount": 74,
"EOGChannelCount": 0,
"ECGChannelCount": 0,
"EMGChannelCount": 0,
"MiscChannelCount": 12,
"TriggerChannelCount": 3
}
Writing '/home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-2_channels.tsv'...
name type units description sampling_frequency \
0 MEG0113 MEGGRADPLANAR T/m Planar Gradiometer 1100.0
1 MEG0112 MEGGRADPLANAR T/m Planar Gradiometer 1100.0
2 MEG0111 MEGMAG T Magnetometer 1100.0
3 MEG0122 MEGGRADPLANAR T/m Planar Gradiometer 1100.0
4 MEG0123 MEGGRADPLANAR T/m Planar Gradiometer 1100.0
low_cutoff high_cutoff status
0 0.0 356.399994 good
1 0.0 356.399994 good
2 0.0 356.399994 good
3 0.0 356.399994 good
4 0.0 356.399994 good
Copying data files to /home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-2_meg.fif
/home/stefanappelhoff/Desktop/bids/mne-bids/examples/convert_group_studies.py:76: RuntimeWarning: This filename (/home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-2_meg.fif) does not conform to MNE naming conventions. All raw files should end with raw.fif, raw_sss.fif, raw_tsss.fif, raw.fif.gz, raw_sss.fif.gz or raw_tsss.fif.gz
overwrite=True)
Overwriting existing file.
Writing /home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-2_meg.fif
Closing /home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-2_meg.fif [done]
Opening raw data file /home/stefanappelhoff/mne_data/ds000117/sub001/MEG/run_03_raw.fif...
Read a total of 8 projection items:
mag_ssp_upright.fif : PCA-mags-v1 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v2 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v3 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v4 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v5 (1 x 306) idle
grad_ssp_upright.fif : PCA-grad-v1 (1 x 306) idle
grad_ssp_upright.fif : PCA-grad-v2 (1 x 306) idle
grad_ssp_upright.fif : PCA-grad-v3 (1 x 306) idle
Range : 187000 ... 417999 = 170.000 ... 379.999 secs
Ready.
Current compensation grade : 0
Opening raw data file /home/stefanappelhoff/mne_data/ds000117/sub001/MEG/run_03_raw.fif...
Read a total of 8 projection items:
mag_ssp_upright.fif : PCA-mags-v1 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v2 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v3 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v4 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v5 (1 x 306) idle
grad_ssp_upright.fif : PCA-grad-v1 (1 x 306) idle
grad_ssp_upright.fif : PCA-grad-v2 (1 x 306) idle
grad_ssp_upright.fif : PCA-grad-v3 (1 x 306) idle
Range : 187000 ... 417999 = 170.000 ... 379.999 secs
Ready.
Current compensation grade : 0
Writing '/home/stefanappelhoff/mne_data/ds000117-bids/participants.tsv'...
participant_id age sex group
0 sub-01 10 M n/a
1 sub-1 10 M n/a
Writing '/home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/sub-01_ses-01_scans.tsv'...
filename acq_time
0 meg/sub-01_ses-01_task-VisualFaces_run-1_meg.fif 2009-04-07T16:39:35
1 meg/sub-01_ses-01_task-VisualFaces_run-2_meg.fif 2009-04-07T16:52:59
0 meg/sub-01_ses-01_task-VisualFaces_run-3_meg.fif 2009-04-07T17:02:25
3 meg/sub-01_ses-01_task-VisualFaces_run-4_meg.fif 2009-04-07T17:17:45
4 meg/sub-01_ses-01_task-VisualFaces_run-5_meg.fif 2009-04-07T17:27:38
119 events found
Event IDs: [ 5 6 7 13 14 15 17 18 19 256 261 262 263 269 270
271 273 274 275 4096 4103 4110 4352]
Writing '/home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-3_events.tsv'...
onset duration trial_type event_value event_sample
0 24.560000 0.0 scrambled/first 17 27016
1 25.270909 0.0 NaN 273 27798
2 27.700000 0.0 scrambled/immediate 18 30470
3 28.550000 0.0 NaN 256 31405
4 30.740909 0.0 scrambled/first 17 33815
Writing '/home/stefanappelhoff/mne_data/ds000117-bids/dataset_description.json'...
{
"Name": " ",
"BIDSVersion": "1.1.1 (draft)"
}
Reading 0 ... 230999 = 0.000 ... 209.999 secs...
Writing '/home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-3_meg.json'...
{
"TaskName": "VisualFaces",
"Manufacturer": "Elekta",
"PowerLineFrequency": 50.0,
"SamplingFrequency": 1100.0,
"SoftwareFilters": "n/a",
"RecordingDuration": 209.9990909090909,
"RecordingType": "continuous",
"DewarPosition": "n/a",
"DigitizedLandmarks": false,
"DigitizedHeadPoints": false,
"MEGChannelCount": 306,
"MEGREFChannelCount": 0,
"EEGChannelCount": 74,
"EOGChannelCount": 0,
"ECGChannelCount": 0,
"EMGChannelCount": 0,
"MiscChannelCount": 12,
"TriggerChannelCount": 3
}
Writing '/home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-3_channels.tsv'...
name type units description sampling_frequency \
0 MEG0113 MEGGRADPLANAR T/m Planar Gradiometer 1100.0
1 MEG0112 MEGGRADPLANAR T/m Planar Gradiometer 1100.0
2 MEG0111 MEGMAG T Magnetometer 1100.0
3 MEG0122 MEGGRADPLANAR T/m Planar Gradiometer 1100.0
4 MEG0123 MEGGRADPLANAR T/m Planar Gradiometer 1100.0
low_cutoff high_cutoff status
0 0.0 356.399994 good
1 0.0 356.399994 good
2 0.0 356.399994 good
3 0.0 356.399994 good
4 0.0 356.399994 good
Copying data files to /home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-3_meg.fif
/home/stefanappelhoff/Desktop/bids/mne-bids/examples/convert_group_studies.py:76: RuntimeWarning: This filename (/home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-3_meg.fif) does not conform to MNE naming conventions. All raw files should end with raw.fif, raw_sss.fif, raw_tsss.fif, raw.fif.gz, raw_sss.fif.gz or raw_tsss.fif.gz
overwrite=True)
Overwriting existing file.
Writing /home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-3_meg.fif
Closing /home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-3_meg.fif [done]
Opening raw data file /home/stefanappelhoff/mne_data/ds000117/sub001/MEG/run_04_raw.fif...
Read a total of 8 projection items:
mag_ssp_upright.fif : PCA-mags-v1 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v2 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v3 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v4 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v5 (1 x 306) idle
grad_ssp_upright.fif : PCA-grad-v1 (1 x 306) idle
grad_ssp_upright.fif : PCA-grad-v2 (1 x 306) idle
grad_ssp_upright.fif : PCA-grad-v3 (1 x 306) idle
Range : 47300 ... 590699 = 43.000 ... 536.999 secs
Ready.
Current compensation grade : 0
Opening raw data file /home/stefanappelhoff/mne_data/ds000117/sub001/MEG/run_04_raw.fif...
Read a total of 8 projection items:
mag_ssp_upright.fif : PCA-mags-v1 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v2 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v3 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v4 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v5 (1 x 306) idle
grad_ssp_upright.fif : PCA-grad-v1 (1 x 306) idle
grad_ssp_upright.fif : PCA-grad-v2 (1 x 306) idle
grad_ssp_upright.fif : PCA-grad-v3 (1 x 306) idle
Range : 47300 ... 590699 = 43.000 ... 536.999 secs
Ready.
Current compensation grade : 0
Writing '/home/stefanappelhoff/mne_data/ds000117-bids/participants.tsv'...
participant_id age sex group
0 sub-01 10 M n/a
1 sub-1 10 M n/a
Writing '/home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/sub-01_ses-01_scans.tsv'...
filename acq_time
0 meg/sub-01_ses-01_task-VisualFaces_run-1_meg.fif 2009-04-07T16:39:35
1 meg/sub-01_ses-01_task-VisualFaces_run-2_meg.fif 2009-04-07T16:52:59
2 meg/sub-01_ses-01_task-VisualFaces_run-3_meg.fif 2009-04-07T17:02:25
0 meg/sub-01_ses-01_task-VisualFaces_run-4_meg.fif 2009-04-07T17:17:45
4 meg/sub-01_ses-01_task-VisualFaces_run-5_meg.fif 2009-04-07T17:27:38
294 events found
Event IDs: [ 5 6 7 13 14 15 17 18 19 256 261 262 263 269 270
271 273 274 275 4096 4109 4110]
Writing '/home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-4_events.tsv'...
onset duration trial_type event_value event_sample
0 25.407273 0.0 face/unfamiliar/first 13 27948
1 26.219091 0.0 NaN 269 28841
2 28.498182 0.0 face/unfamiliar/immediate 14 31348
3 29.337273 0.0 NaN 270 32271
4 31.789091 0.0 face/unfamiliar/first 13 34968
Writing '/home/stefanappelhoff/mne_data/ds000117-bids/dataset_description.json'...
{
"Name": " ",
"BIDSVersion": "1.1.1 (draft)"
}
Reading 0 ... 543399 = 0.000 ... 493.999 secs...
Writing '/home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-4_meg.json'...
{
"TaskName": "VisualFaces",
"Manufacturer": "Elekta",
"PowerLineFrequency": 50.0,
"SamplingFrequency": 1100.0,
"SoftwareFilters": "n/a",
"RecordingDuration": 493.9990909090909,
"RecordingType": "continuous",
"DewarPosition": "n/a",
"DigitizedLandmarks": false,
"DigitizedHeadPoints": false,
"MEGChannelCount": 306,
"MEGREFChannelCount": 0,
"EEGChannelCount": 74,
"EOGChannelCount": 0,
"ECGChannelCount": 0,
"EMGChannelCount": 0,
"MiscChannelCount": 12,
"TriggerChannelCount": 3
}
Writing '/home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-4_channels.tsv'...
name type units description sampling_frequency \
0 MEG0113 MEGGRADPLANAR T/m Planar Gradiometer 1100.0
1 MEG0112 MEGGRADPLANAR T/m Planar Gradiometer 1100.0
2 MEG0111 MEGMAG T Magnetometer 1100.0
3 MEG0122 MEGGRADPLANAR T/m Planar Gradiometer 1100.0
4 MEG0123 MEGGRADPLANAR T/m Planar Gradiometer 1100.0
low_cutoff high_cutoff status
0 0.0 356.399994 good
1 0.0 356.399994 good
2 0.0 356.399994 good
3 0.0 356.399994 good
4 0.0 356.399994 good
Copying data files to /home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-4_meg.fif
/home/stefanappelhoff/Desktop/bids/mne-bids/examples/convert_group_studies.py:76: RuntimeWarning: This filename (/home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-4_meg.fif) does not conform to MNE naming conventions. All raw files should end with raw.fif, raw_sss.fif, raw_tsss.fif, raw.fif.gz, raw_sss.fif.gz or raw_tsss.fif.gz
overwrite=True)
Overwriting existing file.
Writing /home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-4_meg.fif
Closing /home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-4_meg.fif [done]
Opening raw data file /home/stefanappelhoff/mne_data/ds000117/sub001/MEG/run_05_raw.fif...
Read a total of 8 projection items:
mag_ssp_upright.fif : PCA-mags-v1 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v2 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v3 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v4 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v5 (1 x 306) idle
grad_ssp_upright.fif : PCA-grad-v1 (1 x 306) idle
grad_ssp_upright.fif : PCA-grad-v2 (1 x 306) idle
grad_ssp_upright.fif : PCA-grad-v3 (1 x 306) idle
Range : 283800 ... 820599 = 258.000 ... 745.999 secs
Ready.
Current compensation grade : 0
Opening raw data file /home/stefanappelhoff/mne_data/ds000117/sub001/MEG/run_05_raw.fif...
Read a total of 8 projection items:
mag_ssp_upright.fif : PCA-mags-v1 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v2 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v3 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v4 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v5 (1 x 306) idle
grad_ssp_upright.fif : PCA-grad-v1 (1 x 306) idle
grad_ssp_upright.fif : PCA-grad-v2 (1 x 306) idle
grad_ssp_upright.fif : PCA-grad-v3 (1 x 306) idle
Range : 283800 ... 820599 = 258.000 ... 745.999 secs
Ready.
Current compensation grade : 0
Writing '/home/stefanappelhoff/mne_data/ds000117-bids/participants.tsv'...
participant_id age sex group
0 sub-01 10 M n/a
1 sub-1 10 M n/a
Writing '/home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/sub-01_ses-01_scans.tsv'...
filename acq_time
0 meg/sub-01_ses-01_task-VisualFaces_run-1_meg.fif 2009-04-07T16:39:35
1 meg/sub-01_ses-01_task-VisualFaces_run-2_meg.fif 2009-04-07T16:52:59
2 meg/sub-01_ses-01_task-VisualFaces_run-3_meg.fif 2009-04-07T17:02:25
3 meg/sub-01_ses-01_task-VisualFaces_run-4_meg.fif 2009-04-07T17:17:45
0 meg/sub-01_ses-01_task-VisualFaces_run-5_meg.fif 2009-04-07T17:27:38
292 events found
Event IDs: [ 5 6 7 13 14 15 17 18 19 256 261 262 263 269 270
271 273 274 275 4096 4103 4110 4111]
Writing '/home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-5_events.tsv'...
onset duration trial_type event_value event_sample
0 25.717273 0.0 face/famous/first 5 28289
1 26.469091 0.0 NaN 261 29116
2 29.023636 0.0 scrambled/first 17 31926
3 29.599091 0.0 NaN 273 32559
4 32.130909 0.0 scrambled/immediate 18 35344
Writing '/home/stefanappelhoff/mne_data/ds000117-bids/dataset_description.json'...
{
"Name": " ",
"BIDSVersion": "1.1.1 (draft)"
}
Reading 0 ... 536799 = 0.000 ... 487.999 secs...
Writing '/home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-5_meg.json'...
{
"TaskName": "VisualFaces",
"Manufacturer": "Elekta",
"PowerLineFrequency": 50.0,
"SamplingFrequency": 1100.0,
"SoftwareFilters": "n/a",
"RecordingDuration": 487.9990909090909,
"RecordingType": "continuous",
"DewarPosition": "n/a",
"DigitizedLandmarks": false,
"DigitizedHeadPoints": false,
"MEGChannelCount": 306,
"MEGREFChannelCount": 0,
"EEGChannelCount": 74,
"EOGChannelCount": 0,
"ECGChannelCount": 0,
"EMGChannelCount": 0,
"MiscChannelCount": 12,
"TriggerChannelCount": 3
}
Writing '/home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-5_channels.tsv'...
name type units description sampling_frequency \
0 MEG0113 MEGGRADPLANAR T/m Planar Gradiometer 1100.0
1 MEG0112 MEGGRADPLANAR T/m Planar Gradiometer 1100.0
2 MEG0111 MEGMAG T Magnetometer 1100.0
3 MEG0122 MEGGRADPLANAR T/m Planar Gradiometer 1100.0
4 MEG0123 MEGGRADPLANAR T/m Planar Gradiometer 1100.0
low_cutoff high_cutoff status
0 0.0 356.399994 good
1 0.0 356.399994 good
2 0.0 356.399994 good
3 0.0 356.399994 good
4 0.0 356.399994 good
Copying data files to /home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-5_meg.fif
/home/stefanappelhoff/Desktop/bids/mne-bids/examples/convert_group_studies.py:76: RuntimeWarning: This filename (/home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-5_meg.fif) does not conform to MNE naming conventions. All raw files should end with raw.fif, raw_sss.fif, raw_tsss.fif, raw.fif.gz, raw_sss.fif.gz or raw_tsss.fif.gz
overwrite=True)
Overwriting existing file.
Writing /home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-5_meg.fif
Closing /home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-5_meg.fif [done]
Opening raw data file /home/stefanappelhoff/mne_data/ds000117/sub001/MEG/run_06_raw.fif...
Read a total of 8 projection items:
mag_ssp_upright.fif : PCA-mags-v1 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v2 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v3 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v4 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v5 (1 x 306) idle
grad_ssp_upright.fif : PCA-grad-v1 (1 x 306) idle
grad_ssp_upright.fif : PCA-grad-v2 (1 x 306) idle
grad_ssp_upright.fif : PCA-grad-v3 (1 x 306) idle
Range : 28600 ... 573099 = 26.000 ... 520.999 secs
Ready.
Current compensation grade : 0
Opening raw data file /home/stefanappelhoff/mne_data/ds000117/sub001/MEG/run_06_raw.fif...
Read a total of 8 projection items:
mag_ssp_upright.fif : PCA-mags-v1 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v2 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v3 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v4 (1 x 306) idle
mag_ssp_upright.fif : PCA-mags-v5 (1 x 306) idle
grad_ssp_upright.fif : PCA-grad-v1 (1 x 306) idle
grad_ssp_upright.fif : PCA-grad-v2 (1 x 306) idle
grad_ssp_upright.fif : PCA-grad-v3 (1 x 306) idle
Range : 28600 ... 573099 = 26.000 ... 520.999 secs
Ready.
Current compensation grade : 0
Writing '/home/stefanappelhoff/mne_data/ds000117-bids/participants.tsv'...
participant_id age sex group
0 sub-01 10 M n/a
1 sub-1 10 M n/a
Writing '/home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/sub-01_ses-01_scans.tsv'...
filename acq_time
0 meg/sub-01_ses-01_task-VisualFaces_run-1_meg.fif 2009-04-07T16:39:35
1 meg/sub-01_ses-01_task-VisualFaces_run-2_meg.fif 2009-04-07T16:52:59
2 meg/sub-01_ses-01_task-VisualFaces_run-3_meg.fif 2009-04-07T17:02:25
3 meg/sub-01_ses-01_task-VisualFaces_run-4_meg.fif 2009-04-07T17:17:45
4 meg/sub-01_ses-01_task-VisualFaces_run-5_meg.fif 2009-04-07T17:27:38
296 events found
Event IDs: [ 5 6 7 13 14 15 17 18 19 256 261 262 263 269 270
271 273 274 275 4096 4110]
Writing '/home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-6_events.tsv'...
onset duration trial_type event_value event_sample
0 25.204545 0.0 face/famous/first 5 27725
1 25.850000 0.0 NaN 261 28435
2 28.345455 0.0 scrambled/first 17 31180
3 29.024545 0.0 NaN 273 31927
4 31.470000 0.0 face/famous/first 5 34617
Writing '/home/stefanappelhoff/mne_data/ds000117-bids/dataset_description.json'...
{
"Name": " ",
"BIDSVersion": "1.1.1 (draft)"
}
Reading 0 ... 544499 = 0.000 ... 494.999 secs...
Writing '/home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-6_meg.json'...
{
"TaskName": "VisualFaces",
"Manufacturer": "Elekta",
"PowerLineFrequency": 50.0,
"SamplingFrequency": 1100.0,
"SoftwareFilters": "n/a",
"RecordingDuration": 494.9990909090909,
"RecordingType": "continuous",
"DewarPosition": "n/a",
"DigitizedLandmarks": false,
"DigitizedHeadPoints": false,
"MEGChannelCount": 306,
"MEGREFChannelCount": 0,
"EEGChannelCount": 74,
"EOGChannelCount": 0,
"ECGChannelCount": 0,
"EMGChannelCount": 0,
"MiscChannelCount": 12,
"TriggerChannelCount": 3
}
Writing '/home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-6_channels.tsv'...
name type units description sampling_frequency \
0 MEG0113 MEGGRADPLANAR T/m Planar Gradiometer 1100.0
1 MEG0112 MEGGRADPLANAR T/m Planar Gradiometer 1100.0
2 MEG0111 MEGMAG T Magnetometer 1100.0
3 MEG0122 MEGGRADPLANAR T/m Planar Gradiometer 1100.0
4 MEG0123 MEGGRADPLANAR T/m Planar Gradiometer 1100.0
low_cutoff high_cutoff status
0 0.0 356.399994 good
1 0.0 356.399994 good
2 0.0 356.399994 good
3 0.0 356.399994 good
4 0.0 356.399994 good
Copying data files to /home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-6_meg.fif
/home/stefanappelhoff/Desktop/bids/mne-bids/examples/convert_group_studies.py:76: RuntimeWarning: This filename (/home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-6_meg.fif) does not conform to MNE naming conventions. All raw files should end with raw.fif, raw_sss.fif, raw_tsss.fif, raw.fif.gz, raw_sss.fif.gz or raw_tsss.fif.gz
overwrite=True)
Overwriting existing file.
Writing /home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-6_meg.fif
Closing /home/stefanappelhoff/mne_data/ds000117-bids/sub-01/ses-01/meg/sub-01_ses-01_task-VisualFaces_run-6_meg.fif [done]
Now let’s see the structure of the BIDS folder we created.
print_dir_tree(output_path)
Out:
|------------ ds000117-bids
|--------------- participants.tsv
|--------------- dataset_description.json
|--------------- participants.json
|--------------- sub-1
|------------------ ses-01
|--------------------- sub-1_ses-01_scans.tsv
|--------------------- meg
|------------------------ sub-1_ses-01_task-VisualFaces_run-4_meg.fif
|------------------------ sub-1_ses-01_task-VisualFaces_run-4_channels.tsv
|------------------------ sub-1_ses-01_task-VisualFaces_run-2_meg.fif
|------------------------ sub-1_ses-01_task-VisualFaces_run-5_events.tsv
|------------------------ sub-1_ses-01_task-VisualFaces_run-5_meg.json
|------------------------ sub-1_ses-01_task-VisualFaces_run-3_events.tsv
|------------------------ sub-1_ses-01_task-VisualFaces_run-5_channels.tsv
|------------------------ sub-1_ses-01_task-VisualFaces_run-1_channels.tsv
|------------------------ sub-1_ses-01_task-VisualFaces_run-4_meg.json
|------------------------ sub-1_ses-01_task-VisualFaces_run-6_meg.fif
|------------------------ sub-1_ses-01_task-VisualFaces_run-3_channels.tsv
|------------------------ sub-1_ses-01_task-VisualFaces_run-6_events.tsv
|------------------------ sub-1_ses-01_task-VisualFaces_run-1_meg.fif
|------------------------ sub-1_ses-01_task-VisualFaces_run-6_meg.json
|------------------------ sub-1_ses-01_task-VisualFaces_run-6_channels.tsv
|------------------------ sub-1_ses-01_task-VisualFaces_run-1_meg.json
|------------------------ sub-1_ses-01_task-VisualFaces_run-3_meg.json
|------------------------ sub-1_ses-01_task-VisualFaces_run-3_meg.fif
|------------------------ sub-1_ses-01_task-VisualFaces_run-2_events.tsv
|------------------------ sub-1_ses-01_coordsystem.json
|------------------------ sub-1_ses-01_task-VisualFaces_run-5_meg.fif
|------------------------ sub-1_ses-01_task-VisualFaces_run-4_events.tsv
|------------------------ sub-1_ses-01_task-VisualFaces_run-2_meg.json
|------------------------ sub-1_ses-01_task-VisualFaces_run-2_channels.tsv
|------------------------ sub-1_ses-01_task-VisualFaces_run-1_events.tsv
|--------------- sub-01
|------------------ ses-01
|--------------------- sub-01_ses-01_scans.tsv
|--------------------- meg
|------------------------ sub-01_ses-01_task-VisualFaces_run-1_meg.fif
|------------------------ sub-01_ses-01_task-VisualFaces_run-2_meg.fif
|------------------------ sub-01_ses-01_coordsystem.json
|------------------------ sub-01_ses-01_task-VisualFaces_run-5_events.tsv
|------------------------ sub-01_ses-01_task-VisualFaces_run-6_channels.tsv
|------------------------ sub-01_ses-01_task-VisualFaces_run-5_channels.tsv
|------------------------ sub-01_ses-01_task-VisualFaces_run-4_channels.tsv
|------------------------ sub-01_ses-01_task-VisualFaces_run-6_events.tsv
|------------------------ sub-01_ses-01_task-VisualFaces_run-6_meg.fif
|------------------------ sub-01_ses-01_task-VisualFaces_run-2_meg.json
|------------------------ sub-01_ses-01_task-VisualFaces_run-3_channels.tsv
|------------------------ sub-01_ses-01_task-VisualFaces_run-4_events.tsv
|------------------------ sub-01_ses-01_task-VisualFaces_run-4_meg.json
|------------------------ sub-01_ses-01_task-VisualFaces_run-2_channels.tsv
|------------------------ sub-01_ses-01_task-VisualFaces_run-2_events.tsv
|------------------------ sub-01_ses-01_task-VisualFaces_run-1_meg.json
|------------------------ sub-01_ses-01_task-VisualFaces_run-3_meg.json
|------------------------ sub-01_ses-01_task-VisualFaces_run-4_meg.fif
|------------------------ sub-01_ses-01_task-VisualFaces_run-1_channels.tsv
|------------------------ sub-01_ses-01_task-VisualFaces_run-6_meg.json
|------------------------ sub-01_ses-01_task-VisualFaces_run-3_meg.fif
|------------------------ sub-01_ses-01_task-VisualFaces_run-3_events.tsv
|------------------------ sub-01_ses-01_task-VisualFaces_run-1_events.tsv
|------------------------ sub-01_ses-01_task-VisualFaces_run-5_meg.json
|------------------------ sub-01_ses-01_task-VisualFaces_run-5_meg.fif
Total running time of the script: ( 0 minutes 35.246 seconds)