ucdavis / erplab

ERPLAB Toolbox is a free, open-source Matlab package for analyzing ERP data. It is tightly integrated with EEGLAB Toolbox, extending EEGLAB’s capabilities to provide robust, industrial-strength tools for ERP processing, visualization, and analysis. A graphical user interface makes it easy for beginners to learn, and Matlab scripting provides enormous power for intermediate and advanced users.
http://erpinfo.org/erplab
267 stars 73 forks source link

overlapping event latency in epoch2continuous #126

Open anomalosepia opened 4 years ago

anomalosepia commented 4 years ago

Description

I don't think that this has been raised yet. If you are converting epoched to continuous and there are events with the same latency in the EEG.event.latency, you lose all but the first event (in the order in the latency struct) during the conversion. This is silent and doesn't raise errors or warnings.

]


Steps to Reproduce

  1. Get some continuous data with event structure that looks something like below. This is from EGI netstation so the data can get kind of mangled along the way.
duration type latency epoch urevent
600 Scrt' 99601 167 602
1 rscrt' 99685 167 603
0 'TRSP' 100193 167 604
0 'TRSP' 100201 168 605
600 'Fix' 100201 168 606
0 'bgin' 100274 168 607
0 'fix+' 100284 168 608
  1. run this on your data EEG = epoch2continuous(EEG)

  2. the resulting structure will not have the 'Fix' event at 100201 because line 27 in epoch2continuous only takes the first event at any given latency

[xlat, indx] = unique_bc2([EEG.event.latency], 'first');

in my case I was able to change that to

[xlat, indx] = unique_bc2([EEG.event.latency], 'last');

but that's only for the very narrow case of the data that I have here.


Expected behavior:

I expected all the events to carry over from the epoched data to the continuous, with boundary event. data


Actual behavior:

Only the first event comes over.


Versions

OS version mac os x catalina
Matlab version 2018b
EEGLAB version 2019.1
ERPLAB version 7.0
andrewxstewart commented 4 years ago

Thanks for reporting this bug with epoch2continuous.

I'll take a look at this.

anomalosepia commented 4 years ago

Thank you! I just removed the requirement for unique latencies and it seems to be sorted out. Still checking though. A

Sent from my iPhone

On Feb 14, 2020, at 5:42 PM, Andrew X Stewart notifications@github.com wrote:

 Thanks for reporting this bug with epoch2continuous.

I'll take a look at this.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.