create_world_2
Create World
Example script to show the creation of a world for simulation.
Creates a World object and writes the details to a file (my_world.hdf5).
This example script creates a World object, which contains information such as the geography, population distribution, places of leisure, places of work, and how the disease interacts. This World object is then used by run_simulation.md in order to simulate the spread of the infection.
Creation of the world takes several steps:
Step 1: Disease configuration.
This step configures the disease. It uses the DiseaseConfig class, which manages disease-specific configurations and initalises managers for rates, interactions, symptoms, etc.
Step 2: Create the Geography.
This step creates a Geography object, which contains all the geographical objects that encode where things are --- people, workplaces, schools, and leisure activities.
Step 3: Create the World object.
This is usually the slowest step. It creates people according to demography, assigning them workplaces an leisure activities, and then assigns them a household in the Geography to live in. See world.py for details.
Step 4: Leisure Time.
Initialises leisure activities (Pubs, Cinemas, Groceries, Gymns) if available and not yet done.
Step 5: Travel.
Sets up the ability for people to travel.
Step 6: Writing the world.
Writes the world to an hdf5 file.
geography_choice_step(choice=2)
Selects which areas (the smallest geographic unit for the code) to load into the world.
Several examples are given here, decided by the variable "choice".
Select the geography to simulate
1: Small Aberdeen Test 2: Small Durham Test 3: Small Cross-Region (Carlisle + Southern Dumfries) 4: Small Northern Ireland test 5: 100 MSOAs from all regions (E, S, W, N) 6: ALL MSOAs from super_area_centroids.csv except S02003412 and S02003443 7: Only MSOAs that start with N from super_area_centroids.csv
Parameters:
Name | Type | Description | Default |
---|---|---|---|
choice
|
int
|
int (Default value = 2) |
2
|
Returns:
Name | Type | Description |
---|---|---|
list |
list
|
msoas_to_load (list): A list of strings corresponding to the keynames of each area to load into the world. |
Source code in example_scripts/create_world_2.py
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 |
|
geography_loading(SAs_to_load)
Loads the geography of the world. This includes the list of areas and super_areas, other important places, and where those places are.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
SAs_to_load
|
list
|
a list of all the super-areas that are to be used for the world. |
required |
Returns:
Name | Type | Description |
---|---|---|
Geography |
Geography
|
an object that generates the geography-area hierarchy. For example, it contains the lists of areas, super_areas, and regions. It also contains the locations of important places such as hospitals, schools, and grocery outlets. See geography.py. |
Source code in example_scripts/create_world_2.py
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
|
main()
Source code in example_scripts/create_world_2.py
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 |
|
set_up_disease_config(disease_name='ev-d68-v')
Creates an object which loads and parses disease-specific managers for things like interactions, symptoms, vaccinations, and policies. It essentially manages the agent-level effects and transmission of the disease.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
disease_name
|
str
|
str (Default value = "ev-d68-v") |
'ev-d68-v'
|
Returns:
Name | Type | Description |
---|---|---|
DiseaseConfig |
DiseaseConfig
|
disease_config DiseaseConfig: an object that manages the configuration of a specific disease. |
Source code in example_scripts/create_world_2.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
|