Scripts: shared helpers in common.py, no tool imports another; CLI and outputs unchanged

data.py stays the reader (METRIC_RE now also captures the file date, same matches);
common.py holds columns, steps, noise, sensor list, runs, file names. Duplicated
run grouping, pose gaps, step bucketing, --table/--outside parsing removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maximeandClaude Opus 5.5 committed 2026-11-16 15:48:42 +01:00
1 parent c1719cbd1d
commit 6ed4c420e1
13 files changed
+308 -359

No files matched your search

+3 -14
View File
@@ -33,10 +33,8 @@ matplotlib.use("Agg")
import matplotlib.dates as mdates # noqa: E402
import matplotlib.pyplot as plt # noqa: E402
from common import STATS, bound, cut, duration, group, targets, window_filter # noqa: E402
from data import POSE, filter_window, is_reference, iso, load, load_camera, load_temperature, parse_time, rejected # noqa: E402
from metrics import cut, runs, targets # noqa: E402
from plot import bound # noqa: E402
from summary import STATS, duration # noqa: E402
COLUMNS = ("temperature",) + tuple("cam_" + c for c in POSE) + ("tgt_corr_x", "tgt_corr_y", "rej_targets", "rej_refs")
@@ -83,13 +81,7 @@ def main():
columns = o.columns.split(",")
if missing := [c for c in columns if c not in COLUMNS]:
sys.exit(f"Unknown columns: {', '.join(missing)}. Known: {', '.join(COLUMNS)}.")
if o.table in ("", "no"):
in_table = lambda t: o.table == "" # noqa: E731
else:
limits = [parse_time(x) for x in o.table.split("/")]
if len(limits) != 2:
sys.exit("--table expects T1/T2 or no.")
in_table = lambda t: limits[0] <= t <= limits[1] # noqa: E731
in_table = window_filter(o.table)
names = [os.path.basename(os.path.normpath(d)) for d in o.folders]
by_station, measured = {}, {}
@@ -123,10 +115,7 @@ def main():
t = tuple(n for n in names if k not in with_temp[n])
if m or t:
keys.setdefault((m, t), []).append(k)
lines = []
for (m, t), ks in keys.items():
for d, f, nb in runs(ks, o.step):
lines.append((d, f, nb, m, t))
lines = [(g[0], g[-1], len(g), m, t) for (m, t), ks in keys.items() for g in group(ks, lambda a, b: b - a == o.step)]
for d, f, nb, m, t in sorted(lines):
print(f" {iso(d)} → {iso(f)} ({nb} steps): no measurement {','.join(m) or '-'}; no temperature {','.join(t) or '-'}")
if not lines: