epymorph.data.mm.pei
Commuters
Bases: MovementClause
The commuter clause of the pei model.
requirements
class-attribute
instance-attribute
requirements = (
_COMMUTERS_ATTRIB,
AttributeDef(
"move_control",
float,
Scalar,
default_value=0.9,
comment="A factor which modulates the number of commuters by conducting a binomial draw with this probability and the expected commuters from the commuters matrix.",
),
)
The attribute definitions describing the data requirements for this function.
For advanced use-cases, you may specify requirements as a property if you need it to be dynamically computed.
predicate
class-attribute
instance-attribute
predicate = EveryDay()
When does this movement clause apply?
leaves
class-attribute
instance-attribute
leaves = TickIndex(step=0)
On which tau step does this movement clause apply?
returns
class-attribute
instance-attribute
returns = TickDelta(step=1, days=0)
When do the movers from this clause return home?
commuters_by_node
cached
property
Total commuters living in each state.
commuting_probability
cached
property
Commuters as a ratio to the total commuters living in that state. For cases where there are no commuters, avoid div-by-0 errors
evaluate
Implement this method to provide logic for the clause. Use self methods and properties to access the simulation context or defer processing to another function.
Parameters:
-
tick
(Tick
) –The simulation tick being evaluated.
Returns:
Dispersers
Bases: MovementClause
The dispersers clause of the pei model.
requirements
class-attribute
instance-attribute
requirements = (
_COMMUTERS_ATTRIB,
AttributeDef(
"theta",
float,
Scalar,
default_value=0.1,
comment="A factor which allows for randomized movement by conducting a poisson draw with this factor times the average number of commuters between two nodes from the commuters matrix.",
),
)
The attribute definitions describing the data requirements for this function.
For advanced use-cases, you may specify requirements as a property if you need it to be dynamically computed.
predicate
class-attribute
instance-attribute
predicate = EveryDay()
When does this movement clause apply?
leaves
class-attribute
instance-attribute
leaves = TickIndex(step=0)
On which tau step does this movement clause apply?
returns
class-attribute
instance-attribute
returns = TickDelta(step=1, days=0)
When do the movers from this clause return home?
commuters_average
cached
property
Average commuters between locations.
evaluate
Implement this method to provide logic for the clause. Use self methods and properties to access the simulation context or defer processing to another function.
Parameters:
-
tick
(Tick
) –The simulation tick being evaluated.
Returns:
Pei
Bases: MovementModel
Modeled after the Pei influenza paper, this model simulates two types of movers -- regular commuters and more-randomized dispersers. Each is somewhat stochastic but adhere to the general shape dictated by the commuters array. Both kinds of movement can be "tuned" through their respective parameters: move_control and theta.
clauses
class-attribute
instance-attribute
clauses = (Commuters(), Dispersers())
The movement clauses that make up the model.