Metadata-Version: 2.4
Name: microcircuit
Version: 0.1
Summary: PyNEST implementation of the cortical microcircuit model of Potjans & Diesmann (2014).
Keywords: neuroscience,computational neuroscience,cortical microcircuit,NEST simulator,neural networks,brain modeling
Author-email: Tom Tetzlaff <t.tetzlaff@fz-juelich.de>, Johanna Senk <j.senk@fz-juelich.de>
Maintainer-email: Tom Tetzlaff <t.tetzlaff@fz-juelich.de>, Johanna Senk <j.senk@fz-juelich.de>
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-Expression: GPL-2.0-or-later
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Classifier: Topic :: Software Development :: Libraries :: Python Modules
License-File: LICENSE
Requires-Dist: docopt-ng
Requires-Dist: matplotlib
Requires-Dist: numpy
Requires-Dist: psutil
Requires-Dist: ruamel.yaml
Requires-Dist: scipy
Requires-Dist: black ; extra == "dev"
Requires-Dist: bump2version ; extra == "dev"
Requires-Dist: flake8 ; extra == "dev"
Requires-Dist: mypy ; extra == "dev"
Requires-Dist: pre-commit ; extra == "dev"
Requires-Dist: pydocstyle ; extra == "dev"
Requires-Dist: pylint ; extra == "dev"
Requires-Dist: pytest ; extra == "dev"
Requires-Dist: pytest-black ; extra == "dev"
Requires-Dist: pytest-cov ; extra == "dev"
Requires-Dist: pytest-flake8 ; extra == "dev"
Requires-Dist: pytest-mypy ; extra == "dev"
Requires-Dist: pytest-pydocstyle ; extra == "dev"
Requires-Dist: pytest-pylint ; extra == "dev"
Requires-Dist: pytest-xdist ; extra == "dev"
Requires-Dist: sphinx ; extra == "doc"
Requires-Dist: sphinx-autodoc-typehints ; extra == "doc"
Requires-Dist: pygments ; extra == "doc"
Requires-Dist: myst-nb ; extra == "doc"
Requires-Dist: sphinx-design ; extra == "doc"
Requires-Dist: sphinx-material ; extra == "doc"
Requires-Dist: sphinx-gallery ; extra == "doc"
Requires-Dist: sphinxcontrib-bibtex ; extra == "doc"
Requires-Dist: recommonmark ; extra == "doc"
Requires-Dist: pydocstyle ; extra == "test"
Requires-Dist: pylint ; extra == "test"
Requires-Dist: pytest ; extra == "test"
Requires-Dist: pytest-black ; extra == "test"
Requires-Dist: pytest-cov ; extra == "test"
Requires-Dist: pytest-flake8 ; extra == "test"
Requires-Dist: pytest-mypy ; extra == "test"
Requires-Dist: pytest-pydocstyle ; extra == "test"
Requires-Dist: pytest-pylint ; extra == "test"
Requires-Dist: pytest-xdist ; extra == "test"
Project-URL: Bug Tracker, https://github.com/INM-6/microcircuit-PD14-model/issues
Project-URL: Changelog, https://github.com/INM-6/microcircuit-PD14-model/releases
Project-URL: Documentation, https://github.com/INM-6/microcircuit-PD14-model/blob/main/README.md
Project-URL: Homepage, https://github.com/INM-6/microcircuit-PD14-model
Project-URL: Repository, https://github.com/INM-6/microcircuit-PD14-model
Provides-Extra: dev
Provides-Extra: doc
Provides-Extra: test

# PyNEST implementation

