keyinst / keypy

Python library for EEG preprocessing, analysis (microstates, spectra) and statistics
Other
18 stars 14 forks source link

About the difference of ERP and EEG #4

Open shizhaoliu opened 6 years ago

shizhaoliu commented 6 years ago

Hi, in your example code it says

### Warning: Do not change ERP = False. Keypy has only been optimized to work with EEG and not ERP data.

And I read your function "find_modmaps" and learned that if ERP is set True, signed value of covariance matrix will be used. (line 361 in modelmaps.py) Could you tell me why we should use unsigned value for EEG while signed value for ERP? Moreover, when I set ERP=True to analysis ERP data, the process of getting mod map became extremely slow. Does this mean keypy can't be used to analysis ERP data?

Ascronia commented 6 years ago

"Could you tell me why we should use unsigned value for EEG while signed value for ERP?"

Traditionally, in microstate analyses of continuous EEG recordings, the polarity of a given electric potential map is disregarded (unsigned value). We assume that the generator of the map is the same across polarity changes of the same map configuration and consequently treat consecutive maps of the same / similar configuration (regardless of polarity) as belonging to the same microstate. We are interested in time points when the driving force of the oscillation changes / change of microstate.

In ERP analyses, we are dealing with time-locked EEG data that were averaged across many data segments. In these time-locked data, the polarity is regarded as meaningful. For example, we are interested in whether a peak at 100 ms is positive or negative (e.g. compared to average reference: P100 vs. N100). For this reason, we distinguish between maps of the "same configuration" that are opposing in polarity, also in the microstate analysis.

I had started implementing the possibility to compute ERP-based microstate analyses with keypy. However, I have not finished this implementation. For this reason, you will find the warning. The consideration of polarity requires several changes in the code (subsequent to the modelmap computation) that are yet to be made.

"Does this mean keypy can't be used to analysis ERP data?"

Yes.

Unfortunately, I do not have the ressources to make these changes / code contributions at this moment. I am happy to let you know once they have been made. Please also feel free to make your own contributions to keypy, should you want to.

Best wishes, Patricia