bug report: brainvision import crash on some files.

  • MNE version:1.6.1
  • operating system: Windows 10

f = 'some_file.vhdr'
raw = mne.io.read_raw(f, preload=False)

While some files are loaded this way correctly some are not.
The error encountered is (in line 1098):

ValueError: could not convert string to float: 'Selected'

I corrected the problem at my station by rewriting brainvision.py lines 1098-1100

for electrode_range in impedance_ranges:
    electrode_range = electrode_range.split()
    electrode_imp_ranges[electrode_range[0]] = {
        "imp_lower_bound": float(electrode_range[10]),
        "imp_upper_bound": float(electrode_range[12]),
        "imp_range_unit": electrode_range[13],
    }

I hope this can be fixed in the upcoming releases.

1 Like

This sounds like a bug in the reader, can you please open an issue (maybe together with a problematic file)?

1 Like

Sorry but - how do I open an issue?
furthermore, I agree that this is a problem with the reader. the code in my original message is a fix for the issue. this is not the original code from the package.

You can open a new issue here: Sign in to GitHub · GitHub

And if you’re up for it, you can also create a PR with a fix!

1 Like