|
311 | 311 | },
|
312 | 312 | {
|
313 | 313 | "cell_type": "markdown",
|
314 |
| - "metadata": {}, |
| 314 | + "metadata": { |
| 315 | + "tags": [] |
| 316 | + }, |
315 | 317 | "source": [
|
316 | 318 | "## Dynamic triggering\n",
|
317 | 319 | "\n",
|
318 | 320 | "Another option is to replace the ``days`` arguments with custom functions defining additional criteria. For example, perhaps you only want your beta change intervention to take effect once infections get to a sufficiently high level. Here's a fairly complex example (feel free to skip the details) that toggles the intervention on and off depending on the current number of people who are infectious.\n",
|
319 | 321 | "\n",
|
320 | 322 | "This example illustrates a few different features:\n",
|
321 |
| - "- The simplest change is just that we're supplying `days=inf_thresh` instead of a number or list. If we had `def inf_thresh(interv, sim): return [20,30]` this would be the same as just setting `days=[20,30]`.\n", |
322 |
| - "- Because the first argument this function gets is the intervention itself, we can stretch the rules a little bit and name this variable `self` -- as if we're defining a new method for the intervention, even though it's actually just a function.\n", |
323 |
| - "- We want to keep track of a few things with this intervention -- namely when it toggles on and off, and whether or not it's active. Since the intervention is just an object, we can add these attributes directly to it.\n", |
324 |
| - "- Finally, this example shows some of the flexibility in how interventions are plotted -- i.e. shown in the legend with a label and with a custom color." |
| 323 | + "\n", |
| 324 | + "* The simplest change is just that we're supplying `days=inf_thresh` instead of a number or list. If we had `def inf_thresh(interv, sim): return [20,30]` this would be the same as just setting `days=[20,30]`.\n", |
| 325 | + "* Because the first argument this function gets is the intervention itself, we can stretch the rules a little bit and name this variable `self` -- as if we're defining a new method for the intervention, even though it's actually just a function.\n", |
| 326 | + "* We want to keep track of a few things with this intervention -- namely when it toggles on and off, and whether or not it's active. Since the intervention is just an object, we can add these attributes directly to it.\n", |
| 327 | + "* Finally, this example shows some of the flexibility in how interventions are plotted -- i.e. shown in the legend with a label and with a custom color." |
325 | 328 | ]
|
326 | 329 | },
|
327 | 330 | {
|
|
0 commit comments