I'm having issues with reading channel locations from a .bdf file. When I run raw.plot_sensors() It gives me a runtime error: No valid channel positions found

  • MNE-Python version: 0.22.0
  • operating system: Ubuntu

import mne

sample_data_folder = "/home/vanillaskies/projects/deap2/data_original/"

sample_data_raw_file = os.path.join(sample_data_folder, 's01.bdf')

raw = mne.io.read_raw_bdf(sample_data_raw_file)

raw.info

Output:
<Info | 7 non-empty values
bads: []
ch_names: Fp1, AF3, F7, F3, FC1, FC5, T7, C3, CP1, CP5, P7, P3, Pz, PO3, …
chs: 47 EEG, 1 STIM
custom_ref_applied: False
highpass: 0.0 Hz
lowpass: 104.0 Hz
meas_date: 2010-07-01 10:00:16 UTC
nchan: 48
projs: []
sfreq: 512.0 Hz>

'eeg' in raw

Output: True

raw.info['chs'][0]['loc']

Output: array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])

raw.plot_sensors(ch_type='eeg')

Output: No valid channel positions found

BDF file uploaded here: Gofile - Free file sharing and storage platform

there is indeed no channel locations in this file but it contains standard electrodes.

ch_names: Fp1, AF3, F7, F3, FC1, FC5, T7, C3, CP1, CP5, P7, P3, Pz, PO3, …

you should use a standard montage as explained here:

https://mne.tools/dev/auto_tutorials/intro/plot_40_sensor_locations.html

HTH
Alex