Skip to main content

Sapicore

A PyTorch-Based Spiking Neural Network Simulation Framework

Sapicore is a spiking neural network (SNN) simulator, built with PyTorch and designed for neuroscience-inspired models with realistic architectures and dynamics.

We provide a simple API for:

  • Data loading and transformation.
  • Initializing and connecting network components.
  • Extending base neurons (e.g., LIF) and synapses (e.g., STDP).
  • Orchestrating experiment pipelines.
  • Selectively logging intermediate results.
  • Deploying neuromorphic networks as machine learning models.
  • Visualizing, interpreting, and analyzing output.

Users may configure networks in YAML or directly in code. Develop custom neuron, synapse, network, and data loader classes.

We made component extension and customization easy. Default implementations of common models used in computational neuroscience and neuromorphic machine learning applications are provided out of the box.

Sapicore interfaces with industry-standard ML libraries, including scikit-learn.

A project of the Computational Physiology Lab @ Cornell University.


Current Release

Sapicore 0.4 is runtime- and memory-optimized. This beta version includes:

  • Flexible data classes (metadata-based row selection).
  • Spiking neurons (LIF and IZ).
  • Graded neurons (integrators, oscillators).
  • Static and plastic synapses (STDP).
  • Automated network construction and simulation.
  • Scikit-integrated ML model API (fit/predict).
  • Sampling and cross validation tools.
  • Visualization tools.

To simulate a network from a YAML configuration using the default simulation pipeline:

python simple.py -config /path/to/config_file.yaml

See tutorials and tests/engine/network/test_network for instructive scripts and YAML files.


Installation

Basic requirements include Python 3.11+, PyTorch 2.1+, NetworkX, and the scientific stack (numpy, scipy, pandas).

To install the most recent development version:

pip install https://github.com/cplab/sapicore/archive/refs/heads/main.zip

To run tests, change directory to the one containing pytest.ini (sapicore) and call:

pytest -v -s

To run tests with a coverage report, run sapicore/tests/scripts/run_tests.py. The coverage report will be generated in a separate directory on the same level (open index.html).


Development

If you would like to modify or extend this library:

  • Clone the repository:

    git clone https://github.com/cplab/sapicore.git
    
  • Create a conda virtual environment (optional):

    conda create -n <env_name> python=3.11
    conda activate <env_name>
    
  • Change directory to sapicore and install with pip:

    cd sapicore
    pip install -e .
    

This project uses black to format code and flake8 for linting. We support pre-commit. To configure your local environment, install these development dependencies and set up the commit hooks:

pip install black flake8 pre-commit
pre-commit install

Documentation can be compiled by installing Sphinx and RTD, then running docs/refresh.sh. See setup.py for more information.

Citation

If you use Sapicore, please cite it as:

References

For more information about past and ongoing projects utilizing Sapicore, refer to the following publications:

For a dynamical systems perspective on neural computation, temporal coding, and top-down control of sensory processing, the following article may be of interest:

Contributors

Roy Moyal, Matthew Einhorn, Ayon Borthakur, Thomas Cleland.

Metadata

Release files for sapicore 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sapicore 0.4.1
File Size Uploaded Provenance Actions
sapicore-0.4.1.tar.gz 76.7 kB Without provenance Details for sapicore-0.4.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sapicore 0.4.1
File Interpreter ABI Platform Actions
sapicore-0.4.1-py2.py3-none-any.whl Python 3, Python 2 none any Details for sapicore-0.4.1-py2.py3-none-any.whl

Total release size: 171.8 kB

Release files / sapicore-0.4.1.tar.gz

Download URL sapicore-0.4.1.tar.gz
Size 76.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ac5cb5128bd4bcde7e2ca41d5ef36cff8b0bb7a5e9e8d62a07916ee66afab275
BLAKE2b-256 checksum
How to use checksums
ce979479ca7508e0f034d75e005f43303a284788bfe08cf8764e5224d6057e2c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release files / sapicore-0.4.1-py2.py3-none-any.whl

Download URL sapicore-0.4.1-py2.py3-none-any.whl
Size 95.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
64f0fe175abbe67cf4e9c3f3734fc0a3cf6c71db3d2c85fdc61b15ccbef4676e
BLAKE2b-256 checksum
How to use checksums
80fbf6e98dab1a51a0319b45bda9547a264e0282172b7523ac01d74a28b68f52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Security for sapicore 0.4.1

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page