A Python library for simulating EEG readings

What’s EEG?

An electroencephalogram (EEG) is a test used to evaluate the electrical activity in the brain. … An EEG can be used to help detect potential problems associated with this activity. An EEG tracks and records brain wave patterns. Small flat metal discs called electrodes are attached to the scalp with wires.

Source: https://www.healthline.com/health/eeg

What is meant by simulation?

Simulation is simply an imitation of a situation or of a process. You don’t need to re-create the situation or apply the process in actual, you can just simulate it to know the aftermaths.

Why do we need a simulation of our brain’s EEG?

If not simulation, live subjects would be used to capture EEG readings(for experiments). This method is costly, inefficient, time-consuming and not scalable.

Does there exist any EEG simulator?
Yes, tonnes of it. I developed one which uses Kinetic LGN model.

Let me make you go through Kinetic LGN model first(you need to understand the basic components of the brain if you don’t know them already, read here).

Kinetic LGN Model

With this model, you can simulate brain’s EEG readings by configuring various inputs, you can mimic brain’s healthy and diseased rhythms in different states(like readings, fear, fright, flight, gaming, etc)

My target market is the community of researchers and developers.

Now, comes the library:

There are a total of 3 steps in this library:

i) running the simulation

ii) altering the EEG signals of source EEG to reach the target EEG readings

iii) plotting the readings for the researcher’s eye; to detect if something abnormal shows up, sorta testing your outputs

There is also a module which would do the preprocessing for you.

A brief explanation:

Altering the EEG signals:

To alter the EEG signals generated by the simulation model to match with the standard EEG data so as to compare the simulated output EEG readings with the standard ones.

Running Tests:

Plots standard and simulated EEG readings, for the user to test hooks and nooks.


Cleans the standard EEG data, the one with which we want to match the sample and the simulated readings.

The first module created:


Implements the Kinetic LGN Model, runs the simulations.

Future Scope:

I would like to see this library being used in mimicking the brain’s rhythms, somewhat imitating how the brain learns. (Thanks to Utkarsh!)

The library is available on Github.

Credit should be given where it is due:

Apart from the research papers and their authors, I would like to thank Utkarsh Shukla and Aditya Sathe. The former one co-created this library with me while the latter one implemented the same model for another part of the brain. I would also like to thank Paras Chopra and Prastut Kumar for encouraging me to open source this. Lastly but not at all the least, I thank Varun Banka who dedicated hours for me to create a powerful pitch of this library for various conferences (Medhacks and Hackinout) that I had participated in.

Code + Data.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store