Package sir_ddft

Python bindings for the SIR DDFT library.

For a detailed documentation please consult the documentation of the Rust implementation. This document is only meant to document the nature of the Python bindings.

Expand source code
from .sir_ddft import *

__doc__ = sir_ddft.__doc__
if hasattr(sir_ddft, "__all__"):
    __all__ = sir_ddft.__all__

Sub-modules

sir_ddft.sir_ddft

Python bindings for the SIR DDFT library …

Classes

class Grid1D (...)

Grid in 1D

Methods

def new_equidistant(xlo, xhi, n)

Create an equidistant grid of n points in 1D ranging from xlo to xhi (inclusive)

class Grid2D (...)

Grid in 2D

Methods

def new_equidistant(xlo, xhi, ylo, yhi, nx, ny)

Create an equidistant grid of nx and ny points in 2D ranging from xlo to xhi (inclusive) and ylo to yhi (inclusive) in x and y respectively

class SIRDDFT1DSolver (sir_parameters, diffusion_parameters, ddft_parameters, state_1d, num_threads)

Solver for the 1D SIR DDFT model

Methods

def add_time(time)

Add time to the total integration time

def get_result()

Get result of integration

def integrate()

Integrate to the current integration time

class SIRDDFT2DSolver (sir_parameters, diffusion_parameters, ddft_parameters, state_2d, num_threads)

Solver for the 2D SIR DDFT model

Methods

def add_time(time)

Add time to the total integration time

def get_result()

Get result of integration

def integrate()

Integrate to the current integration time

class SIRDDFTParameters (mobility_S, mobility_I, mobility_R, social_distancing_amplitude, social_distancing_range, self_isolation_amplitude, self_isolation_range)

Instance variables

var mobility_I

Return an attribute of instance, which is of type owner.

var mobility_R

Return an attribute of instance, which is of type owner.

var mobility_S

Return an attribute of instance, which is of type owner.

var self_isolation_amplitude

Return an attribute of instance, which is of type owner.

var self_isolation_range

Return an attribute of instance, which is of type owner.

var social_distancing_amplitude

Return an attribute of instance, which is of type owner.

var social_distancing_range

Return an attribute of instance, which is of type owner.

class SIRDiffusion1DSolver (sir_parameters, diffusion_parameters, state_1d)

Solver for the 1D SIR model with diffusion

Methods

def add_time(time)

Add time to the total integration time

def get_result()

Get result of integration

def integrate()

Integrate to the current integration time

class SIRDiffusion2DSolver (sir_parameters, diffusion_parameters, state_2d)

Solver for the 2D SIR model with diffusion

Methods

def add_time(time)

Add time to the total integration time

def get_result()

Get result of integration

def integrate()

Integrate to the current integration time

class SIRDiffusionParameters (diffusivity_S, diffusivity_I, diffusivity_R)

Instance variables

var diffusivity_I

Return an attribute of instance, which is of type owner.

var diffusivity_R

Return an attribute of instance, which is of type owner.

var diffusivity_S

Return an attribute of instance, which is of type owner.

class SIRParameters (infection_parameter, recovery_rate, mortality_rate)

Instance variables

var infection_parameter

Return an attribute of instance, which is of type owner.

var mortality_rate

Return an attribute of instance, which is of type owner.

var recovery_rate

Return an attribute of instance, which is of type owner.

class SIRSolver (params, state)

Solver for the SIR model

Methods

def add_time(time)

Add time to the total integration time

def get_result()

Get result of integration

def integrate()

Integrate to the current integration time

class SIRState (...)

State vector of the SIR model

Instance variables

var I

Infected population

var R

Recovered population

var S

Susceptible population

class SIRStateSpatial1D (grid, initfunc)

State vector for spatial SIR models in 1D

To create the initial state, a Grid1D as well as an initializer function initfunc are required. The initializer function takes the grid position x as its sole argument and must return an array of three floats (!) representing the value of the S, I and R fields at this point respectively

Instance variables

var I

State vector of infected population

var R

State vector of recovered population

var S

State vector of susceptible population

class SIRStateSpatial2D (grid, initfunc)

State vector for spatial SIR models in 2D

To create the initial state, a Grid2D as well as an initializer function initfunc are required. The initializer function takes the grid position x and y as its arguments and must return an array of three floats (!) representing the value of the S, I and R fields at this point respectively

Instance variables

var I

State vector of infected population (note: this is 1D, so you might want to reshape this before plotting)

var R

State vector of recovered population (note: this is 1D, so you might want to reshape this before plotting)

var S

State vector of susceptible population (note: this is 1D, so you might want to reshape this before plotting)

class SZDDFT2DSolver (sir_parameters, diffusion_parameters, ddft_parameters, state_2d, num_threads)

Solver for the 2D SIR DDFT model

Methods

def add_time(time)

Add time to the total integration time

def get_result()

Get result of integration

def integrate()

Integrate to the current integration time

class SZDDFTParameters (mobility_S, mobility_Z, fear_amplitude, fear_range, hunger_amplitude, hunger_range)

Instance variables

var fear_amplitude

Return an attribute of instance, which is of type owner.

var fear_range

Return an attribute of instance, which is of type owner.

var hunger_amplitude

Return an attribute of instance, which is of type owner.

var hunger_range

Return an attribute of instance, which is of type owner.

var mobility_S

Return an attribute of instance, which is of type owner.

var mobility_Z

Return an attribute of instance, which is of type owner.

class SZDiffusionParameters (diffusivity_S, diffusivity_Z)

Instance variables

var diffusivity_S

Return an attribute of instance, which is of type owner.

var diffusivity_Z

Return an attribute of instance, which is of type owner.

class SZParameters (bite_parameter, kill_parameter)

Instance variables

var bite_parameter

Return an attribute of instance, which is of type owner.

var kill_parameter

Return an attribute of instance, which is of type owner.

class SZStateSpatial2D (grid, initfunc)

State vector for spatial SZ models in 2D

To create the initial state, a Grid2D as well as an initializer function initfunc are required. The initializer function takes the grid position x and y as its arguments and must return an array of two floats (!) representing the value of the S and Z fields at this point respectively

Instance variables

var S

State vector of susceptible population (note: this is 1D, so you might want to reshape this before plotting)

var Z

State vector of infected population (note: this is 1D, so you might want to reshape this before plotting)