epymorph.data.mm.sparsemod
SparsemodClause
Bases: MovementClause
The clause of the sparsemod model.
requirements
class-attribute
instance-attribute
requirements = (
AttributeDef(
"commuters",
int,
NxN,
comment="A node-to-node commuters marix.",
),
AttributeDef(
"centroid",
CentroidType,
N,
comment="The centroids for each node as (longitude, latitude) tuples.",
),
AttributeDef(
"phi",
float,
Scalar,
default_value=40.0,
comment="Influences the distance that movers tend to travel.",
),
)
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
The number of commuters that live in any particular node (regardless of typical commuting destination).
dispersal_kernel
cached
property
The NxN matrix or dispersal kernel describing the tendency for movers to move to a particular location. In this model, the kernel is: 1 / e ^ (distance / phi) which is then row-normalized.
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:
Sparsemod
Bases: MovementModel
Modeled after the SPARSEMOD COVID-19 paper, this model simulates movement using a distance kernel parameterized by phi, and using a commuters matrix to determine the total expected number of commuters.
clauses
class-attribute
instance-attribute
clauses = (SparsemodClause(),)
The movement clauses that make up the model.