0

In our EEG experiment, we used 64 electrodes plus 1 EOG channel. We're trying to read it using the MNE package but run into an error. Looks like MNE expects 64 channels by default?

raw = read_raw_edf(input_fname=data_file,
                   eog=['EOG'],
                   preload=True)

Gives us this error:

IndexError: index 65 is out of bounds for axis 0 with size 64

How do we avoid it? Should we set the montage ourselves, to overwrite the expected 64-channel montage?

Inkidu616
  • 389
  • 3
  • 17

1 Answers1

0

Requirement: your size of index looks like 64 electrodes + 1 EOG Channel = total 65

Issue: MNE can be declared till 64 ,so outer than that is out of bound index size (in your case 65 is out of bound),

Plausible Solution: Please make sure Size of index is also declared from 0 (if it was 1)to 64 !

Shiva
  • 40
  • 1
  • 8
  • But how? I would love to tell MNE what channels to expect, but I have no idea where. Also, MNE can handle 128 channels just fine, so I don't see the problem here. – Inkidu616 Feb 27 '20 at 11:05
  • Can you please share print(raw.info) ; and try if you can see data in MNE – Shiva Feb 27 '20 at 11:20
  • Since the function yields an error, nothing is returned, and the raw variable is not created. – Inkidu616 Feb 27 '20 at 11:29
  • Try This: import mne filename = "myfile.edf" raw = mne.io.read_raw_edf(filename) raw_data = data.get_data() raw_channels = data.ch_names , rawinfo = raw.info() – Shiva Feb 27 '20 at 11:42
  • This gives the same error. The read_raw_edf function fails. None of the other lines can work, since ‘raw’ is never created. I assume ‘data’ is meant to be ‘raw’ in your code. – Inkidu616 Feb 27 '20 at 11:45
  • Sorry can you edit that and try; raw_data = raw.get_data() – Shiva Feb 27 '20 at 12:02
  • Also please refer mne samples for read_raw_edf() : https://mne.tools/dev/generated/mne.io.read_raw_edf.html – Shiva Feb 27 '20 at 12:04
  • I feel like there's a miscommunication here. The first call (read_raw_edf) fails, so there is never a 'raw' variable/object. I cannot execute methods on an object that is never created. – Inkidu616 Feb 27 '20 at 12:11