Skip to content

GSN montage electrode naming #8830

@sylvchev

Description

@sylvchev

Describe the bug

When reading file with an HydroCel Geodesic Sensor Net montage, set_montage() returns an error if the electrodes are not correctly named. Unfortunately, the indicated error message is incorrect and does not help to fix the naming scheme.

Steps to reproduce

I'm using MAMEM EEG dataset 1 for SSVEP, a publicly available data. The example code below download 60 MB of data and try to apply the expected naming scheme. It generates an error.

import wfdb

from mne import create_info
from mne.channels import make_standard_montage
from mne.io import RawArray
from mne.datasets.utils import _get_path

import glob
import os
import numpy as np

subj = "dataset1/S001a"
wfdb.io.dl_database('mssvepdb', './', [subj],
                    annotators='win', overwrite=False)
record = wfdb.rdrecord(subj)
data = record.p_signal.T
n_samples, n_channels, n_trials = record.sig_len, 256, 23
ch_types = ['eeg']*256
sfreq = 250
ch_names = ["{}-{}".format(s, i) if s == "EEG" else s
            for i, s in enumerate(record.sig_name)]
info = create_info(ch_names, sfreq, ch_types)
raw = RawArray(data, info, verbose=False)
montage = make_standard_montage('GSN-HydroCel-256')

try:
    # Raise an error
    raw.set_montage(montage)
except ValueError as err:
    # Point out missing channels: ['EEG-0', 'F8', 'EEG-2', 'EEG-3', ...
    # even if they are correctly defined
    print("Channels are: ", ch_names)
    raise(err)

# in fact, this montage requires channels named ['E1', 'E2', 'E3', ...
ch_names = ["E{}".format(i+1) for i in range(0, 256)]
raw.set_montage(montage)

Expected results

The montage should work with the following naming scheme: ch_names = ['EEG-0', 'F8', 'EEG-2', 'EEG-3', 'EEG-4', 'EEG-5', 'EEG-6', ...

Actual results

The montage works with a different naming scheme: ch_names = ['E1', 'E2', 'E3', 'E4', 'E5', 'E6', 'E7', 'E8', 'E9', ... that is not easy to find.

Additional information

Platform:      macOS-10.16-x86_64-i386-64bit
Python:        3.6.10 |Anaconda, Inc.| (default, Mar 25 2020, 18:53:43)  [GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]
Executable:    /Users/sylchev/anaconda3/bin/python
CPU:           i386: 4 cores
Memory:        8.0 GB

mne:           0.22.0
numpy:         1.18.1 {blas=mkl_rt, lapack=mkl_rt}
scipy:         1.4.1
matplotlib:    3.1.3 {backend=Qt5Agg}

sklearn:       0.22.1
numba:         0.51.2
nibabel:       Not found
nilearn:       Not found
dipy:          Not found
cupy:          Not found
pandas:        1.1.3
mayavi:        Not found
pyvista:       Not found
vtk:           Not found

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions