Skip to content
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

Reading .vmrk as mne.Annotations: Combine events of individual channels #88

Open
sappelhoff opened this issue May 28, 2022 · 0 comments
Labels
MNE-Python Needs fixing in MNE-Python

Comments

@sappelhoff
Copy link
Member

A .vmrk file may look like this:

Brain Vision Data Exchange Marker File, Version 1.0
;Exported using pybv 0.7.0.dev0

[Common Infos]
Codepage=UTF-8
DataFile=mne_export.vhdr.eeg

[Marker Infos]
; Each entry: Mk<Marker number>=<Type>,<Description>,<Position in data points>,
;             <Size in data points>, <Channel number (0 = marker is related to all channels)>
;             <Date (YYYYMMDDhhmmssuuuuuu)>
; Fields are delimited by commas, some fields might be omitted (empty).
; Commas in type or description text are coded as "\1".
Mk1=Stimulus,S  1,751,250,0
Mk2=Comment,2.50,3251,250,0
Mk3=Response,R101,7501,125,0
Mk4=Comment,Look at this,17501,62,1
Mk5=Comment,And at this,22501,2250,1
Mk6=Comment,And at this,22501,2250,2
  • Note Mk1 up to Mk3: These events are specified for "all channels" (the trailing zero)
  • Note Mk4: This event is specified for the channel with index 1 (1-based indexing)
  • Note Mk5 and Mk6: This is actually one event, but it pertains to several channels (1-based indices 1 and 2) --> We can see this because all information is identical except the trailing "channel number"

Writing the data this way is supported and fine with the BrainVision format.

In MNE-Python however, we may represent Mk5 and Mk6 as a single entry in mne.Annotations, because there, ch_names may be a tuple of channels, for example, the following is the same event information from above but in MNE-Python format:

    annots = mne.Annotations(
        onset=[3, 13, 30, 70, 90],  # seconds
        duration=[1, 1, 0.5, 0.25, 9],  # seconds
        description=[
            "Stimulus/S  1",
            "Stimulus/S2.50",
            "Response/R101",
            "Look at this",
            "Comment/And at this",
        ],
        ch_names=[(), (), (), ("Fp1",), ("Fp1", "Fp2")],
    )

the MNE-Python BV reader should be extended to combine Mk5 and Mk6 from the example above.

@sappelhoff sappelhoff added the MNE-Python Needs fixing in MNE-Python label May 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MNE-Python Needs fixing in MNE-Python
Projects
None yet
Development

No branches or pull requests

1 participant