# metawards.Infections¶

class metawards.Infections[source]

This class holds the arrays that record the infections as they are occuring during the outbreak

__init__() → None

Initialize self. See help(type(self)) for accurate signature.

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. Initialize self. __init_subclass__ This method is called when a class is subclassed. __le__(value, /) Return self<=value. __lt__(value, /) Return self

Attributes

 N_INF_CLASSES The total number of stages in the disease __dataclass_fields__ __dataclass_params__ __dict__ __doc__ __hash__ __module__ __weakref__ list of weak references to the object (if defined) _stage_mapping The mapping from disease state ‘i’ in this network to disease stage ‘j’ in the overall network. _work_index The index in the overall network’s work matrix of the ith index in this subnetworks work matrix. 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.
property 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
• network (Network) – Network that was used to initialise these infections

• profiler (Profiler, optional) – Profiler used to profile the calculation, by default None

• nthreads (int, optional) – Number of threads to use, by default 1

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
• network (Network or Networks) – The network or networks that will be run

• overall (Network) – The overall network to which this subnet belongs

Returns

infections – The space for the work and play infections for the network (including space for all of the demographics)

Return type

Infections

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

Return the number of work links

property nnodes

The total number of nodes (wards)

property 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]