missing event when importing .edf data

Hi mne users!

I'm trying to import epocked data from EEGlab (already preprocessed) in
mne. I used the .edf conversion and the read_raw_edf function to transform
.set and .fdt to fif format.
The data import appears good to me (channels and samples are all here and
correct) and events are syncronised.
However, the number of event readen from raw data is less than the real
number.
(using events = mne.find_events(raw, stim_channel='STI 014'))

Moreover, the event id are '255' instead of 1,2,3 and 4 (the triggers
values). I changed it manualy and then realized that all the event
associated to trigger '1' are missing.

I tried on EEGlab to re-import the .edf file to look if all of the
triggers are well exported, and it seems to be good.

So, what could be the source of this miss of event readen from raw data ?
Is there a way to add the missing events properly ?
And finaly, is there a simplier process to import epocked data from EEGlab ?

Thanks for your help,
Best.

hi Alexandra,

I have no experience with what you're trying to do.

When you say "epocked" you mean multiple trials ? evoked / averaged data?

read_raw_edf is meant to read continuous raw data.

Also you can have a look at the channel STI014 to see what can go wrong.

You may want to paste the commands you typed to do what you want. It
might clarify things on my side.

Best,
Alex

Hi Alexandra,

I've also run into mis-labelled events in the past, and I've found that
some errors could be resolved by using a "mask" in the mne command line
tools. Do you have access to the command line tools? If so I would read
this section of the
manual<http://martinos.org/mne/stable/manual/convert.html#behiaadg>,
on importing from other systems. It sounds like you might need to apply a
mask of 255, (0xff).

Hope this helps.

-Alan

Hi Alan,

Are you currently experiencing any of the masking problems with mne-python?
If so, I could take a look at it and see if that could be resolved.

Best,

Hi Teon,

I haven't really been using mne.find_events on RawEDF objects, since I've
been using the command line tools and exporting text files of the events. I
just ran find_events on a sample RawEDF object and compared the output to
one of the text files. Below is a table, giving the number of each event
types across both methods. In this experiment, the events I'm interested in
are 4, 8, and 128, so both methods produce the same 'relevant' output, but
running find_events on the RawEDF produced more events. I'll have to double
check to see which event ids are actually programmed into biosemi.

ID find_events command line
    0: 0 1
    1: 13 13
    2: 22 22
    3: 3 0
    4: 556 556
    6: 9 0
    7: 107 0
    8: 58 58
  12: 530 23
  14: 213 0
  15: 51 0
128: 100 100
129: 7 0
Total: 1669 773

Can you provide what you are typing into the command line?

Here is the code I use to generate the event textfiles

# Variables
# ------------
# bdf_filename - raw data file
# fif_filename - desired .fif output file
# hpts_filename - textfile in .hpts format specifying electrode locations
# rename_filename - textfile which specifies eog channels and miscellaneous
channels
# raw_filename - desired _raw.fif output file (pre-processed)
# event_filename - desired event text file name

# Convert bdf file to edf file, while importing channel locations
mne_edf2fiff --edf $bdf_filename --fif $fif_filename --hpts $hpts_filename

# Use rename to set EOG and MISC channels
mne_rename_channels --fif $fif_filename --alias $rename_filename

# Filter and downsample the data, this will also extract events
mne_process_raw --raw $fif_filename --decim 8 --filtersize 4192 --lowpass
30 --highpass 1 --eoglowpass 30 --eoghighpass 1 --save $raw_filename
--projoff --digtrig Status --digtrigmask 0xff --eventsout event_filename