metawards.Demographic

class metawards.Demographic(name: str = None, work_ratio: float = 0.0, play_ratio: float = 0.0, adjustment: metawards._variableset.VariableSet = None)[source]

This class represents a single demographic

__init__(name: str = None, work_ratio: float = 0.0, play_ratio: float = 0.0, adjustment: metawards._variableset.VariableSet = None) → None

Methods

__init__(name, work_ratio, play_ratio, …)
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.
name The name 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.
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

name = None

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

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)