Commit 59d09cb
Fix zig-zagging average on the day-to-day stringline
The "Average actual" line ran backwards along the route in 14 of its 35
points — visually a zig-zag, and physically impossible: a bus cannot reach
a later stop earlier.
Cause: matched days cover very different subsets of the route (13, 5, 21
and 24 of 41 stops in the sample case) because GPS drops out or trails
start late. A naive per-stop mean across days therefore took stop 12 from
one set of days and stop 13 from another, describing an "average trip" no
bus ever ran. Individual days were nearly monotonic already (0-1 backward
steps each), which is what pointed at the averaging rather than the
per-ping matching.
Two changes:
- A stop only enters the average if at least half the matched days (min 2)
measured it, so each averaged point rests on a comparable base.
- Any residual backward step is clamped forward, since that is nearest-stop
mis-assignment rather than a reversing bus.
Both are disclosed in the chart's notes — how many thin stops were left out
and how many points were clamped — rather than silently smoothed. The
excluded stops still appear as faint per-day lines, so nothing is hidden.
Verified on real data: backward steps 14 -> 0.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>1 parent 1962322 commit 59d09cb
1 file changed
Lines changed: 36 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
270 | | - | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
271 | 297 | | |
272 | 298 | | |
273 | | - | |
| 299 | + | |
274 | 300 | | |
275 | 301 | | |
276 | 302 | | |
| |||
287 | 313 | | |
288 | 314 | | |
289 | 315 | | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
290 | 324 | | |
291 | 325 | | |
292 | 326 | | |
| |||
0 commit comments