Skip to main content

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]

Population dynamics simulation

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


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.1.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

PySpecies-0.1.1-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file PySpecies-0.1.1.tar.gz.

File metadata

  • Download URL: PySpecies-0.1.1.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for PySpecies-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0b171aedbc09582d305601411bfa2bca0eb0ee0a54bc29b2aa7152c992685924
MD5 f29cbd97710e9ada950815220aab9277
BLAKE2b-256 cebbba751453240416745992d6f1acfcb0cb28c3f846a8377f246be6aed3f6c9

See more details on using hashes here.

File details

Details for the file PySpecies-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: PySpecies-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for PySpecies-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4b598183a03885ecbdf8ac32a1ccca95953d54784b780306d93ac0f34403bfae
MD5 d1bd3635775ea7f2fb41e125138fb296
BLAKE2b-256 07d504c4513d324c785730de20e2b7b0eae9d9141922a82b880fb1c4745a2649

See more details on using hashes here.

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