Repository: mne-tools/mne-bids

Issue:
scans.tsv file writes paths with incorrect separator
I run all my dev/testing on windows and I noticed which testing BIDSHandler that the data I generated using mne-bids wasn't being liked on Circle. The issue is because I am generating the data on a windows computer, so `os.path.join(~)` will use `\` as the separator, however, the BIDS specification requires `/` as the separator.
Should be an easy fix however so PR incoming...


Discussion:
sounds good. @monkeyman192 you should also review some PRs so I have less work ;-)

Resolving patch:
diff --git a/mne_bids/mne_bids.py b/mne_bids/mne_bids.py
--- a/mne_bids/mne_bids.py
+++ b/mne_bids/mne_bids.py
@@ -341,8 +341,8 @@ def _scans_tsv(raw, raw_fname, fname, overwrite=False, verbose=True):
     else:
         acq_time = 'n/a'
 
-    data = OrderedDict([('filename', ['%s' % raw_fname]),
-                        ('acq_time', [acq_time])])
+    data = OrderedDict([('filename', ['%s' % raw_fname.replace(os.sep, '/')]),
+                       ('acq_time', [acq_time])])
 
     if os.path.exists(fname):
         orig_data = _from_tsv(fname)
@@ -697,8 +697,7 @@ def write_raw_bids(raw, bids_basename, output_path, events_data=None,
     _participants_tsv(raw, subject_id, participants_tsv_fname, overwrite,
                       verbose)
     _participants_json(participants_json_fname, True, verbose)
-    _scans_tsv(raw, os.path.join(kind, bids_fname), scans_fname,
-               overwrite, verbose)
+    _scans_tsv(raw, op.join(kind, bids_fname), scans_fname, overwrite, verbose)
 
     # TODO: Implement coordystem.json and electrodes.tsv for EEG and  iEEG
     if kind == 'meg' and not emptyroom:


Test patch:
diff --git a/mne_bids/tests/test_mne_bids.py b/mne_bids/tests/test_mne_bids.py
--- a/mne_bids/tests/test_mne_bids.py
+++ b/mne_bids/tests/test_mne_bids.py
@@ -183,7 +183,7 @@ def test_kit():
     channels_tsv = make_bids_basename(
         subject=subject_id, session=session_id, task=task, run=run,
         suffix='channels.tsv', acquisition=acq,
-        prefix=op.join(output_path, 'sub-01/ses-01/meg'))
+        prefix=op.join(output_path, 'sub-01', 'ses-01', 'meg'))
     data = _from_tsv(channels_tsv)
     assert 'STI 014' not in data['name']
 
@@ -194,7 +194,7 @@ def test_kit():
     marker_fname = make_bids_basename(
         subject=subject_id, session=session_id, task=task, run=run,
         acquisition=acq, suffix='markers.sqd',
-        prefix=os.path.join(output_path, 'sub-01/ses-01/meg', raw_folder))
+        prefix=op.join(output_path, 'sub-01', 'ses-01', 'meg', raw_folder))
     assert op.exists(marker_fname)
 
 
@@ -314,14 +314,14 @@ def test_edf():
     channels_tsv = make_bids_basename(
         subject=subject_id, session=session_id, task=task, run=run,
         suffix='channels.tsv', acquisition=acq,
-        prefix=op.join(output_path, 'sub-01/ses-01/eeg'))
+        prefix=op.join(output_path, 'sub-01', 'ses-01', 'eeg'))
     data = _from_tsv(channels_tsv)
     assert 'ElectroMyoGram' in data['description']
 
     # check that the scans list contains two scans
     scans_tsv = make_bids_basename(
         subject=subject_id, session=session_id, suffix='scans.tsv',
-        prefix=op.join(output_path, 'sub-01/ses-01'))
+        prefix=op.join(output_path, 'sub-01', 'ses-01'))
     data = _from_tsv(scans_tsv)
     assert len(list(data.values())[0]) == 2