|
21 | 21 | "\n", |
22 | 22 | "The caveat of defining measure effects as python functions is that it cannot be serialized (written to a file), and also makes reading from a file a challenge.\n", |
23 | 23 | "\n", |
24 | | - "In order to retain close that gap, the `measure` module now ships `MeasureConfig` objects, which handle the reading, writing and \"declarative\" defining of `Measure` objects.\n", |
| 24 | + "In order to close that gap, the `measure` module now ships `MeasureConfig` objects, which handle the reading, writing and \"declarative\" defining of `Measure` objects.\n", |
25 | 25 | "\n", |
26 | 26 | "`Measure` objects can be instantiated from `MeasureConfig` objects using `Measure.from_config(<MeasureConfig object>)`.\n", |
27 | 27 | "\n", |
|
30 | 30 | "| `Measure` | `MeasureConfig` |\n", |
31 | 31 | "|-----------|--------------------|\n", |
32 | 32 | "| Is used for the actual computation | Is transformed into a `Measure` for actual computation |\n", |
33 | | - "| Uses python function to define what change to apply to the `Exposures`, `ImpactFuncSet`, `Hazard` objects | Define the changes (functions) to apply via the former way (scaling/shifting effect, alternate file loading, etc.) |\n", |
| 33 | + "| Uses python functions to define what change to apply to the `Exposures`, `ImpactFuncSet`, `Hazard` objects | Defines the changes to apply using the (former) declarative way (scaling/shifting effect, alternate file loading, etc.) |\n", |
34 | 34 | "| Accepts any possible effect as long as it can be defined as a python function | Is restricted to a set of defined effects |\n", |
35 | 35 | "| Cannot be written to a file (unless it was created by a `MeasureConfig`) | Can easily be read from/written to a file (`.xlsx` or `.yaml`) |" |
36 | 36 | ] |
|
163 | 163 | "\n", |
164 | 164 | "The `ImpfsetModifierConfig` is used to define how an adaptation measure changes the vulnerability (refer to the [impact functions tutorial](impact-functions-tutorial)).\n", |
165 | 165 | "\n", |
166 | | - "When \"translated\" to a `Measure` object the `ImpfsetModifierConfig` populates the `impfset_change` attribute with a function that takes an `ImpactFuncSet` and returns a modified one, according to the specifications.\n", |
| 166 | + "When \"translated\" to a `Measure` object, the `ImpfsetModifierConfig` populates the `impfset_change` attribute with a function that takes an `ImpactFuncSet` and returns a modified one, according to the specifications.\n", |
167 | 167 | "\n", |
168 | 168 | "```{note}\n", |
169 | 169 | "Modifications are always applied to a specific hazard type (`haz_type` parameter).\n", |
|
218 | 218 | "\n", |
219 | 219 | "# 1. Scaling existing Impact Functions\n", |
220 | 220 | "# Let's say we want to simulate a 20% reduction in MDD\n", |
221 | | - "# and a slight shift in the intensity threshold for Hazard 'TC'.\n", |
| 221 | + "# and a horziontal translation of the impact function for Hazard 'TC'.\n", |
222 | 222 | "impf_mod_scaling = ImpfsetModifierConfig(\n", |
223 | 223 | " haz_type=\"TC\",\n", |
224 | 224 | " impf_ids=[1, 2], # Apply only to specific function IDs\n", |
225 | 225 | " impf_mdd_mult=0.8, # Reduce Mean Damage Degree by 20%\n", |
226 | | - " impf_int_add=5.0, # Shift intensity axis by 5 units (e.g., higher resistance)\n", |
| 226 | + " impf_int_add=5.0, # Shift intensity array by 5 units, i.e. move impact function by 5 units to the right (e.g., higher resistance)\n", |
227 | 227 | ")\n", |
228 | 228 | "\n", |
229 | 229 | "print(\"--- Scaling Config ---\")\n", |
|
248 | 248 | "\n", |
249 | 249 | "The `HazardModifierConfig` is used to define how an adaptation measure changes the hazard (refer to the [hazard tutorial](hazard-tutorial)).\n", |
250 | 250 | "\n", |
251 | | - "When \"translated\" to a `Measure` object the `HazardModifierConfig` populates the `hazard_change` attribute with a function that takes a `Hazard` (possibly additional arguments, see below) and returns a modified one, according to the specifications.\n", |
| 251 | + "When \"translated\" to a `Measure` object, the `HazardModifierConfig` populates the `hazard_change` attribute with a function that takes a `Hazard` (possibly additional arguments, see below) and returns a modified one, according to the specifications.\n", |
252 | 252 | "\n", |
253 | 253 | "```{note}\n", |
254 | 254 | "Modifications are always applied to a specific hazard type (`haz_type` parameter).\n", |
|
359 | 359 | "\n", |
360 | 360 | "The `ExposuresModifierConfig` is used to define how an adaptation measure changes the exposure (refer to the [exposure tutorial](exposure-tutorial)).\n", |
361 | 361 | "\n", |
362 | | - "When \"translated\" to a `Measure` object the `ExposuresModifierConfig` populates the `exposures_change` attribute with a function that takes an `Exposures` and returns a modified one, according to the specifications.\n", |
| 362 | + "When \"translated\" to a `Measure` object, the `ExposuresModifierConfig` populates the `exposures_change` attribute with a function that takes an `Exposures` and returns a modified one, according to the specifications.\n", |
363 | 363 | "\n", |
364 | 364 | "`ExposuresModifierConfig` allows you to modify the impact function assigned to different hazard, to set a list of points to 0 value, or to load a different Exposures:\n", |
365 | 365 | "\n", |
|
402 | 402 | "\n", |
403 | 403 | "# 1. Changing existing Exposures\n", |
404 | 404 | "exp_mod = ExposuresModifierConfig(\n", |
405 | | - " reassign_impf_id={\"TC\": {1: 2}}, # Remaps exposures points with impf_TC == 1 to 2.\n", |
| 405 | + " reassign_impf_id={\n", |
| 406 | + " \"TC\": {1: 2}\n", |
| 407 | + " }, # Reassigns exposures points with impact function id impf_TC == 1 to 2.\n", |
406 | 408 | " set_to_zero=[\n", |
407 | 409 | " 0,\n", |
408 | 410 | " 25,\n", |
|
0 commit comments