Points: a page to set each measurement of a range valid or not, saved in labeling/points/ (labeling/scripts/points.py), the ground truth of the benchmarks point by point

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maximeandClaude Opus 5.5 committed 2026-11-20 08:28:19 +01:00
1 parent 1133a91078
commit dcd255ab1f
6 files changed
+228 -5

No files matched your search

+23 -1
View File
@@ -47,6 +47,8 @@ def check_server():
assert call("/api/stations") == 200
assert call("/api/analyses") == 200
assert call("/api/support") == 200
assert call("/api/points") == 200
assert call("/api/points/..%2Fx") in (400, 404)
assert call("/api/support", {"station": "x"}) == 400
assert call("/api/analyses/UNKNOWN/optimize", {}) == 400
finally:
@@ -427,7 +429,27 @@ def check_conversations():
shutil.rmtree(root)
CHECKS = [check_server, check_station, check_optimization, check_analysis, check_validation, check_support, check_conversations]
def check_points():
# the Points page: a dataset of the real data in a temporary folder; its format and its rules, labeling/scripts/points.py --test
import validity
before, validity.points.FOLDER = validity.points.FOLDER, str(temp_folder())
try:
n = validity.create({"station": "NIEDERHORN", "start": "2026-09-25", "end": "2026-09-26"})
assert n["points"] and not n["invalid"] and validity.listing("NIEDERHORN") == [n], n
d = validity.dataset(n["name"])
s, o = next(iter(d["sensors"].items()))
assert validity.mark(n["name"], {"sensor": s, "times": o["t"][:2], "valid": False})["invalid"] == 2
refuses(validity.create, {"station": "NIEDERHORN", "start": "2026-09-25", "end": "2026-09-26"}) # exists
refuses(validity.create, {"station": "NIEDERHORN@run", "start": "2026-09-25", "end": "2026-09-26"})
refuses(validity.dataset, "../x")
refuses(validity.mark, n["name"], {"sensor": s, "times": ["2026-09-27 00:00:00"], "valid": False})
finally:
shutil.rmtree(validity.points.FOLDER)
validity.points.FOLDER = before
CHECKS = [check_server, check_station, check_optimization, check_analysis, check_validation, check_support, check_conversations,
check_points]
if __name__ == "__main__":
name = sys.argv[1] if len(sys.argv) > 1 else None