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
MRG eeglab .set reader #2676
MRG eeglab .set reader #2676
Conversation
2f5bced
to
c46bb00
Compare
@@ -107,6 +107,7 @@ Functions: | |||
read_raw_edf | |||
read_raw_kit | |||
read_raw_nicolet | |||
read_raw_set |
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.
read_raw_eeglab ?
okay guys, we have |
# get info | ||
if ch_fname is not None: | ||
ch_fname = op.join(basedir, ch_fname) | ||
info = _get_info(eeg, eog, ch_fname) |
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.
Many set files already contain channel information. You can check eeg.chanlocs
to see if it is true.
eeg.chanlocs
is a matlab structure with following fields: labels
, Y
, X
, Z
, sph_theta
, sph_phi
, sph_radius
, theta
, radius
, type
, ref
, urchan
. If channel positions are present - all coordinate fields should be filled. labels
contains channel names.
For example in matlab:
EEG.chanlocs(5)
gives:
ans =
labels: 'E5'
Y: -3.0769
X: 10.1424
Z: 1.2423
sph_theta: -16.8763
sph_phi: 6.6854
sph_radius: 10.6714
theta: 16.8763
radius: 0.4629
type: ''
ref: 'average'
urchan: 5
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.
Maybe you have an example file?
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.
Yes, here is a Dropbox link:
https://www.dropbox.com/sh/4jl2bki7o6rqtmt/AAACrmfO8VtfqQc9mEjtIDIoa?dl=0
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.
cool, I'll check
------- | ||
raw : Instance of RawSet | ||
A Raw object containing EEGLAB .set data. | ||
""" |
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.
add Notes
section with versionadded
directive
Those files add ~4MB to the repo. I think I'd rather put them in the |
@jasmainak there is no way to get segments of data using |
def test_io_set(): | ||
"""Test importing EEGLAB .set files""" | ||
_test_raw_reader(read_raw_set, True, fname=fname, | ||
ch_fname=ch_fname) |
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.
Don't forget to test degenerate cases like not ch_fname.endswith('.locs')
as well
@Eric89GXL I was thinking maybe we could use |
@Eric89GXL yeah the files are large at the moment. We can replace them with smaller files when we are closer to merging. That is why it's a separate commit. I'll overwrite the commit. |
We could fseek and read if you can figure out how the data are actually stored in the |
80dac1c
to
1a05244
Compare
@agramfort comments addressed |
merged by rebase after my cosmit to force upper case. |
thanks heaps @jasmainak ! |
Wanna make an announcement on the EEGLAB mailing list? :) |
|
awesome, looks like I missed a lot of action in a few hours AFK :) Thanks for the reviews |
thanks @jasmainak! this is awesome. i know plenty of colleagues who would love to hear about this |
Okay this is possibly a stupid question, but how do I access events for a raw file? From reading the docs or code, I can't see where that would be handled, and there is no stim channel in the resulting object. |
I think you will have to use I don't think you can have In the meanwhile. maybe you could artificially create a stim channel (if there isn't one) from the events in Matlab and add it to the data? |
if the events are in the .set files we should add a stim_channel
automatically. That's how it's done in edf for example.
are events in .set files?
|
yeah, I think they will be there in the .set file. The problem however is that you don't always know the duration of the events. So, generating the stim channel from the events is an ill posed problem ;) I think the events annotation we have discussed is the correct way to go about it. It will solve many problems at once. |
In the brainvision reader, if we don't know the length, we just set them to zero. The problem is rather that EEGLAB has much richer event handling, including arbitrary strings as names. (Stimulus channels are not the EEGLAB way. Something I have to add to my EEGLAB switcher docs. @jasmainak where should I put that file btw?) |
@jona-sassenhagen feel free to share it by email or FB message as you've done previously. |
I'll try to make a PR asap. Just tell me what file to put it into. |
ah, sorry I misunderstood your question. I think it should go to the manual. A file in |
i agree, there should be an auto detection option for the trigger, especially if this is in the release. all the readers have one, even it's a simplified version. as @jona-sassenhagen mentioned, if the duration is unknown we give it a duration of a sample. |
I already made a PR Teon :) I'm not sure how to create a trigger channel though, I'm too stupid to figure out that part of the BV code. |
follow up to this pr: #2745 I'll join in over there |
closes #2672
very much WIP and works only for the sample data provided by EEGLAB at the moment. If anyone has files to share, I'd be happy to try them.
TODOs
raw
set
fileset
file.dat
file