Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

simple rule-based stochastic simulation

Project description

# stocal

A python framework for regular and rule-based stochastic simulations.

## What is Stocal?

Stocal is a framework for stochastic simulation of continuous
time Markov processes (also known as [Gillespie simulations](

Features of stocal:
* support for reactions of any order
* support for unique and periodic (deterministic) events
* support for time-dependent reaction rates
* support for rules that generate novel reactions on the fly
* support for complex chemical states

Stocal works with python version 2.7 as well as version 3.5.

### Basic Usage

Running a simple stochastic simulation is straight forward:
import stocal

# Define a stochastic process
process = stocal.Process([
stocal.MassAction({'A': 2}, {'A2': 1}, 1.0),
stocal.MassAction({'A2': 1}, {'A': 2}, 10.0),
stocal.Event({}, {'A': 100}, 0.0, frequency=10.0),

# Sample a stochastic trajectory of the process
initial_state = {}
trajectory = process.sample(initial_state, tmax=100) :
for dt, transitions in trajectory:
print trajectory.time, trajectory.state['A2']

### API / Tutorial

A tutorial on how to use stocal can be found [here](
Various usage examples are provided in stocal/examples.
The package API is thoroughly documented and can be accessed through
pydoc. The behavior of stocal is specified via tests. The test suite
can be run with `python test`.

### Installation

The latest stable release of stocal is available from the python package index:
pip install stocal
The development version can be obtained from github using the following commands:
git clone
cd stocal
git checkout develop
sudo python install

## Issue Reporting and Contributing

Please post any issues that might occur with stocal on the
<a href="">github issue
If you are interested in contributing to stocal, pull requests
and any other inquiries will be dealt with as soon as possible.

## License

Stocal is distributed under the MIT Software license.
(c) 2018 Harold Fellermann

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for stocal, version 1.2
Filename, size File type Python version Upload date Hashes
Filename, size stocal-1.2.tar.gz (68.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page