Hello again,
The mne-bids-pipeline is great but due to my lack of experience I keep running into problems (I am using Python 3.9 and mne 1.1dev0).
I used a 10-10 easy cap system with 64 electrodes, therefore I chose the
eeg_template_montage = ‘easycap-M10’
Using this, I got the following error:
I also tried the standard_1005, which worked but the single electrode traces were generated in black, which I did manage to change:
Using no specification eeg_template_montage = None worked well.
Would you be able to provide some advice which eeg_template_montage specification would be the best for a 10-10 easy cap system with 64 electrodes, and what went wrong with the other setups?
Thanks, any help is much appreciated!
Franziska
agramfort
(Alexandre Gramfort)
August 6, 2022, 9:47am
2
this is likely a bug in the pipeline.
do you have a dataset (one subject is enough) you can share so we can investigate?
Alex
richard
(Richard Höchenberger)
August 6, 2022, 9:52am
3
I already have some sample data from @fraenni and can try to take a look (or share with you)
agramfort
(Alexandre Gramfort)
August 6, 2022, 10:06am
4
OK I’ll let you have a look
A
richard
(Richard Höchenberger)
August 6, 2022, 11:07am
5
This is actually something I’d consider a bug in MNE-BIDS, but needs to be discussed with the other developers. I’m tracking this here:
opened 11:00AM - 06 Aug 22 UTC
The dataset mentioned in https://mne.discourse.group/t/mne-bids-pipeline-critica… l-error-digitisation-points/5376 is a BrainVision dataset with a `[Coordinates]` section in the `vhdr` file, specifying the electrode positions. The dataset doesn't come with an `_electrodes.tsv` to specify the electrode positions in a BIDS-specific way, though.
When the dataset was loaded with MNE-BIDS and visualized, a topomap could correctly be created because channel positions were taken from `[Coordinates]`.
However, I think this is a mistake, as electrode positions must go into `_electrodes.tsv`.
The following not-so-short MWE demonstrates this problem:
- We load EEG data
- we set a montage
- we convert one EEG channel to `mag` to make MNE-BIDS believe it's an MEG dataset, so we an write this thing to a FIFF file. Here we abuse a bug (?) in MNE-BIDS: when writing M/EEG data, it doesn't create an `_electrodes.tsv` sidecar.
- We load the data again.
- Even though there was no `_electrodes.tsv`, the montage can be plotted – because the positions were taken from the `info` structure of the FIFF file.
```python
# %%
from pathlib import Path
import mne
import mne_bids
# Load data & set a montage
ssvep_folder = mne.datasets.ssvep.data_path()
ssvep_data_raw_path = (ssvep_folder / 'sub-02' / 'ses-01' / 'eeg' /
'sub-02_ses-01_task-ssvep_eeg.vhdr')
ssvep_raw = mne.io.read_raw_brainvision(ssvep_data_raw_path, verbose=False)
ssvep_raw.set_montage('easycap-M1')
# Add a single MEG channel so we can save the data as a FIFF file in BIDS
ssvep_raw.set_channel_types({'PO10': 'mag'})
fname = Path('/tmp/sub-02_ses-01_task-ssvep_meg.fif')
ssvep_raw.save(fname, overwrite=True)
del ssvep_raw
# Create a BIDS dataset
raw = mne.io.read_raw(fname)
root = Path('/tmp/bids-test')
bp = mne_bids.BIDSPath(
subject='02',
session='01',
task='ssvep',
suffix='meg',
extension='.fif',
datatype='meg',
root=root
)
mne_bids.write_raw_bids(
raw=raw,
bids_path=bp,
overwrite=True,
)
# Load the data again
raw_loaded = mne_bids.read_raw_bids(bp)
# We do have a montage
raw_loaded.get_montage().plot()
```
My proposal is to call `raw.set_montage(None)` upon loading data. If we have electrode positions in BIDS metadata, we can subsequently add them; but if we don't have any, we should get rid of the positions stored in the original data without a representation in the metadata.
1 Like
richard
(Richard Höchenberger)
August 6, 2022, 11:18am
6
In a quick test where I directly loaded your data with MNE-BIDS (i.e., outside of the pipeline), I used easycap-M1
and it seems to be working fine:
# %%
from pathlib import Path
import mne_bids
bids_root = Path('~/Development/Support/mne-python/Franziska Knolle/input')
bp = mne_bids.BIDSPath(
root=bids_root,
subject='AUAY02MA',
task='plang',
suffix='eeg',
extension='.vhdr',
datatype='eeg',
)
raw = mne_bids.read_raw_bids(bp)
raw.set_montage('easycap-M1')
raw.get_montage().plot(
sphere='eeglab' # new in MNE 1.1
)
Please note that this idealized montage is not recommended for source estimation.
richard
(Richard Höchenberger)
August 6, 2022, 5:27pm
7
I cannot reproduce this locally, and honestly it looks like a bug in MNE or something – not only are all traces black, but also the electrodes shown on the head circle (top left of the traces subplot).
Do you see this issue for the evoked contrasts only? Or also for the “normal” evoked plots?
Could you try updating MNE-Python to version 1.1 and see if the problem persists?
Thanks,
Richard
Hi Richard,
thanks for your help!
RE easycap-M10: Okay - weird - I will try it again then. thanks for checking!!
RE standard_1005. Yes I do get that also for normal evoked plots.
I am using mne 1.1dev0 - is that what you mean or is there a newer version?
Thanks!
F.
richard
(Richard Höchenberger)
August 7, 2022, 1:49pm
9
Thank you! We released MNE-Python 1.1 a few days ago. It’s worth installing to try and see if it fixes your issue. There is an incompatibility with autoreject, but I don’t think you’re currently using autoreject anyway.
Best wishes,
Richard