# Thanks for the 0.7 mne-bids update!

**URL:** <https://mne.discourse.group/t/thanks-for-the-0-7-mne-bids-update/2877>\
**Category:** Support & Discussions\
**Tags:** mne-bids\
**Created:** [March 24, 2021, 8:47am UTC](https://mne.discourse.group/t/thanks-for-the-0-7-mne-bids-update/2877 "2021-03-24T08:47:59Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![timonmerk](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/timonmerk/32/276_2.png) [@timonmerk](https://mne.discourse.group/u/timonmerk)\
**Post date:** [March 24, 2021, 8:48am UTC](https://mne.discourse.group/t/thanks-for-the-0-7-mne-bids-update/2877/1 "2021-03-24T08:48:00Z")

</div>

Hello and thanks to everyone working on the 0.7 update! This tool helps our lab really a lot organizing datasets!

I have two additional comments.  
First, I tried reading an ieeg Dataset including an electrode.tsv and a coordinatesystem.json. The files get correctly read, and I can also see in the montage the electrode locations.  
Then I simply tested to write out the RawArray again using  
`mne_bids.write_raw_bids(raw_arr, bids_path, format="BrainVision")`

This resulted in the following error:

> * * *
> 
> ValueError Traceback (most recent call last)  
> in   
> ----\> 1 mne\_bids.write\_raw\_bids(raw\_arr, bids\_path, format=“BrainVision”)
> 
> ~\Anaconda3\lib\site-packages\mne\_bids\write.py in write\_raw\_bids(raw, bids\_path, events\_data, event\_id, anonymize, format, overwrite, verbose)  
> 1265 # if we have an available DigMontage  
> 1266 if raw.info[‘dig’] is not None and raw.info[‘dig’]:  
> → 1267 \_write\_dig\_bids(bids\_path, raw, overwrite, verbose)  
> 1268 else:  
> 1269 logger.warning(f’Writing of electrodes.tsv is not supported ’
> 
> ~\Anaconda3\lib\site-packages\mne\_bids\dig.py in \_write\_dig\_bids(bids\_path, raw, overwrite, verbose)  
> 367 # XXX: To improve when mne-python allows coord\_frame=‘unknown’  
> 368 # coordinate frame is either  
> → 369 coordsystem\_path.update(space=coord\_frame)  
> 370 electrodes\_path.update(space=coord\_frame)  
> 371
> 
> ~\Anaconda3\lib\site-packages\mne\_bids\path.py in update(self, check, \*\*kwargs)  
> 610  
> 611 # Perform a check of the entities.  
> → 612 self.\_check()  
> 613 return self  
> 614
> 
> ~\Anaconda3\lib\site-packages\mne\_bids\path.py in \_check(self)  
> 726 f’{self.datatype}‘)  
> 727 elif space not in allowed\_spaces\_for\_dtype:  
> → 728 raise ValueError(f’space ({space}) is not valid for ’  
> 729 f’datatype ({self.datatype}).\n’  
> 730 f’Should be one of ’
> 
> ValueError: space (CapTrak) is not valid for datatype (ieeg).  
> Should be one of [‘ICBM452AirSpace’, ‘ICBM452Warp5Space’, ‘IXI549Space’, ‘fsaverage’, ‘fsaverageSym’, ‘fsLR’, ‘MNIColin27’, ‘MNI152Lin’, ‘MNI152NLin2009aSym’, ‘MNI152NLin2009bSym’, ‘MNI152NLin2009cSym’, ‘MNI152NLin2009aAsym’, ‘MNI152NLin2009bAsym’, ‘MNI152NLin2009cAsym’, ‘MNI152NLin6Sym’, ‘MNI152NLin6ASym’, ‘MNI305’, ‘NIHPD’, ‘OASIS30AntsOASISAnts’, ‘OASIS30Atropos’, ‘Talairach’, ‘UNCInfant’, ‘fsaverage3’, ‘fsaverage4’, ‘fsaverage5’, ‘fsaverage6’, ‘fsaveragesym’, ‘UNCInfant0V21’, ‘UNCInfant1V21’, ‘UNCInfant2V21’, ‘UNCInfant0V22’, ‘UNCInfant1V22’, ‘UNCInfant2V22’, ‘UNCInfant0V23’, ‘UNCInfant1V23’, ‘UNCInfant2V23’, ‘Other’, ‘Pixels’, ‘ACPC’]

I guess that it’s related to the standard “CapTrak” space, also for ieeg. Maybe switching this space for ieeg data to another space might already fix this issue.

My second question, and sorry if this is a bit unrelated, is that it would be super great in future to use write\_raw\_bids also without previously reading in a fif or brainvision file (as done here [08. Convert iEEG data to BIDS format — MNE-BIDS 0.14 documentation](https://mne.tools/mne-bids/stable/auto_examples/convert_ieeg_to_bids.html#sphx-glr-auto-examples-convert-ieeg-to-bids-py) with  
`raw = [mne.io.read_raw_edf](https://mne.tools/dev/generated/mne.io.read_raw_edf.html#mne.io.read_raw_edf)([misc_path](https://docs.python.org/3/library/stdtypes.html#str) + '/ecog/sample_ecog.edf')`

So instead data could be simply specified as

```python
ch_names = ["ch_1", "ch_2", "ch_3", "ch_4"]
info = mne.create_info(ch_names, 1000., 'ecog')
raw = mne.io.RawArray(data=np.random.random([4, 2000]), info=info)
raw.info['line_freq'] = 60 # specify power line frequency as required by BIDS
raw.set_channel_types({ch: 'ecog' for ch in raw.ch_names})

```

And then write\_raw\_bids could be called:

> mne\_bids.write\_raw\_bids(raw, bids\_path=bids\_path, format=“BrainVision”)

Which currently results in this error:

> * * *
> 
> ValueError Traceback (most recent call last)  
> in   
> ----\> 1 mne\_bids.write\_raw\_bids(raw, bids\_path=bids\_path, format=“BrainVision”)
> 
> ~\Anaconda3\lib\site-packages\mne\_bids\write.py in write\_raw\_bids(raw, bids\_path, events\_data, event\_id, anonymize, format, overwrite, verbose)  
> 1103  
> 1104 if not hasattr(raw, ‘filenames’) or raw.filenames[0] is None:  
> → 1105 raise ValueError(‘raw.filenames is missing. Please set raw.filenames’  
> 1106 ‘as a list with the full path of original raw file.’)  
> 1107
> 
> ValueError: raw.filenames is missing. Please set raw.filenamesas a list with the full path of original raw file.

I guess this is simply a feature request, but it would make writing BIDS a lot easier 🙂

Thanks again for the great work!

- MNE-BIDS version: 0.7
- operating system: Windows 10

---

<div class="post-metadata">

**Author:** ![sappelhoff](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/sappelhoff/32/3276_2.png) [@sappelhoff](https://mne.discourse.group/u/sappelhoff)\
**Post date:** [March 24, 2021, 9:18am UTC](https://mne.discourse.group/t/thanks-for-the-0-7-mne-bids-update/2877/2 "2021-03-24T09:18:27Z")

</div>

Hi @timonmerk 👋

> [@timonmerk](#):
>
> I guess that it’s related to the standard “CapTrak” space, also for ieeg. Maybe switching this space for ieeg data to another space might already fix this issue.

Just a note that the way we handle coordinate systems for iEEG between BIDS and MNE is currently very much in flux 😬 some pointers:

- the `bids-chat` channel on the MNE-Python discord (long read)
- [https://github.com/bids-standard/bids-specification/pull/757](https://github.com/bids-standard/bids-specification/pull/757)
- [Storing iEEG electrodes with locations from FreeSurfer image · Issue #747 · bids-standard/bids-specification · GitHub](https://github.com/bids-standard/bids-specification/issues/747)
- [Writing/Reading iEEG Coordinate Frames - FreeSurfer volume and FreeSurfer RAS · Issue #737 · mne-tools/mne-bids · GitHub](https://github.com/mne-tools/mne-bids/issues/737)

Having that said, I think your problem may be solved in parallel to that 🤔 But I am not sure because I don’t know the details. Could you please open a new issue on mne-bids including a full description of what you want to do, where it breaks, and what you expected instead of the breakage? 🙂

> [@timonmerk](#):
>
> is that it would be super great in future to use write\_raw\_bids also without previously reading in a fif or brainvision

just adding a crossref of this being discussed here: [Why does MNE-BIDS always need the raw.filename attribute? · Issue #404 · mne-tools/mne-bids · GitHub](https://github.com/mne-tools/mne-bids/issues/404)

---

<div class="post-metadata">

**Author:** ![sappelhoff](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/sappelhoff/32/3276_2.png) [@sappelhoff](https://mne.discourse.group/u/sappelhoff)\
**Post date:** [March 24, 2021, 9:26am UTC](https://mne.discourse.group/t/thanks-for-the-0-7-mne-bids-update/2877/3 "2021-03-24T09:26:20Z")

</div>

> [@sappelhoff](#):
>
> Could you please open a new issue on mne-bids including a full description of what you want to do, where it breaks, and what you expected instead of the breakage?

I just realized that the later part of this issue: [bug: write\_raw\_bids uses CapTrak coordsys for iEEG data (invalid) · Issue #723 · mne-tools/mne-bids · GitHub](https://github.com/mne-tools/mne-bids/issues/723#issuecomment-799307076)

probably discusses the problem in some way. Still - I think a new issue with a clear and concise description would help us to debug this / improve this. The other issue has unfortunately become quite a mess of many different issues that are hard to track.

---

<div class="post-metadata">

**Author:** ![timonmerk](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/timonmerk/32/276_2.png) [@timonmerk](https://mne.discourse.group/u/timonmerk)\
**Post date:** [March 24, 2021, 9:38am UTC](https://mne.discourse.group/t/thanks-for-the-0-7-mne-bids-update/2877/4 "2021-03-24T09:38:26Z")

</div>

Thanks @sappelhoff, both of your referenced issues I wrote on Github, so I think I will be patient and come back to this at a later stage 🙂 I was just too excited about the update and decided to name the main issues we’re still facing.

---

<div class="post-metadata">

**Author:** ![moritz-gerster](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/moritz-gerster/32/1166_2.png) [@moritz-gerster](https://mne.discourse.group/u/moritz-gerster)\
**Post date:** [February 17, 2022, 3:17pm UTC](https://mne.discourse.group/t/thanks-for-the-0-7-mne-bids-update/2877/5 "2022-02-17T15:17:56Z")

</div>

@sappelhoff I have the very same issue and I would be really happy for some help how to fix it! 🙂

---

<div class="post-metadata">

**Author:** ![sappelhoff](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/sappelhoff/32/3276_2.png) [@sappelhoff](https://mne.discourse.group/u/sappelhoff)\
**Post date:** [February 17, 2022, 3:26pm UTC](https://mne.discourse.group/t/thanks-for-the-0-7-mne-bids-update/2877/6 "2022-02-17T15:26:01Z")

</div>

hi @moritz-gerster could you please open a detailed bug report on the mne-bids issue tracker on GitHub? It’s more likely that somebody can help you there (including myself). thanks! 🙂

---

<div class="post-metadata">

**Author:** ![moritz-gerster](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/moritz-gerster/32/1166_2.png) [@moritz-gerster](https://mne.discourse.group/u/moritz-gerster)\
**Post date:** [February 18, 2022, 1:38pm UTC](https://mne.discourse.group/t/thanks-for-the-0-7-mne-bids-update/2877/7 "2022-02-18T13:38:54Z")

</div>

Dear @sappelhoff ,

Yes, I wrote one: [Montage coordinate frames are saved wrongly · Issue #961 · mne-tools/mne-bids · GitHub](https://github.com/mne-tools/mne-bids/issues/961)

Thanks!  
Moritz
