Brainvision marker parser fails w/ [] characters
See original GitHub issueI have a (perhaps poorly chosen) marker in a file I received,
Mk9=Comment,Discontinuit? [B] 4156 ms,136544,1,0
which at brainvision.py:269
is being found with
items = re.findall(r"^Mk\d+=(.*)", mk_txt, re.MULTILINE)
but this regex stops completely at the [
character, not finding the rest of the line nor the markers which follow.
I’m not a regex ninja but if I manage to fix, I’ll send a PR. In the meantime, I will change remove the offending characters in the file and move on.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
BrainVision Analyzer - TSG Doc
The new Analyzer Automation Reference Manual now includes an extensive theoretical chap- ter that uses short examples to familiarize you with important basic ......
Read more >Brain Vision Analyzer User Manual Version 1.05
The Brain Vision Analyzer software, frequently abbreviated to ... all markers with the same sequence of characters are handled in the.
Read more >All you ever wanted to know about markers in BrainVision ...
Investigating electrophysiological effects requires precisely timed markers. Here is how to manage, edit and process them in Analyzer 2.
Read more >Import Data from Brain Vision Analyzer into Matlab - YouTube
Import Data from Brain Vision Analyzer into Matlab. 865 views 1 year ago. Jonah Kember. Jonah Kember. 127 subscribers. Subscribe.
Read more >mne-python/brainvision.py at main - GitHub
Get annotations from marker file ... Not sure why we special-handle the "," character here, ... likely exported from BrainVision Analyzer?
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You are right @maedoc: https://github.com/mne-tools/mne-python/blob/18755d22c3752b767dd493ffb4ffa5360bd322b4/mne/io/brainvision/brainvision.py#L305-L312
The
r"\[.*\]"
part is being used to find the line where a new section begins like[Marker Infos]
or[Common Infos]
Actually, this points to a very simple fix. Instead of
m = re.search(r"\[.*\]", mk_txt)
we can use^
and$
to get:m = re.search(r"^\[.*\]$", mk_txt)
. This asserts that[Marker Infos]
and other section headers are always written isolated and on a single line (which is true in BrainVision format). Then even your weird markers should be captured 😉see: #5412
@sappelhoff indeed. I just realized that a few lines up from there, there’s a regex for
r"\[.*\]"
that may be the culprit.