14 lines
936 B
Python
14 lines
936 B
Python
"""Table corr_x/corr_y (ou autre colonne) de tous les capteurs sur une fenêtre. usage: table.py DEBUT FIN [colonne]"""
|
|||
|
|
import csv, glob, sys
|
||
|
|
D="data/BREITHORN"; a,b=sys.argv[1],sys.argv[2]; cols=sys.argv[3].split(",") if len(sys.argv)>3 else ["corr_x","corr_y"]
|
||
|
|
v={}; S=[]
|
||
|
|
for f in sorted(glob.glob(f"{D}/displacement/*.csv")):
|
||
|
|
for r in csv.DictReader(open(f)):
|
||
|
|
k=r["time_utc"][:16].replace(" ","T")
|
||
|
|
if a<=k<=b:
|
||
|
|
if r["sensor_name"] not in S: S.append(r["sensor_name"])
|
||
|
|
rej=float(r["error_value"])>float(r["error_threshold"])
|
||
|
|
v.setdefault(k,{})[r["sensor_name"]]=[("R" if rej and c.startswith("corr") else (f"{float(r[c]):+.3f}" if r[c] else "-")) for c in cols]
|
||
|
|
for c_i,c in enumerate(cols):
|
||
|
|
print(f"== {c}"); print("instant "+" ".join(f"{s[:8]:>8}" for s in S))
|
||
|
|
for k in sorted(v): print(k[5:]," "+" ".join(f"{v[k].get(s,['?']*len(cols))[c_i]:>8}" for s in S))
|