set_montage error for brainvision (.vhdr) file

hey guys!
I’m new to this and I’m trying to set a montage for my eeg files, which were recorded via BrainVision (.vhdr). I don’t have any bad channels defined. I’m using this code:

montage = mne.channels.make_standard_montage("biosemi64")
raw = mne.Info().set_montage(montage = montage)

and I’m getting the following error message that i dont understand, do you have any suggestions?

/usr/local/lib/python3.10/dist-packages/mne/io/meas_info.py in _check_consistency(self, prepend_error)
   1283     def _check_consistency(self, prepend_error=""):
   1284         """Do some self-consistency checks and datatype tweaks."""
-> 1285         missing = [bad for bad in self["bads"] if bad not in self["ch_names"]]
   1286         if len(missing) > 0:
   1287             msg = "%sbad channel(s) %s marked do not exist in info"

KeyError: 'bads'
  • MNE version: 1.4.2
  • operating system: Windows 10

Hello @MiguelNeves and welcome to the forum!

This … doesn’t make much sense.

What you want to do is something as simple as:

raw = mne.io.read_raw_brainvision(...)
raw.set_montage("biosemi64")

Best wishes,
Richard

1 Like

It was so simple! thank you very much, it was solved instantly :slight_smile:

1 Like