Skip to content

epymorph.data.mm.flat

FlatClause

Bases: MovementClause

The clause of the flat model.

requirements class-attribute instance-attribute

requirements = (
    AttributeDef(
        "population",
        int,
        N,
        comment="The total population at each node.",
    ),
    AttributeDef(
        "commuter_proportion",
        float,
        Scalar,
        default_value=0.1,
        comment="The proportion of the total population which commutes.",
    ),
)

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?

dispersal_kernel cached property

dispersal_kernel: NDArray[float64]

The NxN matrix or dispersal kernel describing the tendency for movers to move to a particular location. In this model, the kernel is full of 1s except for 0s on the diagonal, which is then row-normalized. Effectively: every destination is equally likely.

evaluate

evaluate(tick: Tick) -> NDArray[SimDType]

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:

  • NDArray[SimDType]

    An array describing the requested number of individuals to move from origin location (row; axis 0) to destination location (column; axis 1).

Flat

Bases: MovementModel

This model evenly weights the probability of movement to all other nodes. It uses parameter 'commuter_proportion' to determine how many people should be moving, based on the total normal population of each node.

steps class-attribute instance-attribute

steps = (1 / 3, 2 / 3)

The length and order of tau steps.

clauses class-attribute instance-attribute

clauses = (FlatClause(),)

The movement clauses that make up the model.