demographics
Demographics
Bases: Demographics
Source code in emodpy/demographics/demographics.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | |
add_migration(data, migration_type, x_modifier=1.0, interpolation_type=InterpolationType.PIECEWISE_CONSTANT, migration_pattern=MigrationPattern.RANDOM_WALK_DIFFUSION, roundtrip_duration=None, roundtrip_probability=None, roundtrip_waypoints=None, filename=None, user_notes=None)
Assign migration data to a migration type, write the file, and set config params.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
MigrationData object containing the rate data |
required | |
migration_type
|
Union[MigrationType, str]
|
MigrationType enum or string ("LOCAL", "AIR", "REGIONAL", "SEA", "FAMILY") |
required |
x_modifier
|
float
|
migration rate multiplier (x_*_Migration config param). Default 1.0 |
1.0
|
interpolation_type
|
Union[InterpolationType, str]
|
InterpolationType enum or string. Default PIECEWISE_CONSTANT. |
PIECEWISE_CONSTANT
|
migration_pattern
|
Union[MigrationPattern, str]
|
MigrationPattern enum or string. Default RANDOM_WALK_DIFFUSION. SINGLE_ROUND_TRIPS: uses roundtrip_duration and roundtrip_probability. WAYPOINTS_HOME: uses roundtrip_waypoints. RANDOM_WALK_DIFFUSION: no additional parameters. |
RANDOM_WALK_DIFFUSION
|
roundtrip_duration
|
Optional[float]
|
days at destination (*_Roundtrip_Duration). Only used with SINGLE_ROUND_TRIPS. Default None. |
None
|
roundtrip_probability
|
Optional[float]
|
probability of return trip (*_Roundtrip_Probability). Only used with SINGLE_ROUND_TRIPS. Default None. |
None
|
roundtrip_waypoints
|
Optional[int]
|
max waypoints before returning home (Roundtrip_Waypoints). Only used with WAYPOINTS_HOME. Default None. |
None
|
filename
|
Optional[str]
|
output path for the binary file. If None, auto-generates based on migration_type. |
None
|
user_notes
|
Optional[str]
|
free-text description of this migration file — motivation, data source, assumptions, etc. We encourage you to record why this file was created so the context is preserved for future reference. Stored in the JSON metadata sidecar as USER_NOTES. |
None
|
Source code in emodpy/demographics/demographics.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | |