PySpecies
Blazing-fast simulation of population dynamics, based on the Shigesada-Kawasaki-Teramoto (SKT) reaction-diffusion model. [PubMed '79]
Installation
pip install pyspecies
Usage
For example, the following code computes a solution of the SKT model and converges to a non-homogeneous steady state:
import numpy as np
from pyspecies import models, pop
# Define population and interaction model
q = pop.Pop(
space=(0, 1, 200),
u0=lambda x: 1 + np.cos(2 * np.pi * x),
v0=lambda x: 1 + np.sin(2 * np.pi * x),
model=models.SKT(
D=np.array([[5e-3, 0, 3], [5e-3, 0, 0]]),
R=np.array([[5, 3, 1], [2, 1, 3]])
),
)
# Simulate with increasing speeds
for i in range(-2, 2):
q.sim(duration=2*10**i, N=100)
# Animate the result
q.anim()
# Show the evolution of the population over space and time
# q.heatmap()
# Show the final state of the population (100%)
# q.snapshot(1)
This code displays a cyclic, homogenous solution of the Lotka-Volterra equations:
p = pop.Pop(
space = (0, 1, 10),
u0 = lambda x: 1 + 0*x, # IC for prey
v0 = lambda x: 1 + 0*x, # IC for predator
model = models.LV(1.1, 0.4, 0.4, 0.1)
)
p.sim(duration=20, N=200)
p.sim(duration=100, N=200)
p.anim()
Theory
The calculations underlying this library are described (in French) in the following document.
Metadata
Release files for PySpecies 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| PySpecies-0.1.2.tar.gz | 7.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| PySpecies-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.1 kB
Release files / PySpecies-0.1.2.tar.gz
| Download URL | PySpecies-0.1.2.tar.gz |
|---|---|
| Size | 7.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c95c49aa6fbbcee77d053eaa27a3125400405c48b360dd56b68c044119a0878d
|
|
BLAKE2b-256 checksum How to use checksums |
500e11fd99d6cd1f85a7dc993c5d3e533c5d2ff7bce9636f32cdfd7fcc74f533
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.10
|
Release files / PySpecies-0.1.2-py3-none-any.whl
| Download URL | PySpecies-0.1.2-py3-none-any.whl |
|---|---|
| Size | 9.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2b12dc3d41de8848989931c8db538ba5086ca4db4835ecd283ab4d72cbb0dd62
|
|
BLAKE2b-256 checksum How to use checksums |
0e17d2de642c1a811c2ffcf0656e65b5d92e508dc840795ada3ec86690d6f51e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.10
|