Skip to main content

A python binding of C++ package for stochastic simulations of spatially extended systems

Project description

StoSpa2

Build Status Documentation Status


A Python binding of a C++ software package for stochastic simulations of spatially extended systems, StoSpa2. Code-base has been completely refactored since the previous version of StoSpa. Python bindings have also been included.

Installation

Easy way

pip install pystospa

Hard way

After cloning the following repository

git clone https://github.com/BartoszBartmanski/StoSpa2.git --recursive

do the following

cd StoSpa2
python setup.py install

This way of installing pystospa assumes the following requirements are met

  • scikit-build
  • setuptools
  • wheel
  • cmake
  • (optional) boost - if boost branch of StoSpa2 is used

Example

Let's consider the following chemical reaction

A \rightarrow \emptyset

happening at rate k. The python code for this simulation is as follows

import pystospa as ss

v = ss.Voxel([100], 1.0)
r = ss.Reaction(1.0, lambda x, y : x[0], [-1])
v.add_reaction(r)

s = ss.Simulator([v])
s.run("example.dat", 0.01, 500)

After importing pystospa, we create the voxel and reaction objects with

v = ss.Voxel([100], 1.0)
r = ss.Reaction(1.0, lambda x, y : x[0], [-1])

and then we add the reaction object to the voxel object.

v.add_reaction(r)

And finally, we pass the voxel objects, contained in a list, to a simulator object

s = ss.Simulator([v])
s.run("example.dat", 0.01, 500)

and we invoke the run function of the Simulator class, to run a stochastic simulation saving the state every 0.01 seconds for 500 steps.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

pystospa-2.0.18-cp38-cp38-manylinux2010_x86_64.whl (115.7 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

pystospa-2.0.18-cp37-cp37m-manylinux2010_x86_64.whl (117.0 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

pystospa-2.0.18-cp36-cp36m-manylinux2010_x86_64.whl (117.0 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

pystospa-2.0.18-cp35-cp35m-manylinux2010_x86_64.whl (117.0 kB view hashes)

Uploaded CPython 3.5m manylinux: glibc 2.12+ x86-64

pystospa-2.0.18-cp34-cp34m-manylinux2010_x86_64.whl (117.0 kB view hashes)

Uploaded CPython 3.4m manylinux: glibc 2.12+ x86-64

pystospa-2.0.18-cp27-cp27mu-manylinux2010_x86_64.whl (117.6 kB view hashes)

Uploaded CPython 2.7mu manylinux: glibc 2.12+ x86-64

pystospa-2.0.18-cp27-cp27m-manylinux2010_x86_64.whl (117.6 kB view hashes)

Uploaded CPython 2.7m manylinux: glibc 2.12+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page