metawards.Workspace

class metawards.Workspace(n_inf_classes: int = 0, nnodes: int = 0, inf_tot: List[int] = None, pinf_tot: List[int] = None, n_inf_wards: List[int] = None, total_inf_ward: List[int] = None, total_new_inf_ward: List[int] = None, incidence: List[int] = None)[source]

This class provides a workspace for the running calculation. This pre-allocates all of the memory into arrays, which can then be used via cython memory views

__init__(n_inf_classes: int = 0, nnodes: int = 0, inf_tot: List[int] = None, pinf_tot: List[int] = None, n_inf_wards: List[int] = None, total_inf_ward: List[int] = None, total_new_inf_ward: List[int] = None, incidence: List[int] = None) → None

Methods

__init__(n_inf_classes, nnodes, inf_tot, …)
build(network) Create the workspace needed to run the model for the passed network
zero_all() Reset the values of all of the arrays to zero

Attributes

incidence The incidence of the infection (sum of infections up to disease_class == 2)
inf_tot Size of population in each disease stage for work infections
n_inf_classes Number of disease classes (stages)
n_inf_wards Number of wards with at least one individual in this disease stage
nnodes Number of wards (nodes)
pinf_tot Size of population in each disease stage for play infections
total_inf_ward Total number of infections in each ward over the last day This is also equal to the prevalence
total_new_inf_ward Number of new infections in each ward over the last day
static build(network: metawards._network.Network)[source]

Create the workspace needed to run the model for the passed network

incidence = None

The incidence of the infection (sum of infections up to disease_class == 2)

inf_tot = None

Size of population in each disease stage for work infections

n_inf_classes = 0

Number of disease classes (stages)

n_inf_wards = None

Number of wards with at least one individual in this disease stage

nnodes = 0

Number of wards (nodes)

pinf_tot = None

Size of population in each disease stage for play infections

total_inf_ward = None

Total number of infections in each ward over the last day This is also equal to the prevalence

total_new_inf_ward = None

Number of new infections in each ward over the last day

zero_all()[source]

Reset the values of all of the arrays to zero