|
91 | 91 | "| Fixture | What it gives you |\n", |
92 | 92 | "|---|---|\n", |
93 | 93 | "| `exposures` | An `Exposures` object with 6 points and values `[0, 1000, 2000, 3000, 4000, 5000]` |\n", |
94 | | - "| `hazard` | A `Hazard` with 5 events and known intensities (see below) |\n", |
| 94 | + "| `hazard` | A `Hazard` with 5 events and \"helpful\" intensities and frequencies (see below) |\n", |
95 | 95 | "| `linear_impact_function` | An `ImpactFunc` where intensity % == damage % (identity) |\n", |
96 | 96 | "| `impfset` | An `ImpactFuncSet` wrapping the linear impact function |\n", |
97 | 97 | "| `centroids` | Hazard centroids (slightly offset from exposure points (`+0.1°`)) |\n", |
|
105 | 105 | " assert impact.aai_agg == pytest.approx(18) # analytically known value\n", |
106 | 106 | "```\n", |
107 | 107 | "\n", |
108 | | - "The expected values are documented at the top of `conftest.py`, here are some key ones:\n", |
| 108 | + "Values of the defaults fixtures were chosen such that impacts are rather easy to compute by hand. \n", |
| 109 | + "This is documented at the top of `conftest.py`, but here are some key design choices:\n", |
| 110 | + "\n", |
| 111 | + "- There are 4 events, with frequencies == 0.03, 0.01, 0.006, 0.004, 0,\n", |
| 112 | + " such that impacts for RP250, 100 and 50 and 20 correspond to `at_event`,\n", |
| 113 | + " (sorted frequencies cumulate to 1/250, 1/100, 1/50 and 1/20).\n", |
| 114 | + "- Hazard intensity is:\n", |
| 115 | + " * Event 1: zero everywhere (always no impact)\n", |
| 116 | + " * Event 2: max intensity (100) at first centroid (also always no impact (first centroid is 0))\n", |
| 117 | + " * Event 3: half max intensity at second centroid (impact == half second centroid)\n", |
| 118 | + " * Event 4: quarter max intensity everywhere (impact == 1/4 total value)\n", |
| 119 | + " * Event 5: max intensity everywhere (but zero frequency)\n", |
| 120 | + "\n", |
| 121 | + "This results in the following expected values:\n", |
109 | 122 | "\n", |
110 | 123 | "| Metric | Expected value | Why |\n", |
111 | 124 | "|---|---|---|\n", |
|
114 | 127 | "| RP 100 | `500` | Event 3: half intensity on second point (value 1000) |\n", |
115 | 128 | "| RP 250 | `3750` | Event 4: quarter intensity on all points |\n", |
116 | 129 | "\n", |
| 130 | + "> Note: The overview above reflects the `conftest.py` file at the time of writing. If you notice any discrepancy, the docstring at the top of `conftest.py` is the authoritative source.\n", |
| 131 | + "\n", |
117 | 132 | "### Using factories for custom scenarios\n", |
118 | 133 | "\n", |
119 | 134 | "When your test needs a variation (e.g. scaled intensity, a different hazard type, group IDs), you can make use of the `_factory` fixtures. Each factory is a callable that accepts keyword arguments:\n", |
|
0 commit comments