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.

BrainVision event parser doesn't handle my data correctly

See original GitHub issue

The event parser for BrainVision files generates seemingly arbitrary event codes for my data. This is a problem that was first mentioned in #6267 and supposedly fixed. However, the fix introduced special handling depending on the detected event type:

https://github.com/mne-tools/mne-python/blob/70789c466133eaba410e1fc254c4b88723e30b77/mne/io/brainvision/brainvision.py#L825-L829

In the vmrk files generated in our lab using PyCorder, all stimulus and response events are simply labeled as Event (i.e., not Stimulus or Response, respectively). Therefore, they get assigned IDs 10001+, and the IDs we assigned to them during recording are basically ignored, yielding the issue(s) brought up in #6267.

When I change the line

_BV_EVENT_IO_OFFSETS = {'Stimulus/S': 0, 'Response/R': 1000, 'Optic/O': 2000}

to include Event markers:

_BV_EVENT_IO_OFFSETS = {'Stimulus/S': 0, 'Event/': 0, 'Response/R': 1000, 'Optic/O': 2000}

all works as expected and I can do

data = mne.io.read_raw_brainvision('data.vhdr')
events, _ = mne.events_from_annotations(data)
event_id = {'fixation': 100,
            'stim_a':   110,
            'stim_b':   120,
            'stim_c':   160,
            'response': 230}
epochs = mne.Epochs(data, events=events, event_id=event_id)

as would be expected.

This was tested with master.

x-ref https://github.com/cbrnr/mnelab/pull/50 cc @ArndalAndersen

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
larsonercommented, Jul 9, 2019

Maybe just modify an existing vhdr file to have Event/ rather than Stimulus/, that way you don’t even need to add a new file (or even a new test, since it should show up the same way)

0reactions
agramfortcommented, Jul 9, 2019

You mean, replacing some existing Stimulus/S markers with Event/?

yes

Read more comments on GitHub >

github_iconTop Results From Across the Web

Importing data from EEG devices — MNE 1.2.2 documentation
Importing data from EEG devices#. MNE includes various functions and utilities for reading EEG data and electrode locations.
Read more >
Brain Vision Recorder | User Manual - TSG Doc
Recorder is intended to be used for recording neuro-/electrophysiological signals (for example EEG,. EMG, ECG, EOG) and/or signals from other ...
Read more >
Tips and tricks to master the Advanced Boolean Expression
The ABE formalism uses logical operators and predefined functions to effectively perform conditional segmentation in BrainVision Analyzer 2.
Read more >
Frequently Asked Questions - Brain Vision
Use the search function below to find answers to commonly asked questions or browse the FAQs by clicking on a category. We are...
Read more >
Cognitive flexibility and N2/P3 event-related brain potentials
The ERP data that we obtained from this study were clear-cut but their explanation was not similarly clear. While separable neural networks for ......
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