Interventions Reference¶
JAX-compatible intervention functions that modify transmission rates during simulation. These support both proportion-based triggering (activate when infection prevalence crosses a threshold) and date-window triggering (activate within a calendar date range).
interventions
¶
JAX-compatible intervention functions for modifying transmission rates.
This module provides two intervention dispatch strategies that can be applied during simulation:
- Proportion-based (
jax_prop_intervention): activates or deactivates interventions when the proportion of infective individuals crosses configurable thresholds. - Timestep-based (
jax_timestep_intervention): activates interventions within a calendar date window specified as ordinal days.
Both functions support Dengue vector-borne interventions (physical /
chemical, targeting b_V_T / s_V_T rates) and COVID-style
interventions (social isolation, vaccination, mask wearing targeting
beta, plus lockdown which replaces the travel matrix with an
identity matrix).
jax_prop_intervention(intervention_dict, prop_infectives, rates, intervention_statuses, travel_matrix)
¶
Apply proportion-based interventions that trigger on infection prevalence.
Each intervention activates when prop_infectives rises above its
start_threshold and deactivates when it falls below its
end_threshold. While active, the targeted transmission rate is
reduced by adherence_min * transmission_percentage.
Supported intervention keys (looked up in intervention_dict):
"physical"/"chemical"-- Dengue vector-borne interventions targeting theb_V_T(biting) ands_V_T(spraying) rates."social_isolation"/"vaccination"/"mask_wearing"-- COVID-style interventions targeting thebetarate."lock_down"-- replaces the travel matrix with an identity matrix to eliminate inter-zone movement.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
intervention_dict
|
Mapping of intervention name to its config dict.
Each config must contain |
required | |
prop_infectives
|
float
|
Current proportion of infective individuals in the population (0.0--1.0). |
required |
rates
|
dict
|
Mutable dict of current transmission rate values keyed by
variable name (e.g. |
required |
intervention_statuses
|
dict
|
Mutable dict tracking the on/off boolean status of each intervention by name. |
required |
travel_matrix
|
ndarray
|
Square JAX array representing inter-zone travel. Replaced with an identity matrix when lockdown is active. |
required |
Returns:
| Type | Description |
|---|---|
|
A 3-tuple of |
|
|
with updated values reflecting any interventions that were |
|
|
activated or deactivated this step. |
Source code in compartment/interventions.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 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 | |
jax_timestep_intervention(intervention_dict, current_ordinal_day, rates, intervention_statuses, travel_matrix)
¶
Apply date-window interventions that activate within a calendar range.
Each intervention is active when current_ordinal_day falls within
its [start_date_ordinal, end_date_ordinal] window. While active
the targeted transmission rate is reduced by
adherence_min * transmission_percentage.
Supported intervention keys are the same as
:func:jax_prop_intervention (physical, chemical, social_isolation,
vaccination, mask_wearing, lock_down), but activation is driven by
calendar dates instead of prevalence thresholds.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
intervention_dict
|
dict
|
Mapping of intervention name to its config
dict. Each config must contain |
required |
current_ordinal_day
|
int
|
The current simulation day as an ordinal
integer (e.g. from |
required |
rates
|
dict
|
Mutable dict of current transmission rate values keyed by
variable name (e.g. |
required |
intervention_statuses
|
dict
|
Mutable dict tracking the on/off boolean status of each intervention by name. |
required |
travel_matrix
|
ndarray
|
Square JAX array representing inter-zone travel. Replaced with an identity matrix when lockdown is active. |
required |
Returns:
| Type | Description |
|---|---|
|
A 3-tuple of |
|
|
with updated values reflecting any interventions that were |
|
|
activated or deactivated this step. |
Source code in compartment/interventions.py
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 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 | |