The brain's electric field configuration reflects its momentary, global functional state. The fluctuations of these states can be analyzed at millisecond resolution by the EEG microstate analysis. This analysis reportedly allowed the detection of brain state duration, occurrence, and sequence aberrations in psychiatric disorders such as schizophrenia, dementia, and depression. Several existing software solutions implement the microstate analysis, but they all require extensive user-interaction. This represents a major obstacle to time-efficient automated analyses and parameter exploration of large EEG datasets. Scriptable programming languages such as Python provide a means to efficiently automate such analysis workflows.
For this reason, I developed the KEY EEG Python Library keypy. This library implements all steps necessary to compute the microstate analysis based on artefact free segments of EEG. It includes functions to carry out the necessary preprocessing (data loading, filtering, average referencing), modified k-means clustering based microstate identification, principal component based mean computation (across recording runs, conditions, participants, and or participant groups), and to retrieve the microstate class based statistics necessary to compare microstate parameters between groups and/or conditions. Keypy is an open source library and freely available from https://www.github.com/keyinst/keypy.
Keypy provides a platform for automated microstate analysis of large-scale EEG datasets from psychiatric patient populations and their comparison to healthy controls. It is easily applicable and allows efficient identification of deviant brain states in clinical conditions.
Disclosure of interest
The authors have not supplied their declaration of competing interest.