BaseMixing#
- class BaseMixing(scenario, params)[source]#
Bases:
ABCBase class for migration models.
- property migration_matrix: ndarray#
Migration matrix computed from get_migration_matrix().
- Returns:
The migration matrix with lazy computation and caching.
- Return type:
np.ndarray
- property mixing_matrix: ndarray#
Mixing matrix computed from get_mixing_matrix().
- Returns:
The mixing matrix with lazy computation and caching.
- Return type:
np.ndarray
- abstractmethod get_migration_matrix()[source]#
Initialize a migration/diffusion matrix for population mixing. The diffusion matrix is a square matrix where each row represents the outbound migration from a given patch to all other patches e.g., [i,j] = [from_i, to_j].
Convention is: - Trips into node j: N_i @ M[i,j] - Trips out of node i: np.sum(M[i,j] * N_i[:,np.newaxis], axis=1)
- Returns:
The diffusion matrix: (N, N)
- Return type:
ndarray