Blazing-fast simulation of self-organized patterns in reaction-diffusion systems.
Project description
PySpecies
Blazing-fast simulation of advanced 1D 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: Théorie.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
PySpecies-0.1.0.tar.gz
(2.7 kB
view details)
Built Distribution
File details
Details for the file PySpecies-0.1.0.tar.gz
.
File metadata
- Download URL: PySpecies-0.1.0.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d991e39cc3b2bb2d476516b0e684b63357ac8110435c2f74196659ee3323ea82 |
|
MD5 | 2de0c59020a41de34b312091cfe21a0f |
|
BLAKE2b-256 | 54e4018ccc3ea61056ef273ba010049d044e64dd2d7fd40e7cf46bbdde5afc17 |
File details
Details for the file PySpecies-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: PySpecies-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6ed1e341347f98bfb60427b2feff58493221d21417fa31abc569bc56dd718bd |
|
MD5 | 025f95105521097b90ca5220e19ae6c0 |
|
BLAKE2b-256 | b162cbd748db9d76f9b1d76bee48f43aa1de3d319a641a193879c901c2a89ef8 |