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, ward_inf_tot: List[List[int]] = None, total_inf_ward: List[int] = None, total_new_inf_ward: List[int] = None, incidence: List[int] = None, S_in_wards: List[int] = None, E_in_wards: List[int] = None, I_in_wards: List[int] = None, R_in_wards: List[int] = None, X_in_wards: Dict[str, 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, ward_inf_tot: List[List[int]] = None, total_inf_ward: List[int] = None, total_new_inf_ward: List[int] = None, incidence: List[int] = None, S_in_wards: List[int] = None, E_in_wards: List[int] = None, I_in_wards: List[int] = None, R_in_wards: List[int] = None, X_in_wards: Dict[str, List[int]] = None) → None

Methods

__init__(n_inf_classes, nnodes, inf_tot, …)
build(network, metawards._networks.Networks]) Create the workspace needed to run the model for the passed network
zero_all([zero_subspaces]) Reset the values of all of the arrays to zero.

Attributes

E_in_wards The size of the E population in each ward
I_in_wards The size of the I population in each ward
R_in_wards The size of the R population in each ward
S_in_wards The size of the S population in each ward
X_in_wards The sizes of the X populations in each ward - this is for named disease stages that don’t fit into S, E, I or R
incidence The incidence of the infection (sum of infections up to disease_class == I_start)
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
subspaces The sub-workspaces used for the subnets of a multi-demographic Networks (list[Workspace])
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
ward_inf_tot Size of population in each disease stage in each ward
E_in_wards = None

The size of the E population in each ward

I_in_wards = None

The size of the I population in each ward

R_in_wards = None

The size of the R population in each ward

S_in_wards = None

The size of the S population in each ward

X_in_wards = None

The sizes of the X populations in each ward - this is for named disease stages that don’t fit into S, E, I or R

static build(network: Union[metawards._network.Network, metawards._networks.Networks])[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 == I_start)

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

subspaces = None

The sub-workspaces used for the subnets of a multi-demographic Networks (list[Workspace])

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

ward_inf_tot = None

Size of population in each disease stage in each ward

zero_all(zero_subspaces=True)[source]

Reset the values of all of the arrays to zero. By default we zero the subspace networks (change this by setting zero_subspaces to False)