[![www.python.org](https://img.shields.io/badge/python-3.10-blue.svg)](https://www.python.org) 
<a href="http://www.nest-simulator.org"> <img src="https://github.com/nest/nest-simulator/blob/master/doc/logos/nest-simulated.png" alt="NEST simulated" width="50"/></a> 

## Installing the python package `microcircuit`

The PyNEST implementation of the model is provided in the form of a python package `microcircuit`.

We recommend installing the python package inside a python environment:
- Create a python environment
  ```bash
  python -m venv venv
  ```
- Activate the python environment:
  ```
  source venv/bin/activate
  ```
- Update pip: 
  ```
  pip install -U pip
  ```

The `microcircuit` python package can be installed by 
  ```bash
  git clone https://github.com/inm-6/microcircuit-PD14-model
  pip install microcircuit-PD14-model/PyNEST
  ```
  
or, without cloning the entire repository, by

  ```
  pip install "git+https://github.com/INM-6/microcircuit-PD14-model.git/#egg=microcircuit&subdirectory=PyNEST"
  ```

## Software requirements

- NEST (see [NEST installation](https://nest-simulator.readthedocs.io/en/stable/installation))

  We recommend installing NEST locally within the virtual environment:
  ```bash
  git clone https://github.com/nest/nest-simulator
  ## for a specific <VERSION> (e.g. <VERSION>=v3.9), use
  ## git clone --depth 1 --branch <VERSION> https://github.com/nest/nest-simulator
  cd nest-simulator
  mkdir build
  cd build
  pip install -r ../requirements_pynest.txt
  cmake ..
  make
  make install
  ```
- Python 3.x
- docopt-ng, matplotlib, numpy, psutil, ruamel.yaml, scipy (handled by python package dependencies)

## Testing

Executing
```bash
pytest
```
runs the unit test(s) in `microcircuit-PD14-model/PyNEST/tests`.

## Usage

After installation, the `microcircuit` python package can be imported in a python application using

```python
import microcircuit
```

See [this examples](https://microcircuit-pd14-model.readthedocs.io/en/latest/microcircuit_example.html) for a more detailed illustrations of how the package can be used.

## Memory requirements

| scaling factor (`= N_scaling = K_scaling`)  | Memory    |
|---------------------------------------------|-----------|
| 0.1 (default)                               |  490 MB   |
| 0.2                                         | 1200 MB   |
| 0.5                                         | 4400 MB   |
| 1                                           |   14 GB   |

## Performance benchmarking
Recent performance benchmarking results for the microcircuit model can be found [here](https://nest-simulator.org/documentation/benchmark_results.html).

## Implementation details

This implementation uses the [`iaf_psc_exp`](https://nest-simulator.org/documentation/models/iaf_psc_exp.html) neuron and the [`static_synapse`](https://nest-simulator.org/documentation/models/static_synapse.html) synapse models provided in [NEST]. 
The network is connected according to the [`fixed_total_number`](https://nest-simulator.org/documentation/synapses/connectivity_concepts.html#random-fixed-total-number) connection rule in NEST. 
The neuron dynamics is integrated in a time-driven manner using exact integration with a simulation step size `sim_resolution` [(Rotter & Diesmann, 1999)][1].

The PyNEST implementation runs with [NEST 3.9](https://github.com/nest/nest-simulator.git) [(Terhorst et al., 2025)][2].

### Simulation parameters (defaults)

| Name             | Value            | Description                                                  |
|------------------|------------------|--------------------------------------------------------------|
| `sim_resolution` | 0.1 ms           | simulation time resolution (duration of one simulation step) |
| `t_presim`       | 500 ms           | duration of pre-simulation phase (warm-up)                   |
| `t_sim`          | 1000 ms          | duration of simulation phase                                 |
| `rec_dev`        | `spike_recorder` | recording device                                             |

## References

[1]: <https://doi.org/10.1007/s004220050570> "Rotter & Diesmann (1999). Exact digital simulation of time-invariant linear systems with applications to neuronal modeling. Biological Cybernetics 81(5-6):381-402. doi:10.1007/s004220050570"
[Rotter & Diesmann (1999), Exact digital simulation of time-invariant linear systems with applications to neuronal modeling. Biological Cybernetics 81(5-6):381-402. doi:10.1007/s004220050570](https://doi.org/10.1007/s004220050570)

[2]: <https://doi.org/10.5281/zenodo.17036827> "Terhorst et al. (2025). NEST 3.9. Zenodo. doi:10.5281/zenodo.17036827"
[Terhorst et al. (2025). NEST 3.9. Zenodo. doi:10.5281/zenodo.17036827](https://doi.org/10.5281/zenodo.17036827)

License
-------

[![License: GPL v2](https://img.shields.io/badge/License-GPL%20v2-blue.svg)](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)

This project is licensed under GNU General Public License v2.0 or later.  For details, see [here](https://github.com/INM-6/microcircuit-PD14-model/blob/main/LICENSES/GPL-2.0-or-later.txt).

