question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

mne.io.read_raw_brainvision reads incorrect number of datapoints

See original GitHub issue

I am writing a simple time series visualization script basing on MNE. I need to read data from EDF and BrainVision txt files, I have a sample that was exported to both. I discovered a strange behaviour that probably is a bug in mne.io.read_raw_brainvision, it is illustrated by

#!/usr/bin/env python
import mne

edf = mne.io.read_raw_edf("datasets/example.edf")
bv = mne.io.read_raw_brainvision("datasets/dattxt/example.vhdr")

print("Number of datapoints per channel ", edf.n_times, bv.n_times)

which prints in my case ('Number of datapoints per channel ', 831488, 73). It can be found (together with sample data) in this repo. I would expect that edf.n_times and bv.n_times be equal.

Additionally, when I try to read data from bv like so

data, time = bv[:, :1000]

I get

Traceback (most recent call last):
  File "./test.py", line 9, in <module>
    data, time = bv[:, :1000]
  File "/home/arccha/.conda/envs/pfb/lib/python2.7/site-packages/mne/io/base.py", line 841, in __getitem__
    verbose=self.verbose)
  File "/home/arccha/.conda/envs/pfb/lib/python2.7/site-packages/mne/io/base.py", line 523, in _read_segment
    cals, mult)
  File "/home/arccha/.conda/envs/pfb/lib/python2.7/site-packages/mne/io/brainvision/brainvision.py", line 116, in _read_segment_file
    _read_segments_c(self, data, idx, fi, start, stop, cals, mult)
  File "/home/arccha/.conda/envs/pfb/lib/python2.7/site-packages/mne/io/brainvision/brainvision.py", line 174, in _read_segments_c
    dtype = _fmt_dtype_dict[raw.orig_format]
TypeError: unhashable type: 'dict'

Am I doing something wrong or is it indeed a bug?

EDIT: I’ve tested this against MNE 0.15.2 and master branch.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
ArcChacommented, Apr 18, 2018

@cbrnr as this files are rather big I’ve used GIT LFS to put them in the repository. You need to have it installed in order to clone them.

0reactions
agramfortcommented, Jun 7, 2018

ok sounds like a plan

can you open a PR?

Read more comments on GitHub >

github_iconTop Results From Across the Web

mne.io.read_raw_brainvision — MNE 1.3.dev0 documentation
Returns: rawinstance of RawBrainVision. A Raw object containing BrainVision data. See also. mne.io.Raw. Documentation of attribute and methods.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found