snnlab
API referencesnnlab.sim

snnlab.sim

Complete API reference for sim, including exports and every declared module API.

Execute graphs, resolve reproducible inputs, train and resume models, authenticate retained artifacts, and compare numerical outputs. Graph-native typed requests and legacy runners have distinct entry points and defaults.

Imports

from snnlab import sim

The package root exports only __version__. Import runtime APIs from their submodules:

from snnlab.sim.execution import ExecutionSpec, simulate, train, infer
from snnlab.sim import models, metrics

Select executor="graph" explicitly in typed graph requests. snnlab.sim.train.train is the separate legacy runner; it is not snnlab.sim.execution.train.

Package exports

ExportDefined in / valueRole
__version__'0.1.0'Component format version; distinct from the combined distribution version.

Modules

ModuleResponsibility
sim.accelerator_forwardBounded forward-only accelerator validation. This check compares graph and legacy forward outputs on the same accelerator under an explicit tolerance policy; it does not cover training, checkpoint trajectories or cross-device equality.
sim.bundleData-only bundle authentication and the deliberately narrow legacy COBANet/training adapter. Graph-native execution is implemented in execution; translating a bundle to legacy settings is not a general graph lowering operation.
sim.configConfiguration, network construction, and simulation runners.
sim.conformanceFail-closed comparison of complete named tensor layers under declared exact or numerical policies. Reports include coverage, shape, dtype and error bounds. This comparison framework does not itself establish scientific acceptance thresholds.
sim.datasetsDataset loaders — MNIST (static images) and SHD (spiking audio events).
sim.encodersEncoders that turn images into spike trains.
sim.executionGraph-native entry points and typed data contracts. Explicitly select executor=graph for typed graph execution; legacy requests route through the established CLI handlers. Inputs use time, batch, feature axes; events use zero-based integer steps. Checkpoints and runtime states authenticate different contracts. All filesystem loaders treat bundles as data rather than importing authoring code.
sim.inferInference driver for the CLI.
sim.inputsSynthetic input generation for PING networks.
sim.metricsReusable analysis functions for SNN spike data.
sim.modelsLegacy model primitives and COBANet. Module globals describe numerical defaults and can be mutated by legacy configuration helpers. They are distinct from graph-authored numerical contracts. COBANet inherits torch.nn.Module; framework methods such as to(), state_dict() and parameters() follow PyTorch's API.
sim.profilingLightweight timing accumulator for the sim / render / encode phases.
sim.runlogLogging and progress utilities for legacy execution commands. Several helpers write to a supplied logger or a process-global event stream; they are operational support rather than neuron-model APIs.
sim.scanScan-mode utilities.
sim.simulation_inputsDeterministically realize authenticated SNNLang simulation recipes.
sim.timingPhysical-time conversion shared by simulation entry points.
sim.toolPING network toolkit — CLI entrypoint.
sim.trainTraining driver for the CLI.

Coverage and conventions

This reference includes every top-level non-private function and class, module-owned constant/type alias, declared public method/property, constructor and relevant protocol special method in the modules above. Data-class constructor fields include local inheritance. Third-party inherited APIs belong to their own libraries; underscore-prefixed implementation helpers are excluded. Imported standard-library and third-party names are not snnlab APIs.

Source docstrings are reproduced as text to preserve their parameter notes, examples, equations and formatting. Explicit exceptions are extracted from the implementation; indirect exceptions can also propagate. Expand the implementation panels for complete branch behavior, especially where legacy code has no annotations.

Regenerate with python3.12 docs/scripts/generate_api.py; --check fails if source-derived reference pages drift. Authored explanatory notes live in docs/scripts/api_notes.json.

On this page