metawards.Infections¶
-
class
metawards.
Infections
[source]¶ This class holds the arrays that record the infections as they are occuring during the outbreak
-
__init__
() → None¶
Methods
__init__
()aggregate
([profiler])Aggregate all of the infection data from the demographic sub-networks build
(network, …)Construct and return the Infections object that will track infections during a model run on the passed Network (or Networks) clear
(nthreads)Clear all of the infections (resets all to zero) get_stage_mapping
()Return the mapping from disease stages in this sub-network to disease stages in the overall network. get_work_index
()Return the mapping from the index in this sub-networks work matrix to the mapping in the overall network’s work matrix has_different_stage_mapping
()Return whether or not the sub-network disease stages are different to that of the overall network, and must thus be mapped has_different_work_matrix
()Return whether or not the sub-network work matrix is different to that of the overall network Attributes
N_INF_CLASSES
The total number of stages in the disease nlinks
Return the number of work links nnodes
The total number of nodes (wards) nsubnets
Return the number of demographic subnetworks play
The infections caused by random (play) movements. subinfs
The infections for the multi-demographic subnets work
The infections caused by fixed (work) movements. -
N_INF_CLASSES
¶ The total number of stages in the disease
-
aggregate
(profiler=None, nthreads: int = 1) → None[source]¶ Aggregate all of the infection data from the demographic sub-networks
Parameters:
-
static
build
(network: Union[metawards._network.Network, metawards._networks.Networks] = None, overall: metawards._network.Network = None)[source]¶ Construct and return the Infections object that will track infections during a model run on the passed Network (or Networks)
Parameters: Returns: infections – The space for the work and play infections for the network (including space for all of the demographics)
Return type:
-
clear
(nthreads: int = 1)[source]¶ Clear all of the infections (resets all to zero)
Parameters: nthreads (int) – Optionally parallelise this reset by specifying the number of threads to use
-
get_stage_mapping
()[source]¶ Return the mapping from disease stages in this sub-network to disease stages in the overall network. This returns a list where mapping[i] gives the index of stage i in the subnetwork to stage j in the overall network
-
get_work_index
()[source]¶ Return the mapping from the index in this sub-networks work matrix to the mapping in the overall network’s work matrix
-
has_different_stage_mapping
()[source]¶ Return whether or not the sub-network disease stages are different to that of the overall network, and must thus be mapped
-
has_different_work_matrix
()[source]¶ Return whether or not the sub-network work matrix is different to that of the overall network
-
nlinks
¶ Return the number of work links
-
nnodes
¶ The total number of nodes (wards)
-
nsubnets
¶ Return the number of demographic subnetworks
-
play
= None¶ The infections caused by random (play) movements. This is a list of int arrays, size play[N_INF_CLASSES][nnodes+1]
-
subinfs
= None¶ The infections for the multi-demographic subnets
-
work
= None¶ The infections caused by fixed (work) movements. This is a list of int arrays, size work[N_INF_CLASSES][nlinks+1]
-