-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Skip first "New Segment" BrainVision marker #13100
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a note that I did agree to this change under the assumption that "New Segment" markers are now interpreted as BAD_ACQ_SKIP
events (see #13095 (comment)). Which would have been a principled way of interpreting "New Segment" markers.
However, with the current changes, we are just removing the first marker.
It makes me a bit uncomfortable that we are basically taking events that are in the file and deciding which ones are irrelevant and which ones aren't. This should be a user choice, and we have very straight forward ways of filtering which events to keep and which not (proper use of event_id
).
There are also several other events that are commonly not used, like Mk2=Comment,ControlBox is not connected via USB,41,1,0
, see for example https://gin.g-node.org/sappelhoff/mpib_ecomp_sourcedata/src/master/sub-01/dual/sub-01_stream-dual.vmrk#L13 -- why would we then not remove those, too?
I think the answer is simple: we are not discarding the information contained in this first New Segment marker (the recording time), whereas there would be no other place to store the information from that other example you're mentioning. |
But yes, I'm also fine with converting all New Segment markers to BAD_ACQ_SKIP, but where would we store the datetime in those later markers then? We'd be losing information, which we should avoid. |
yes, the logic is solid. Maybe this comes down to my personal preference of having the annotations in mne correspond to what I can see when opening my VMRK file in a code editor. But I realize that probably a minority of users feel this way, so ok from me to go ahead with it. |
mne/io/brainvision/brainvision.py
Outdated
Names of channels or list of indices that should be designated | ||
EOG channels. Values should correspond to the header file. | ||
Default is ``('HEOGL', 'HEOGR', 'VEOGb')``. | ||
eog : list or tuple of str |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert. This makes it sound like "list of str or tuple of str" but "list of int" is also supported
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied it from the function, so this should be changed there as well then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I replaced it with something more explicit, I hope this is fine now. It's also in the description of the misc
parameter now (which I didn't touch before).
mne/io/brainvision/brainvision.py
Outdated
onset = np.array(onset, dtype=float) / sfreq | ||
duration = np.array(duration, dtype=float) / sfreq | ||
if ignore_marker_types: | ||
description = [d.split("/")[-1] for d in description] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need a maxsplit=1
here? Can the text after the market tour marker type ever contain a slash?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically both BrainVision marker types and descriptions can contain /
, which would break our logic here. However, maxsplit=1
doesn't save us, because there could be one or more /
in the description. Currently, we work under the assumption that neither the type nor the description of a marker contains a /
. If we want to be on the safe side, we should replace all /
before converting to annotations, after which maxsplit=1
is not necessary anymore. Do you want me to do this here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wouldn't this be a possible regression then? The old way which did:
if not ignore_marker_types:
description.append(mtype + "/" + mdesc)
else:
description.append(mdesc)
didn't have a problem handling markers or descriptions that contained /
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are absolutely right! I implemented a more robust version, LMK if you're happy with it.
981a53d
to
20cbdc5
Compare
Fixes #13095. This PR skips the first "New Segment" BrainVision marker, as it only contains the recording time (which is already available in
info["meas_date"]
). I decided to not do anything with subsequent "New Segment" markers, as such changes could be unexpected.