Microcircuit Lab is a framework for spiking network models in which every model is defined the same way. Populations, neurons, connections and inputs are set in text files, and one shared core reads and simulates them. No parameter is hard-coded, and nothing specific to one model is mixed into the core.
It is made for networks of spiking neurons, from a single microcircuit to models of several areas. The core runs them in NEST or Brian2 for now. Another simulator can be added as a new backend, within what that simulator supports. More detailed neuron models may also work, as far as the simulator allows.
Documentation: shimoura.github.io/microcircuit-lab: installation, tutorials and guides.
A published network model usually comes with its own simulation code, and the model's choices are spread through it: which data it uses, how a PSP becomes a synaptic current, how the network is scaled down. Before you can check, reuse or compare the model, you have to find them.
Here a network model is a few text files with every number the simulator gets. Write them by hand, or let your own code write them when the numbers come from data (a builder).
flowchart LR
H["<b>You</b><br/>write the files"] --> F
B["<b>Your builder</b><br/>(optional)<br/>writes the files"] -.-> F
F["<b>Network files</b><br/>plain text:<br/>YAML and CSV"] --> C["<b>The core</b><br/>reads, builds<br/>and simulates"]
classDef optional stroke-dasharray: 5 4
class B optional
- The files are what is simulated. Nothing is converted or scaled when the network runs, so you can open the YAML files to read a network, compare it with another, or check it against the paper.
- A builder is optional. Write one when the numbers come from tables or data, or need converting; any code that writes valid files counts. See Builders.
- The core is shared. The checks, the two simulators and the plots are the same for every model, so you can run one network on NEST and on Brian2, and a fix in the core helps every model.
Install the package, make a project folder, and run the toy network:
python -m venv .venv
source .venv/bin/activate
pip install "microcircuit_lab[nest] @ git+https://github.com/shimoura/microcircuit-lab"
microcircuit-lab init my_project --with-core # --with-core (optional): also a copy of the core, to read and change
cd my_project
microcircuit-lab run --network toyThe run is saved in output/toy/<timestamp>/, with its spikes and plots, such as this raster:
Other ways to get NEST (conda-forge, from source), and Brian2: Installation.
| You want to | Read |
|---|---|
| learn step by step | the tutorials: run, change a parameter, write your own network model; then sweeps and comparisons in notebooks |
| run a published model (Potjans & Diesmann 2014, Jiang et al. 2024, the human multi-area model) | examples/, one folder per model; add one to your project with microcircuit-lab init . --example pd14 |
| see what happens when you run | How it works |
| build your own network model | A new network model |
| let code write a network (optional) | Builders |
| run a sweep, several seeds, any batch | Running from a script |
| analyse a run yourself | Analysing a run |
| look up a field of the files | Configuration files |
| change the core | in your project's copy (Your project), or for everyone (CONTRIBUTING.md) |
The whole documentation is at https://shimoura.github.io/microcircuit-lab/, and as Markdown in docs/.
If you use Microcircuit Lab in your work, please cite it. CITATION.cff has the reference; on GitHub, "Cite this repository" in the sidebar gives it in APA and BibTeX. The DOI 10.5281/zenodo.23547742 cites all versions; each release also has its own DOI on Zenodo. Please also cite the papers of the models you use (listed in each example's README).
BSD 3-Clause, see LICENSE.
