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

+5 -16
View File
@@ -17,10 +17,8 @@ matplotlib.use("Agg")
import matplotlib.dates as mdates # noqa: E402
import matplotlib.pyplot as plt # noqa: E402
from data import filter_window, is_reference, load, parse_time # noqa: E402
from summary import QUALITY # noqa: E402
COLUMNS = ("error_value", "corr_x", "corr_y", "relative_x", "relative_y", "x", "y", "sigma0", "reproj_err")
from common import COLUMNS, QUALITY, bound, check, sensors # noqa: E402
from data import filter_window, parse_time # noqa: E402
def zone(text):
@@ -31,10 +29,6 @@ def zone(text):
return parse_time(start), parse_time(end)
def bound(t, default):
return t.strftime("%Y%m%dT%H%MZ") if t else default
def main():
a = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
a.add_argument("folder")
@@ -46,15 +40,10 @@ def main():
a.add_argument("--out", default=os.path.join("out", "diagnostic"), help="folder of the PNG")
o = a.parse_args()
by = load(o.folder)
if not by:
sys.exit(f'No "advanced" export in {o.folder} (see inventory.py).')
names = o.sensors.split(",") if o.sensors else sorted(by, key=lambda s: (not is_reference(by[s]), s))
by, names = sensors(o.folder, o.sensors)
columns = o.columns.split(",")
for requested, known, what in ((names, by, "sensors"), (columns, COLUMNS + QUALITY, "columns")):
missing = [x for x in requested if x not in known]
if missing:
sys.exit(f"Unknown {what}: {', '.join(missing)}. Known: {', '.join(sorted(known))}.")
check("sensors", names, by)
check("columns", columns, COLUMNS + QUALITY)
series = {s: filter_window(by[s], o.start, o.end) for s in names}
if not any(series.values()):
sys.exit("No measurement in the requested window.")