[Eeglablist] re-epoching; losing a trial

Andreas Widmann widmann at uni-leipzig.de
Mon May 29 02:31:15 PDT 2017


Hi Yvonne,

I can replicate the problem. The issue occurs if the time range of the new epoch does not include the latency of the corresponding event. Not sure whether this is a bug or unintended usage of the function. I assume the latter as intuitively the time locking event would be expected to be included in the epoch. Various inconsistencies might be observed otherwise. However, this usage should rather result in an error or an empty file (as the problem actually applies to all epochs not only the first) but not a shifted and corrupted event table as observed.

I suggest you report this problem at the bugtracker:
https://sccn.ucsd.edu/bugzilla/
Part of the problem is that in line 141 of epoch() posend overlaps the next epoch (there is a -1 missing) resulting in the shifted event table (event 1 belongs to epoch 2 etc.). Adding the -1 does result in an empty event table as expected, but the data matrix is still not empty and eeg_checkset does not report any problem (even including eventconsistency check). As there might be other side effects I think this should be fixed by the author.

Anyway, a bug fix will presumably only give an error message or empty file in your use case. Thus, to work around the issue I would suggest you try to shift your events on the command line so that they are included by the new epoch limits. Replace the second pop_epoch command by:

tmp = num2cell( [ EEG_all.event.latency ] + 7 * EEG_all.srate );
[ EEG_all.event.latency ] = deal( tmp{ : } )
EEG_all = pop_epoch( EEG_all, labels, [ 0 18 ] );

Note that the epoch limits now refer to the event latencies *shifted by 7 secs*.

Hope this helps! Best,
Andreas

> Am 24.05.2017 um 13:47 schrieb Yvonne Blokland <y.blokland at qmul.ac.uk>:
> 
> Hi all,
> 
> I am not sure if this is a bug or a stupid error on my end:
> I have 25-s epochs, of which I want to use the first 2000ms as baseline, and then ignore the first 5 seconds for analysis.
> As far as I understand this cannot be done in one line of code, so I've done it like this:
> 
> labels = { 'AAAA'  'AAAB'  'AAAC'}
> EEG_all = pop_epoch(EEG, labels, [0  25], 'newname', 'all epochs', 'epochinfo','yes');
> EEG_all = pop_rmbase(EEG_all, [0 2000]);
> EEG_all = pop_epoch(EEG_all, labels, [7 25]);
> 
> 
> Weirdly, when doing this I loose the first trial out of every data set at the last step (So: 80 epochs after removing the baseline, 79 epochs left after re-epoching. It's a different trial every time since randomized).
> 
> Some output:
> 
> EEG.event
> 
> ans = 
> 
> 1x79 struct array with fields:
> 
>     type
>     latency
>     urevent
>     epoch
> 
> EEG.epoch
> 
> ans = 
> 
> 1x80 struct array with fields:
> 
>     event
>     eventtype
>     eventlatency
>     eventurevent
> 
> EEG.epoch.event gives a list of n=1:79 plus an empty one:
> 
> ans =
> 
>    Empty matrix: 1-by-0
> 
> 
> 
> I verified that the same thing happens using the GUI rather than script.
> 
> Does anyone have an idea of what could be going on, and/or is there a better way of getting the epochs I want without epoching twice?
> 
> Many thanks,
> Yvonne
>  
> 
> 
> 
> 
> 
> 
> _______________________________________________
> Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
> To unsubscribe, send an empty email to eeglablist-unsubscribe at sccn.ucsd.edu
> For digest mode, send an email with the subject "set digest mime" to eeglablist-request at sccn.ucsd.edu




More information about the eeglablist mailing list