metawards.Demographic

class metawards.Demographic(name: str = None, work_ratio: float = None, play_ratio: float = None, adjustment: metawards._variableset.VariableSet = None, disease: Union[str, metawards._disease.Disease] = None, network: Union[str, metawards._inputfiles.InputFiles] = None)[source]

This class represents a single demographic

__init__(name: str = None, work_ratio: float = None, play_ratio: float = None, adjustment: metawards._variableset.VariableSet = None, disease: Union[str, metawards._disease.Disease] = None, network: Union[str, metawards._inputfiles.InputFiles] = None)[source]

Construct the Demographics

Methods

__init__(name, work_ratio, play_ratio, …) Construct the Demographics
specialise(network[, profiler]) Return a copy of the passed network that has been specialised for this demographic.

Attributes

adjustment How the parameters for this demographic should be changed compared to the parameters used for the whole population.
disease The Disease that should be used for this demographic.
name The name of this demographic.
network The network that describes the workers and player that are part of this demographic.
play_ratio The proportion of “play” (random movement) members in this demographic out of the entire population.
work_ratio The proportion of “work” (fixed movement) members in this demographic out of the entire population.
__init__(name: str = None, work_ratio: float = None, play_ratio: float = None, adjustment: metawards._variableset.VariableSet = None, disease: Union[str, metawards._disease.Disease] = None, network: Union[str, metawards._inputfiles.InputFiles] = None)[source]

Construct the Demographics

__repr__()[source]

Return repr(self).

__str__()[source]

Return str(self).

adjustment = None

How the parameters for this demographic should be changed compared to the parameters used for the whole population. This is currently changed to fixed values, but future developments in VariableSet will support rules for varying relative to the whole population. If this is None then this demographic will have the same parameters as the whole population

disease = None

The Disease that should be used for this demographic. Is this is None, then the global Disease is used. Otherwise this demographic will follow this Disease

name = None

The name of this demographic. This will be used as a label, and should be unique within the Demographics

network = None

The network that describes the workers and player that are part of this demographic. If this is None then the entire population network will be used (scaled by “work_ratio” and “play_ratio”)

play_ratio = 0.0

The proportion of “play” (random movement) members in this demographic out of the entire population. This can also either be a single number, or a list with a value for every ward. Whichever way is used, the sum of “play_ratio” for each demographic must equal 1.0 in each ward (every member of the play population must be represented)

specialise(network: metawards._network.Network, profiler=None, nthreads: int = 1)[source]

Return a copy of the passed network that has been specialised for this demographic. The returned network will contain only members of this demographic, with the parameters of the network adjusted according to the rules of this demographic

Parameters:network (Network) – The network to be specialised
Returns:network – The specialised network
Return type:Network
work_ratio = 0.0

The proportion of “work” (fixed movement) members in this demographic out of the entire population. This can either be a single number, or a list with a value for every ward. Whichever way is used, the sum of “work_ratio” for each demographic must equal 1.0 in each ward (every member of the work population must be represented)