brainvision raw.get_data(): 'could not convert string to float'

If you have a question or issue with MNE-Python, please include the following info:

  • MNE-Python version: 0.23.3
  • operating system: Ubuntu 18.04 LTS (linux) Conda environment.

data = mne.io.read_raw_brainvision(f)

data.get_data()


I have the feeling this might have to do with the separator in the ascii (.eeg) file being a dot. Is there anyway to solve this, or should I ask for another export with other parameters? If yes, please advise.

I can open the .eeg file with pandas.read_csv without a problem…

Hanneke

Hello @hanneke and welcome to the forum!

It indeed looks as if . is used for both decimal and field separation here :thinking: I’d say it’s an issue with the file itself, but it’s difficult to tell without looking at the data.

Do you pass any special parameters there?

Best,
Richard

PS: It’s easier for readers on the forum if you provide output as actual text instead of screenshots (I had to zoom and pan around to see the contents). Simply paste the output, select it, and click on the “Preformatted text” button to get nice formatting :+1:

Thanks for your quick reply and the tips regarding output.
To answer your question about pandas.read_csv nothing special, only the filename.

1 Like

Can you maybe share a snippet (the first 50 lines or so) of your .eeg file? Or the entire dataset if that’s possible?

Hi Richard,

This is the DataFrame I get when loading with pandas. It is disregarding the segmentation though.
I could share the dataset, how can I get it to you?

Hanneke

In [19]: df
Out[19]: 
                1         2          3          4          5          6          7          8          9  ...        57         58         59        60         61         62         63         64         65
0        1.756662 -7.949599   0.384707 -10.829395  -7.167457 -12.460517 -15.369783  -0.942378  -5.154542  ... -3.340768 -22.138659  63.258850  0.730024   5.149546  -7.168319  -4.924433   5.149063  -0.900169
1        0.969839 -9.195500  -1.519757 -11.648086  -9.142025 -13.958111 -16.104706  -2.174411  -6.505763  ... -3.505767 -22.241217  62.326839  0.261007   6.226922  -9.142879  -0.300640   6.226348  -1.448190
2       -0.979698 -9.136087  -1.846812 -11.818654  -9.132621 -13.544320 -16.368492  -1.370908  -6.558214  ... -3.133761 -21.959909  62.129593  0.526595   7.297099  -9.133642   3.740830   7.296557  -1.881127
3       -1.504680 -7.142727   0.092122 -11.557398  -6.557742 -11.408406 -16.548971   1.524520  -5.717567  ... -1.836200 -20.618736  63.332466  1.948583   8.182995  -6.559008   5.853151   8.182555  -2.244500
4        1.343102 -4.248503   3.037014 -11.547056  -2.931890  -9.185098 -17.198294   4.748055  -5.175488  ... -0.031753 -18.063786  65.415756  4.104444   9.163037  -2.933290   8.181416   9.162658  -2.760952
...           ...       ...        ...        ...        ...        ...        ...        ...        ...  ...       ...        ...        ...       ...        ...        ...        ...        ...        ...
103995  32.224266 -2.513785  -6.266185 -13.941307  -2.071751 -11.968207  -9.637086 -12.068434 -10.341389  ... -0.316415   8.105392   2.140369 -0.640280  28.653362  -2.070586  46.363693  28.653797 -11.046146
103996  34.030354 -3.151853  -6.326368 -13.631886  -2.224478 -12.099643  -9.397876 -11.670754  -9.901695  ... -0.108486   8.014566   1.771811 -1.062231  29.122599  -2.223339  48.501183  29.122992 -10.892550
103997  31.898861 -4.968705  -8.317528 -14.206380  -4.675257 -14.046184  -9.676117 -13.399736 -10.622873  ... -1.669329   5.213253  -0.244515 -2.776865  26.746487  -4.674103  48.212524  26.746891 -11.416412
103998  28.403667 -6.978395 -11.314103 -14.962460  -8.172223 -16.875040  -9.899326 -16.821661 -11.753550  ... -3.881858   1.853738  -2.338419 -4.729787  23.964386  -8.171026  46.130318  23.964825 -11.952099
103999  25.674101 -8.562653 -13.900313 -15.162472 -11.410911 -19.236317  -9.722098 -20.484903 -12.699100  ... -5.501176  -0.337598  -3.365667 -6.015285  22.381712 -11.409663  44.131687  22.382200 -11.685884

[104000 rows x 65 columns]

Hello @hanneke, I actually meant, could you share the first part of the raw .eeg file, not the result of the Pandas import?

If you want, you can email me or share it via Google Drive or Dropbox or similar. My email address is richard.hoechenberger@gmail.com

actually, I think the issue is that this is not raw BrainVision data, but data that has been processed and exported from BrainVision Analyzer :thinking: I don’t think we explicitly cover for such cases (yet?) in our reader.

I have fixed this problem in Fix read_raw_brainvision() handling of comma-separated data files by hoechenberger · Pull Request #9795 · mne-tools/mne-python · GitHub (still needs to get reviewed and merged into the main development branch)

1 Like

Thank you, @sappelhoff, that’s true, it is segmented data from BVA, should I handle that differently?

Hanneke

@Richard, thanks! I will give it a try as soon as it is merged, or can I help in reviewing?

@hanneke the PR has been merged, so when you use MNE-Python main, reading your data should work.

Thank you, @Stefan, that’s true, it is segmented data from BVA, should I handle that differently?

Personally, I would try to ditch BVA and use MNE-Python from the beginning (directly from the raw BrainVision files), but I don’t know what you need from BVA, so it might be important that you use it :slight_smile: The only “difficult” thing for us (and the reason why you ran into an error) is, that BVA BrainVision files can be different from RAW BrainVision files (as they e.g., come out of BrainVision Recorder), and we don’t have a comprehensive public specification on how these files work (and thus we have few tests and features to handle them in MNE-Python)

1 Like