episodes.py, not common.py: the tools repository has its own common.py on the same sys.path in the app
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9d4cd722f4
commit
63d954a126
9 files changed
+9
-9
No files matched your search
@@ -4,7 +4,7 @@ AIMsight anomaly detectors (Python 3, standard library only) and their benchmark
|
||||
|
||||
## Contract (do not break)
|
||||
|
||||
- `scripts/categories.py` runs the detectors of `DETECTORS` (modules of `scripts/`: `visibility`, `target_issue`, `thermal_displacement`, `no_data`, `displacement`) and makes their episodes events. A module returns every family it finds: `visibility` also gives Brief obstruction and `target_issue` Target obscured (Obstruction). `common.py` holds the helpers they share.
|
||||
- `scripts/categories.py` runs the detectors of `DETECTORS` (modules of `scripts/`: `visibility`, `target_issue`, `thermal_displacement`, `no_data`, `displacement`) and makes their episodes events. A module returns every family it finds: `visibility` also gives Brief obstruction and `target_issue` Target obscured (Obstruction). `episodes.py` holds the helpers they share.
|
||||
- `detect(measurements)` (`no_data`: also `end`, the end of the window read) returns episodes with the keys `start`, `end`, `kind` (the family), `label` (the variety), `text` (the sentence shown), `ignore`, `sensors`; a Poor visibility also has `level`.
|
||||
- The measurements are read by `scripts/data.py` of the tools repository, the sibling `~/aimsight-tools` (`categories.py` puts it on the path); a reading fix is made there.
|
||||
- Label files (JSONL): `id`, `start`, `end`, `family`, `description` (and `review`, `analysis`); the project uses `labeling/auto` only.
|
||||
|
||||
@@ -14,7 +14,7 @@ Five modules in `scripts/`, one per kind of reading; each gives episodes of one
|
||||
| `no_data.py` | the cadence of the measurements | No data |
|
||||
| `displacement.py` | jumps and slow drift of the corrected curves | Displacement (Sudden jump, back to normal; Lasting shift; Jump, not back yet; Slow drift) |
|
||||
|
||||
`common.py` holds their shared helpers. `categories.py` runs them all and classifies their episodes into events (a jump back joins the visibility loss or the obstruction that explains it; the same variety less than an hour apart, one event), one line per event. The measurements are read by `scripts/data.py` of the tools repository, the sibling `~/aimsight-tools`.
|
||||
`episodes.py` holds their shared helpers. `categories.py` runs them all and classifies their episodes into events (a jump back joins the visibility loss or the obstruction that explains it; the same variety less than an hour apart, one event), one line per event. The measurements are read by `scripts/data.py` of the tools repository, the sibling `~/aimsight-tools`.
|
||||
|
||||
```bash
|
||||
python3 scripts/categories.py <station folder> --from YYYY-MM-DD --to YYYY-MM-DD # --chunk N, --history N
|
||||
|
||||
@@ -25,7 +25,7 @@ from pathlib import Path
|
||||
# (a copy of this repository elsewhere, e.g. extracted by git archive).
|
||||
HERE = Path(__file__).resolve().parent
|
||||
sys.path[:0] = [str(HERE), str(HERE.parents[1] / "aimsight-tools" / "scripts"), str(Path.cwd() / "tools" / "scripts")]
|
||||
from common import targets # noqa: E402
|
||||
from episodes import targets # noqa: E402
|
||||
from data import iso, load # noqa: E402
|
||||
|
||||
DETECTORS = ("displacement", "no_data", "target_issue", "thermal_displacement", "visibility")
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
import statistics
|
||||
from datetime import timedelta
|
||||
|
||||
from common import episode, noise
|
||||
from episodes import episode, noise
|
||||
from data import is_reference
|
||||
|
||||
K = 20 # E-001: at 15, two healthy targets are greyed (17 and 18 noises); the trains of E-005 are visibility's
|
||||
|
||||
File renamed without changes.
+2
-2
@@ -1,6 +1,6 @@
|
||||
"""No data family: no measurement in the export for more than MISSING steps of its cadence (common.cadence), between two
|
||||
"""No data family: no measurement in the export for more than MISSING steps of its cadence (episodes.cadence), between two
|
||||
measurements or, when the caller gives the end of the window read, between the last measurement and that end."""
|
||||
from common import cadence, episode
|
||||
from episodes import cadence, episode
|
||||
|
||||
MISSING = 2 # more than 2 missing steps is a hole (user's rule, 2026-10-23); also up to the end (CLARIDEN, batch 01)
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ own usual level, so a target almost always rejected looks normal to it. For a fe
|
||||
"""
|
||||
from datetime import timedelta
|
||||
|
||||
from common import cadence, episode
|
||||
from episodes import cadence, episode
|
||||
|
||||
SHARE = 0.25 # wf-improve Target issue, mod. 1, S1 (WILDSTRUBEL R3 rejected from 04:00 to 16:00 every day, 30 to 45 %)
|
||||
MIN_HOURS = 3 # wf-improve NEBRASKA, batch 01 (one measurement every 4 h: as hours, not as instants)
|
||||
|
||||
@@ -21,7 +21,7 @@ import math
|
||||
import statistics
|
||||
from datetime import datetime, timedelta, timezone
|
||||
|
||||
from common import episode, noise, runs
|
||||
from episodes import episode, noise, runs
|
||||
from data import is_reference
|
||||
|
||||
MIN_HOURS = 20 # hours of a day of the profile
|
||||
|
||||
@@ -16,7 +16,7 @@ Heat shimmer: end of file.
|
||||
import statistics
|
||||
from datetime import timedelta
|
||||
|
||||
from common import cadence, episode, level, runs, targets
|
||||
from episodes import cadence, episode, level, runs, targets
|
||||
from data import is_reference
|
||||
|
||||
K_MAD = 10 # E-001 (fog: 11 to 57 MAD), E-005 (rain, trains: 10 to 70 MAD)
|
||||
|
||||
Reference in new issue
Block a user