metawards.Workspace

class metawards.Workspace(n_inf_classes: int = 0, nnodes: int = 0, inf_tot: Optional[List[int]] = None, pinf_tot: Optional[List[int]] = None, n_inf_wards: Optional[List[int]] = None, ward_inf_tot: Optional[List[List[int]]] = None, total_inf_ward: Optional[List[int]] = None, total_new_inf_ward: Optional[List[int]] = None, incidence: Optional[List[int]] = None, S_in_wards: Optional[List[int]] = None, E_in_wards: Optional[List[int]] = None, I_in_wards: Optional[List[int]] = None, R_in_wards: Optional[List[int]] = None, X_in_wards: Optional[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: Optional[List[int]] = None, pinf_tot: Optional[List[int]] = None, n_inf_wards: Optional[List[int]] = None, ward_inf_tot: Optional[List[List[int]]] = None, total_inf_ward: Optional[List[int]] = None, total_new_inf_ward: Optional[List[int]] = None, incidence: Optional[List[int]] = None, S_in_wards: Optional[List[int]] = None, E_in_wards: Optional[List[int]] = None, I_in_wards: Optional[List[int]] = None, R_in_wards: Optional[List[int]] = None, X_in_wards: Optional[Dict[str, List[int]]] = None) None

Methods

__delattr__(name, /)

Implement delattr(self, name).

__dir__()

Default dir() implementation.

__eq__(other)

Return self==value.

__format__(format_spec, /)

Default object formatter.

__ge__(value, /)

Return self>=value.

__getattribute__(name, /)

Return getattr(self, name).

__gt__(value, /)

Return self>value.

__init__([n_inf_classes, nnodes, inf_tot, ...])

__init_subclass__

This method is called when a class is subclassed.

__le__(value, /)

Return self<=value.

__lt__(value, /)

Return self<value.

__ne__(value, /)

Return self!=value.

__new__(**kwargs)

__reduce__()

Helper for pickle.

__reduce_ex__(protocol, /)

Helper for pickle.

__repr__()

Return repr(self).

__setattr__(name, value, /)

Implement setattr(self, name, value).

__sizeof__()

Size of object in memory, in bytes.

__str__()

Return str(self).

__subclasshook__

Abstract classes can override this to customize issubclass().

build(network)

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

__annotations__

__dataclass_fields__

__dataclass_params__

__dict__

__doc__

__hash__

__module__

__weakref__

list of weak references to the object (if defined)

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: List[int] = None

The size of the E population in each ward

I_in_wards: List[int] = None

The size of the I population in each ward

R_in_wards: List[int] = None

The size of the R population in each ward

S_in_wards: List[int] = None

The size of the S population in each ward

X_in_wards: Dict[str, List[int]] = 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

__eq__(other)

Return self==value.

__hash__ = None
__init__(n_inf_classes: int = 0, nnodes: int = 0, inf_tot: Optional[List[int]] = None, pinf_tot: Optional[List[int]] = None, n_inf_wards: Optional[List[int]] = None, ward_inf_tot: Optional[List[List[int]]] = None, total_inf_ward: Optional[List[int]] = None, total_new_inf_ward: Optional[List[int]] = None, incidence: Optional[List[int]] = None, S_in_wards: Optional[List[int]] = None, E_in_wards: Optional[List[int]] = None, I_in_wards: Optional[List[int]] = None, R_in_wards: Optional[List[int]] = None, X_in_wards: Optional[Dict[str, List[int]]] = None) None
__repr__()

Return repr(self).

static build(network: Union[metawards._network.Network, metawards._networks.Networks])[source]

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

incidence: List[int] = None

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

inf_tot: List[int] = None

Size of population in each disease stage for work infections

n_inf_classes: int = 0

Number of disease classes (stages)

n_inf_wards: List[int] = None

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

nnodes: int = 0

Number of wards (nodes)

pinf_tot: List[int] = 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: List[int] = None

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

total_new_inf_ward: List[int] = None

Number of new infections in each ward over the last day

ward_inf_tot: List[List[int]] = 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)