esinet: Electric Source Imaging using Artificial Neural Networks (ANNs)
esinet let's you solve the EEG inverse problem using ANNs with the mne-python framework. It currently supports three main architectures:
ConvDip
A convolutional neural network as described in our first paper.
Fully-connected network
A fully-connected neural network which is trained on single time instances of M/EEG data. This model was described in our second paper alongside the LSTM.
Long-short term memory network
A Long-short-term memory (LSTM) model which is trained on sequences of EEG data. This model is described in detail and published in our second paper.
Neural network design was created here
Dependencies:
- Python >= 3.8.3
- mne
- Follow the installation guide
- Tensorflow>=2.4.1
- Follow the installation guide
- Colorednoise
- joblib
- pyvista>=0.24
- pyvistaqt>=0.2.0
- tqdm
- dill
- sklearn
Installation from PyPi
Use pip to install esinet and all its dependencies from PyPi:
pip install esinet
Quick start
The following code demonstrates how to use this package:
from esinet import Simulation, Net
from esinet.forward import create_forward_model, get_info
# Create generic Forward Model
info = get_info()
fwd = create_forward_model(info=info, sampling='ico2')
# Simulate M/EEG data
settings = dict(duration_of_trial=0.1)
sim = Simulation(fwd, info, settings=settings)
sim.simulate(n_samples=200)
# Train neural network (LSTM) on the simulated data
net = Net(fwd)
net.fit(sim)
# Plot
stc = net.predict(sim)[0]
sim.source_data[0].plot()
stc.plot()
First steps
Check out one of the tutorials to learn how to use the package:
- Tutorial 1: The fastest way to get started with esinet. This tutorial can be used as an entry point. If you want to dig deeper you should have a look at the next tutorials, too!
- Tutorial 2: Use esinet with low-level functions that allow for more control over your parameters with respect to simulations and training of the neural network.
- Tutorial 3: A demonstration of simulation parameters and how they affect the model performance.
- opm_source: Source imaging of optically pumped magnetometer (OPM) data. The tutorial is based on the one provided by mne
Feedback
Please leave your feedback and bug reports at lukas_hecker@web.de.
Literature
Please cite these publications if you are using this code:
Hecker, L., Rupprecht, R., van Elst, L. T., & Kornmeier, J. (2022). Long-Short Term Memory Networks for Electric Source Imaging with Distributed Dipole Models. bioRxiv.
Hecker, L., Rupprecht, R., Tebartz van Elst, L., & Kornmeier, J. (2021). ConvDip: A convolutional neural network for better EEG Source Imaging. Frontiers in Neuroscience, 15, 533.
Troubleshooting
- Having problems with the installation? Check the package requirements
Metadata
Release files for esinet 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| esinet-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for esinet-0.3.0-py3-none-any.whl |
Release files / esinet-0.3.0-py3-none-any.whl
| Download URL | esinet-0.3.0-py3-none-any.whl |
|---|---|
| Size | 48.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1bde9226e37355c8554ca791a931cbd0800eb9e0912b08e2c095158599bd274b
|
|
BLAKE2b-256 checksum How to use checksums |
5f4aadfbd2a39d895ed385fba57d02be81742aff304a2b4d61f74f8118ec4891
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.9
|
Security for esinet 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.