Detectors, loop and sharpening sessions moved to the repo root (D-084)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
No files matched your search
|
After Width: | Height: | Size: 57 KiB |
|
After Width: | Height: | Size: 35 KiB |
@@ -0,0 +1,44 @@
|
||||
"""Centroïde de la tache de chaque capteur dans l'image (pondéré au-dessus de la médiane d'un cadre
|
||||
de ±20 px, fenêtre ±8 px autour de x, y de l'export) à plusieurs instants ; écart au premier instant,
|
||||
comparé à l'écart de x, y de l'export. usage : centroides.py AAAAMMJJTHHMM [...]"""
|
||||
import sys, glob
|
||||
import numpy as np
|
||||
import matplotlib.image as mpimg
|
||||
sys.path.insert(0, 'vues-deplacements/aiguiser/2026-10-26T1729Z_CLARIDEN/lot-01/corrige')
|
||||
from lit import charge
|
||||
|
||||
inst = sys.argv[1:]
|
||||
rows, types = charge('2026-09-15', '2026-09-21')
|
||||
xy = {k: {} for k in inst}
|
||||
for s, L in rows.items():
|
||||
for t, d in L:
|
||||
k = t.strftime('%Y%m%dT%H%M')
|
||||
if k in xy:
|
||||
xy[k][s] = (d['x'], d['y'])
|
||||
ims = {}
|
||||
for k in inst:
|
||||
im = mpimg.imread(glob.glob(f'data/CLARIDEN/images/{k}Z_*.jpg')[0]).astype(float)
|
||||
ims[k] = im.mean(axis=2) if im.ndim == 3 else im
|
||||
|
||||
|
||||
def cent(im, x, y):
|
||||
xi, yi = int(round(x)), int(round(y))
|
||||
cadre = im[yi - 20:yi + 21, xi - 20:xi + 21]
|
||||
w = im[yi - 8:yi + 9, xi - 8:xi + 9] - np.median(cadre)
|
||||
w[w < 0] = 0
|
||||
yy, xx = np.mgrid[yi - 8:yi + 9, xi - 8:xi + 9]
|
||||
return (xx * w).sum() / w.sum(), (yy * w).sum() / w.sum()
|
||||
|
||||
|
||||
k0 = inst[0]
|
||||
print('capteur ' + ' '.join(f'{k[4:]:>27}' for k in inst[1:]))
|
||||
for s in sorted(rows, key=lambda s: (types[s] != 'global_ref', types[s] != 'ref', s)):
|
||||
if s not in xy[k0]:
|
||||
continue
|
||||
c0 = cent(ims[k0], *xy[k0][s])
|
||||
out = []
|
||||
for k in inst[1:]:
|
||||
c = cent(ims[k], *xy[k0][s]) # même fenêtre que l'instant de départ
|
||||
dx, dy = xy[k][s][0] - xy[k0][s][0], xy[k][s][1] - xy[k0][s][1]
|
||||
out.append(f'c{c[0]-c0[0]:+.2f},{c[1]-c0[1]:+.2f} e{dx:+.2f},{dy:+.2f}')
|
||||
print(f'{s:9s}{types[s][:3]} ' + ' '.join(out))
|
||||
@@ -0,0 +1,15 @@
|
||||
"""Une colonne, pour des capteurs choisis, pas à pas entre deux instants.
|
||||
usage : colonne.py COLONNE DEBUT FIN capteur [...]"""
|
||||
import sys
|
||||
from datetime import datetime
|
||||
sys.path.insert(0, 'vues-deplacements/aiguiser/2026-10-26T1729Z_CLARIDEN/lot-01/corrige')
|
||||
from lit import charge
|
||||
col = sys.argv[1]
|
||||
a, b = (datetime.fromisoformat(x + '+00:00') for x in sys.argv[2:4])
|
||||
caps = sys.argv[4:]
|
||||
rows, _ = charge(str(a.date()), str(b.date()) + 'z')
|
||||
T = sorted({t for s in caps for t, d in rows[s] if a <= t <= b})
|
||||
idx = {s: {t: d for t, d in rows[s]} for s in caps}
|
||||
print('t ' + ' '.join(f'{s:>9s}' for s in caps))
|
||||
for t in T:
|
||||
print(f'{t:%m-%d %H:%M} ' + ' '.join(' -' if idx[s].get(t, {}).get(col) is None else f'{idx[s][t][col]:9.4f}' for s in caps))
|
||||
|
After Width: | Height: | Size: 248 KiB |
|
After Width: | Height: | Size: 117 KiB |
|
After Width: | Height: | Size: 246 KiB |
|
After Width: | Height: | Size: 115 KiB |
@@ -0,0 +1,26 @@
|
||||
"""Compare l'export « L9 BCN_advanced » aux exports CLARIDEN_advanced : étendue, lignes communes, valeurs différentes."""
|
||||
import csv, glob
|
||||
D = 'data/CLARIDEN/displacement/'
|
||||
cla = {}
|
||||
for p in sorted(glob.glob(D + 'CLARIDEN_advanced_*.csv')):
|
||||
for r in csv.DictReader(open(p)):
|
||||
cla[(r['time_utc'], r['sensor_name'])] = r
|
||||
L = list(csv.DictReader(open(D + 'L9 BCN_advanced_20260917_20260920.csv')))
|
||||
ts = sorted({r['time_utc'] for r in L})
|
||||
print('L9 BCN :', len(L), 'lignes,', ts[0], '->', ts[-1], ',', len({r['sensor_name'] for r in L}), 'capteurs')
|
||||
print('colonnes identiques :', list(L[0].keys()) == list(next(iter(cla.values())).keys()))
|
||||
absent = diff = 0
|
||||
ex = []
|
||||
for r in L:
|
||||
c = cla.get((r['time_utc'], r['sensor_name']))
|
||||
if c is None:
|
||||
absent += 1
|
||||
continue
|
||||
d = [k for k in r if r[k] != c[k]]
|
||||
if d:
|
||||
diff += 1
|
||||
if len(ex) < 5:
|
||||
ex.append((r['time_utc'], r['sensor_name'], [(k, r[k], c[k]) for k in d][:3]))
|
||||
print('absentes de CLARIDEN :', absent, '; différentes :', diff)
|
||||
for e in ex:
|
||||
print(e)
|
||||
|
After Width: | Height: | Size: 150 KiB |
|
After Width: | Height: | Size: 107 KiB |
@@ -0,0 +1,48 @@
|
||||
"""Figures : une colonne (corr_x, corr_y, error_value, x, y, reproj_err) pour tous les capteurs,
|
||||
un panneau par capteur (échelle propre), et la pose caméra + sigma0.
|
||||
usage : figures.py DEBUT FIN suffixe"""
|
||||
import sys
|
||||
from datetime import datetime
|
||||
import matplotlib
|
||||
matplotlib.use('Agg')
|
||||
import matplotlib.pyplot as plt
|
||||
sys.path.insert(0, 'vues-deplacements/aiguiser/2026-10-26T1729Z_CLARIDEN/lot-01/corrige')
|
||||
from lit import charge, camera
|
||||
|
||||
OUT = 'vues-deplacements/aiguiser/2026-10-26T1729Z_CLARIDEN/lot-01/corrige/'
|
||||
a, b = (datetime.fromisoformat(x + '+00:00') for x in sys.argv[1:3])
|
||||
suf = sys.argv[3]
|
||||
rows, types = charge(str(a.date()), str(b.date()) + 'z')
|
||||
ordre = sorted(rows, key=lambda s: ({'global_ref': 0, 'ref': 1}.get(types[s], 2), s))
|
||||
|
||||
for col in ('corr_x', 'corr_y', 'error_value', 'x', 'y', 'reproj_err'):
|
||||
fig, axs = plt.subplots(len(ordre), 1, figsize=(16, 1.1 * len(ordre)), sharex=True)
|
||||
for ax, s in zip(axs, ordre):
|
||||
L = [(t, d[col]) for t, d in rows[s] if a <= t <= b and d[col] is not None]
|
||||
if L:
|
||||
ax.plot([t for t, _ in L], [v for _, v in L], '.', ms=2,
|
||||
color={'global_ref': 'C3', 'ref': 'C1'}.get(types[s], 'C0'))
|
||||
if col == 'error_value':
|
||||
ax.axhline(0.7, color='k', lw=.5, ls=':')
|
||||
ax.set_ylabel(s, rotation=0, ha='right', fontsize=7)
|
||||
ax.tick_params(labelsize=6)
|
||||
ax.grid(alpha=.3)
|
||||
axs[0].set_title(f'{col} {a:%Y-%m-%d %H:%M} -> {b:%Y-%m-%d %H:%M} UTC (rouge: global_ref, orange: ref)')
|
||||
fig.tight_layout()
|
||||
fig.savefig(OUT + f'{col}_{suf}.png', dpi=70)
|
||||
plt.close(fig)
|
||||
|
||||
cam = [(t, d) for t, d in camera() if a <= t <= b]
|
||||
sig = [(t, d['sigma0']) for t, d in rows[ordre[0]] if a <= t <= b]
|
||||
fig, axs = plt.subplots(5, 1, figsize=(16, 9), sharex=True)
|
||||
for ax, k in zip(axs, ('pan', 'tilt', 'rotation', 'scale')):
|
||||
ax.plot([t for t, _ in cam], [d[k] for _, d in cam], '.', ms=2)
|
||||
ax.set_ylabel(k)
|
||||
ax.grid(alpha=.3)
|
||||
axs[4].plot([t for t, _ in sig], [v for _, v in sig], '.', ms=2, color='C3')
|
||||
axs[4].set_ylabel('sigma0')
|
||||
axs[4].set_yscale('symlog', linthresh=1e-4)
|
||||
axs[4].grid(alpha=.3)
|
||||
axs[0].set_title(f'pose camera et sigma0 {a:%Y-%m-%d %H:%M} -> {b:%Y-%m-%d %H:%M} UTC')
|
||||
fig.tight_layout()
|
||||
fig.savefig(OUT + f'camera_{suf}.png', dpi=70)
|
||||
@@ -0,0 +1,29 @@
|
||||
"""Par heure : sigma0 médian, médiane des error_value des cibles et des global_ref, et
|
||||
pour chaque capteur l'écart de son error_value à sa propre médiane du jour précédent (xMAD) si > 5.
|
||||
usage : heures.py DEBUT FIN"""
|
||||
import sys, statistics as st
|
||||
from datetime import datetime, timedelta
|
||||
sys.path.insert(0, 'vues-deplacements/aiguiser/2026-10-26T1729Z_CLARIDEN/lot-01/corrige')
|
||||
from lit import charge
|
||||
|
||||
a, b = (datetime.fromisoformat(x + '+00:00') for x in sys.argv[1:3])
|
||||
rows, types = charge(str((a - timedelta(days=1)).date()), str(b.date()) + 'z')
|
||||
h = a
|
||||
while h < b:
|
||||
ligne, sig, et, er, hors = '', [], [], [], []
|
||||
for s, L in rows.items():
|
||||
cur = [d for t, d in L if h <= t < h + timedelta(hours=1)]
|
||||
ref = [d['error_value'] for t, d in L if h - timedelta(hours=24) <= t < h and d['error_value'] is not None]
|
||||
if not cur:
|
||||
continue
|
||||
sig += [d['sigma0'] for d in cur if d['sigma0'] is not None]
|
||||
e = [d['error_value'] for d in cur if d['error_value'] is not None]
|
||||
(er if types[s] == 'global_ref' else et).extend(e)
|
||||
if len(ref) > 20 and e:
|
||||
m = st.median(ref)
|
||||
mad = st.median([abs(v - m) for v in ref]) or 1e-4
|
||||
z = (max(e) - m) / mad
|
||||
if z > 8:
|
||||
hors.append(f'{s}:{max(e):.3f}({z:.0f})')
|
||||
print(f'{h:%m-%d %H} s0 {st.median(sig):.4f} eT {st.median(et):.3f} eR {st.median(er):.3f} n{len(hors)} ' + ' '.join(hors))
|
||||
h += timedelta(hours=1)
|
||||
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 37 KiB |
|
After Width: | Height: | Size: 122 KiB |
|
After Width: | Height: | Size: 80 KiB |
|
After Width: | Height: | Size: 73 KiB |
|
After Width: | Height: | Size: 107 KiB |
|
After Width: | Height: | Size: 59 KiB |
|
After Width: | Height: | Size: 73 KiB |
|
After Width: | Height: | Size: 137 KiB |
|
After Width: | Height: | Size: 101 KiB |
|
After Width: | Height: | Size: 55 KiB |
@@ -0,0 +1,37 @@
|
||||
"""Par capteur et par jour : n mesures, rejets, médiane/max de error_value,
|
||||
médiane et étendue p5-p95 de corr_x/corr_y, médiane de x/y, reproj_err, inlier=0."""
|
||||
import sys, statistics as st
|
||||
sys.path.insert(0, 'vues-deplacements/aiguiser/2026-10-26T1729Z_CLARIDEN/lot-01/corrige')
|
||||
from lit import charge
|
||||
|
||||
rows, types = charge()
|
||||
|
||||
|
||||
def q(v, p):
|
||||
v = sorted(v)
|
||||
return v[min(len(v) - 1, int(p * len(v)))] if v else None
|
||||
|
||||
|
||||
def fm(x, n=3):
|
||||
return ' - ' if x is None else f'{x:.{n}f}'
|
||||
|
||||
|
||||
for s in sorted(rows, key=lambda s: (types[s], s)):
|
||||
print(f'== {s} ({types[s]})')
|
||||
print('jour n rej errMed errMax cxMed cx5-95 cyMed cy5-95 xMed yMed reproj inl0')
|
||||
jours = sorted({t.date() for t, _ in rows[s]})
|
||||
for j in jours:
|
||||
L = [d for t, d in rows[s] if t.date() == j]
|
||||
e = [d['error_value'] for d in L if d['error_value'] is not None]
|
||||
rej = sum(1 for d in L if d['error_value'] is not None and d['error_value'] > d['error_threshold'])
|
||||
cx = [d['corr_x'] for d in L if d['corr_x'] is not None]
|
||||
cy = [d['corr_y'] for d in L if d['corr_y'] is not None]
|
||||
xs = [d['x'] for d in L if d['x'] is not None]
|
||||
ys = [d['y'] for d in L if d['y'] is not None]
|
||||
rp = [d['reproj_err'] for d in L if d['reproj_err'] is not None]
|
||||
i0 = sum(1 for d in L if d['inlier'] == 0)
|
||||
print(f'{j} {len(L):4d} {rej:3d} {fm(st.median(e) if e else None)} {fm(max(e) if e else None)} '
|
||||
f'{fm(st.median(cx) if cx else None)} {fm((q(cx,.95)-q(cx,.05)) if cx else None)} '
|
||||
f'{fm(st.median(cy) if cy else None)} {fm((q(cy,.95)-q(cy,.05)) if cy else None)} '
|
||||
f'{fm(st.median(xs) if xs else None,2)} {fm(st.median(ys) if ys else None,2)} '
|
||||
f'{fm(st.median(rp) if rp else None)} {i0}')
|
||||
@@ -0,0 +1,43 @@
|
||||
"""Chargement des exports advanced et camera de CLARIDEN (bibliothèque standard)."""
|
||||
import csv, glob, os
|
||||
from datetime import datetime
|
||||
|
||||
D = 'data/CLARIDEN'
|
||||
NUM = ['x', 'y', 'error_value', 'error_threshold', 'relative_x', 'relative_y',
|
||||
'corr_x', 'corr_y', 'reproj_err', 'inlier', 'sigma0']
|
||||
|
||||
|
||||
def f(v):
|
||||
try:
|
||||
x = float(v)
|
||||
return x if x == x and abs(x) != float('inf') else None
|
||||
except (TypeError, ValueError):
|
||||
return None
|
||||
|
||||
|
||||
def charge(debut='2026-09-12', fin='2026-09-26'):
|
||||
"""dict capteur -> liste de lignes (t, dict), triée ; plus types."""
|
||||
rows, types = {}, {}
|
||||
for p in sorted(glob.glob(f'{D}/displacement/CLARIDEN_advanced_*.csv')):
|
||||
j = os.path.basename(p)[-12:-4]
|
||||
j = f'{j[:4]}-{j[4:6]}-{j[6:]}'
|
||||
if not (debut <= j < fin):
|
||||
continue
|
||||
for r in csv.DictReader(open(p)):
|
||||
t = datetime.fromisoformat(r['time_utc'])
|
||||
d = {k: f(r[k]) for k in NUM}
|
||||
rows.setdefault(r['sensor_name'], []).append((t, d))
|
||||
types[r['sensor_name']] = r['pattern_type']
|
||||
for v in rows.values():
|
||||
v.sort(key=lambda a: a[0])
|
||||
return rows, types
|
||||
|
||||
|
||||
def camera():
|
||||
out = []
|
||||
for p in sorted(glob.glob(f'{D}/camera/CLARIDEN_camera_*.csv')):
|
||||
for r in csv.DictReader(open(p)):
|
||||
out.append((datetime.fromisoformat(r['time_utc']),
|
||||
{k: f(r['median_' + k]) for k in ('pan', 'tilt', 'scale', 'rotation', 'sigma0')}))
|
||||
out.sort(key=lambda a: a[0])
|
||||
return out
|
||||
@@ -0,0 +1,29 @@
|
||||
"""Luminosité des images : moyenne et 99,9e centile du gris (1 px sur 8), image entière et bande
|
||||
des cibles (y 550-1250), et nombre de px très brillants (> 200) ; une ligne par image, et une figure."""
|
||||
import glob, os, sys
|
||||
from datetime import datetime
|
||||
import numpy as np
|
||||
import matplotlib
|
||||
matplotlib.use('Agg')
|
||||
import matplotlib.pyplot as plt
|
||||
import matplotlib.image as mpimg
|
||||
|
||||
OUT = 'vues-deplacements/aiguiser/2026-10-26T1729Z_CLARIDEN/lot-01/corrige/'
|
||||
a, b = sys.argv[1:3]
|
||||
res = []
|
||||
for p in sorted(glob.glob('data/CLARIDEN/images/*.jpg')):
|
||||
k = os.path.basename(p)[:13]
|
||||
if not (a <= k <= b):
|
||||
continue
|
||||
im = mpimg.imread(p)[::8, ::8]
|
||||
im = im.mean(axis=2) if im.ndim == 3 else im
|
||||
band = im[550 // 8:1250 // 8]
|
||||
res.append((datetime.strptime(k, '%Y%m%dT%H%M'), im.mean(), band.mean(), (band > 200).sum()))
|
||||
for r in res:
|
||||
print(f'{r[0]:%m-%d %H:%M} moy {r[1]:6.2f} bande {r[2]:6.2f} brillants {r[3]}')
|
||||
fig, axs = plt.subplots(2, 1, figsize=(16, 5), sharex=True)
|
||||
axs[0].plot([r[0] for r in res], [r[1] for r in res], '.-', ms=3, label='image')
|
||||
axs[0].plot([r[0] for r in res], [r[2] for r in res], '.-', ms=3, label='bande des cibles')
|
||||
axs[0].legend(); axs[0].set_ylabel('gris moyen'); axs[0].grid(alpha=.3)
|
||||
axs[1].plot([r[0] for r in res], [r[3] for r in res], '.', ms=3); axs[1].set_ylabel('px > 200'); axs[1].grid(alpha=.3)
|
||||
fig.tight_layout(); fig.savefig(OUT + f'luminosite_{a}_{b}.png', dpi=70)
|
||||
|
After Width: | Height: | Size: 45 KiB |
@@ -0,0 +1,13 @@
|
||||
"""Montées lentes de error_value : rapport de la médiane d'une fenêtre B à celle d'une fenêtre A, par capteur.
|
||||
usage : montees.py A_DEBUT A_FIN B_DEBUT B_FIN"""
|
||||
import sys, statistics as st
|
||||
from datetime import datetime
|
||||
sys.path.insert(0, 'vues-deplacements/aiguiser/2026-10-26T1729Z_CLARIDEN/lot-01/corrige')
|
||||
from lit import charge
|
||||
a0, a1, b0, b1 = (datetime.fromisoformat(x + '+00:00') for x in sys.argv[1:5])
|
||||
rows, types = charge(str(a0.date()), str(b1.date()) + 'z')
|
||||
for s, L in sorted(rows.items()):
|
||||
A = [d['error_value'] for t, d in L if a0 <= t < a1 and d['error_value'] is not None]
|
||||
B = [d['error_value'] for t, d in L if b0 <= t < b1 and d['error_value'] is not None]
|
||||
mA, mB = st.median(A), st.median(B)
|
||||
print(f'{s:9s} {types[s]:10s} {mA:.3f} -> {mB:.3f} x{mB / mA:.1f}')
|
||||
@@ -0,0 +1,34 @@
|
||||
"""Pas à pas (10 min) entre deux instants : sigma0, pose caméra, médiane des error_value
|
||||
(cibles / refs), nombre de rejets, et pour des capteurs choisis x, y, err, corr_x, corr_y, inlier.
|
||||
usage : pas.py DEBUT FIN [capteur ...]"""
|
||||
import sys, statistics as st
|
||||
from datetime import datetime
|
||||
sys.path.insert(0, 'vues-deplacements/aiguiser/2026-10-26T1729Z_CLARIDEN/lot-01/corrige')
|
||||
from lit import charge, camera
|
||||
|
||||
a, b = (datetime.fromisoformat(x + '+00:00') for x in sys.argv[1:3])
|
||||
caps = sys.argv[3:]
|
||||
rows, types = charge(str(a.date()), str(b.date()) + 'z')
|
||||
cam = {t.replace(second=0, microsecond=0): d for t, d in camera()}
|
||||
par_t = {}
|
||||
for s, L in rows.items():
|
||||
for t, d in L:
|
||||
if a <= t <= b:
|
||||
par_t.setdefault(t.replace(second=0, microsecond=0), {})[s] = d
|
||||
for t in sorted(par_t):
|
||||
M = par_t[t]
|
||||
et = [d['error_value'] for s, d in M.items() if types[s] == 'target' and d['error_value'] is not None]
|
||||
er = [d['error_value'] for s, d in M.items() if types[s] == 'global_ref' and d['error_value'] is not None]
|
||||
rej = [s for s, d in M.items() if d['error_value'] is not None and d['error_value'] > d['error_threshold']]
|
||||
sig = next(iter(M.values()))['sigma0']
|
||||
c = cam.get(t)
|
||||
cs = f"pan {c['pan']:+.4f} tilt {c['tilt']:+.4f} rot {c['rotation']:+.4f} sc {c['scale']:.6f}" if c else 'cam -'
|
||||
ligne = f"{t:%m-%d %H:%M} n{len(M):2d} s0 {sig if sig is None else round(sig,4)} {cs} eT {st.median(et):.3f} eR {st.median(er):.3f} rej {len(rej)}"
|
||||
for s in caps:
|
||||
d = M.get(s)
|
||||
if d:
|
||||
g = lambda k: '-' if d[k] is None else f'{d[k]:.3f}'
|
||||
ligne += f" | {s} x{g('x')} y{g('y')} e{g('error_value')} cx{g('corr_x')} cy{g('corr_y')} i{g('inlier')}"
|
||||
if rej and len(rej) < 5:
|
||||
ligne += ' rej:' + ','.join(rej)
|
||||
print(ligne)
|
||||
@@ -0,0 +1,29 @@
|
||||
"""Instants où plusieurs capteurs ont un error_value hors de leur niveau habituel
|
||||
(médiane et MAD du capteur sur les 24 h précédentes, > SEUIL MAD), avec le sens du pic sur corr.
|
||||
usage : pics.py DEBUT FIN [SEUIL=10] [MIN_CAPTEURS=1]"""
|
||||
import sys, statistics as st
|
||||
from datetime import datetime, timedelta
|
||||
sys.path.insert(0, 'vues-deplacements/aiguiser/2026-10-26T1729Z_CLARIDEN/lot-01/corrige')
|
||||
from lit import charge
|
||||
|
||||
a, b = (datetime.fromisoformat(x + '+00:00') for x in sys.argv[1:3])
|
||||
seuil = float(sys.argv[3]) if len(sys.argv) > 3 else 10
|
||||
mini = int(sys.argv[4]) if len(sys.argv) > 4 else 1
|
||||
rows, types = charge(str((a - timedelta(days=1)).date()), str(b.date()) + 'z')
|
||||
par_t = {}
|
||||
for s, L in rows.items():
|
||||
for i, (t, d) in enumerate(L):
|
||||
if not (a <= t <= b) or d['error_value'] is None:
|
||||
continue
|
||||
ref = [e['error_value'] for u, e in L[max(0, i - 144):i] if e['error_value'] is not None]
|
||||
if len(ref) < 30:
|
||||
continue
|
||||
m = st.median(ref)
|
||||
mad = st.median([abs(v - m) for v in ref]) or 1e-4
|
||||
z = (d['error_value'] - m) / mad
|
||||
if z > seuil:
|
||||
par_t.setdefault(t.replace(second=0, microsecond=0), []).append(
|
||||
f"{s}{'*' if types[s] != 'target' else ''}:{d['error_value']:.3f}({z:.0f})")
|
||||
for t in sorted(par_t):
|
||||
if len(par_t[t]) >= mini:
|
||||
print(f'{t:%m-%d %H:%M} n{len(par_t[t]):2d} ' + ' '.join(par_t[t]))
|
||||
@@ -0,0 +1,17 @@
|
||||
"""x, y bruts des références globales face à la médiane des cibles, par rapport à un instant de base.
|
||||
usage : refs_cibles.py BASE INSTANT [...] (AAAA-MM-JJTHH:MM)"""
|
||||
import sys, statistics as st
|
||||
from datetime import datetime
|
||||
sys.path.insert(0, 'vues-deplacements/aiguiser/2026-10-26T1729Z_CLARIDEN/lot-01/corrige')
|
||||
from lit import charge
|
||||
rows, types = charge('2026-09-18', '2026-09-21')
|
||||
idx = {s: {t.strftime('%Y-%m-%dT%H:%M'): d for t, d in L} for s, L in rows.items()}
|
||||
base, inst = sys.argv[1], sys.argv[2:]
|
||||
refs = sorted(s for s in rows if types[s] == 'global_ref')
|
||||
cib = [s for s in rows if types[s] != 'global_ref' and s != 'PR_BG']
|
||||
for k in inst:
|
||||
out = k
|
||||
for c in 'xy':
|
||||
dc = st.median(idx[s][k][c] - idx[s][base][c] for s in cib)
|
||||
out += f' | {c} cibles {dc:+.2f} ; réf − cibles :' + ''.join(f' {s} {idx[s][k][c] - idx[s][base][c] - dc:+.2f}' for s in refs)
|
||||
print(out)
|
||||
|
After Width: | Height: | Size: 129 KiB |
|
After Width: | Height: | Size: 97 KiB |
@@ -0,0 +1,23 @@
|
||||
"""Mouvement de corps rigide (similitude : translation, rotation, échelle) ajusté sur les cibles entre un instant de base
|
||||
et un instant donné ; résidu de chaque capteur (px) face à ce mouvement. Sépare ce qui bouge avec la scène de ce qui bouge seul.
|
||||
usage : .venv/bin/python rigide.py BASE INSTANT [...] (AAAA-MM-JJTHH:MM)"""
|
||||
import sys
|
||||
import numpy as np
|
||||
sys.path.insert(0, 'vues-deplacements/aiguiser/2026-10-26T1729Z_CLARIDEN/lot-01/corrige')
|
||||
from lit import charge
|
||||
rows, types = charge('2026-09-18', '2026-09-21')
|
||||
idx = {s: {t.strftime('%Y-%m-%dT%H:%M'): d for t, d in L} for s, L in rows.items()}
|
||||
base, inst = sys.argv[1], sys.argv[2:]
|
||||
cib = [s for s in rows if types[s] != 'global_ref' and s not in ('PR_BG', 'D-303-A')]
|
||||
refs = sorted(s for s in rows if types[s] == 'global_ref')
|
||||
for k in inst:
|
||||
P = np.array([[idx[s][base]['x'], idx[s][base]['y']] for s in cib]); Q = np.array([[idx[s][k]['x'], idx[s][k]['y']] for s in cib])
|
||||
A = np.zeros((2 * len(cib), 4)); A[0::2] = np.c_[P[:, 0], -P[:, 1], np.ones(len(P)), np.zeros(len(P))]; A[1::2] = np.c_[P[:, 1], P[:, 0], np.zeros(len(P)), np.ones(len(P))]
|
||||
a, b, tx, ty = np.linalg.lstsq(A, Q.ravel(), rcond=None)[0]
|
||||
f = lambda p: np.array([a * p[0] - b * p[1] + tx, b * p[0] + a * p[1] + ty])
|
||||
rc = [np.hypot(*(np.array([idx[s][k]['x'], idx[s][k]['y']]) - f([idx[s][base]['x'], idx[s][base]['y']]))) for s in cib]
|
||||
out = f'{k} rot {np.degrees(np.arctan2(b, a)):+.3f}° éch {np.hypot(a, b):.5f} | résidu cibles médiane {np.median(rc):.2f} max {max(rc):.2f} | réf (dx, dy) :'
|
||||
for s in refs:
|
||||
r = np.array([idx[s][k]['x'], idx[s][k]['y']]) - f([idx[s][base]['x'], idx[s][base]['y']])
|
||||
out += f' {s} {r[0]:+.2f},{r[1]:+.2f}'
|
||||
print(out)
|
||||
@@ -0,0 +1,20 @@
|
||||
"""Brillance de la tache de capteurs choisis (p99 et somme au-dessus du fond, cadre ±R px autour de x, y de l'export), à plusieurs instants.
|
||||
usage : taches.py R AAAAMMJJTHHMM[,...] capteur [...]"""
|
||||
import sys, glob
|
||||
import numpy as np
|
||||
import matplotlib.image as mpimg
|
||||
sys.path.insert(0, 'vues-deplacements/aiguiser/2026-10-26T1729Z_CLARIDEN/lot-01/corrige')
|
||||
from lit import charge
|
||||
R = int(sys.argv[1]); inst = sys.argv[2].split(','); caps = sys.argv[3:]
|
||||
rows, _ = charge('2026-09-15', '2026-09-21')
|
||||
for k in inst:
|
||||
im = mpimg.imread(glob.glob(f'data/CLARIDEN/images/{k}Z_*.jpg')[0]).astype(float)
|
||||
if im.ndim == 3: im = im.mean(axis=2)
|
||||
out = f'{k} moy {im.mean():5.2f} |'
|
||||
for s in caps:
|
||||
d = next((d for u, d in rows[s] if u.strftime('%Y%m%dT%H%M') == k), None)
|
||||
x, y = int(round(d['x'])), int(round(d['y']))
|
||||
c = im[y - R:y + R + 1, x - R:x + R + 1]
|
||||
fond = np.median(im[y - 4 * R:y + 4 * R, x - 4 * R:x + 4 * R])
|
||||
out += f' {s} p99 {np.percentile(c, 99):5.0f} flux {np.clip(c - fond, 0, None).sum():7.0f} fond {fond:3.0f} |'
|
||||
print(out)
|
||||
@@ -0,0 +1,35 @@
|
||||
"""Gros plans des images : un cadre (x0 y0 x1 y1, px de l'image) à plusieurs instants, côte à côte,
|
||||
contraste étiré, positions des capteurs (x, y de l'export) marquées.
|
||||
usage : vignettes.py NOM x0 y0 x1 y1 AAAAMMJJTHHMM [...]"""
|
||||
import sys, glob
|
||||
from datetime import datetime
|
||||
import matplotlib
|
||||
matplotlib.use('Agg')
|
||||
import matplotlib.pyplot as plt
|
||||
import matplotlib.image as mpimg
|
||||
sys.path.insert(0, 'vues-deplacements/aiguiser/2026-10-26T1729Z_CLARIDEN/lot-01/corrige')
|
||||
from lit import charge
|
||||
|
||||
nom = sys.argv[1]
|
||||
x0, y0, x1, y1 = map(int, sys.argv[2:6])
|
||||
instants = sys.argv[6:]
|
||||
rows, types = charge('2026-09-15', '2026-09-21')
|
||||
fig, axs = plt.subplots(1, len(instants), figsize=(4.5 * len(instants), 4.5 * (y1 - y0) / (x1 - x0) + .6))
|
||||
if len(instants) == 1:
|
||||
axs = [axs]
|
||||
for ax, k in zip(axs, instants):
|
||||
p = glob.glob(f'data/CLARIDEN/images/{k}Z_*.jpg')[0]
|
||||
im = mpimg.imread(p)[y0:y1, x0:x1].astype(float)
|
||||
if im.ndim == 3:
|
||||
im = im.mean(axis=2)
|
||||
hi = max(im.max() * .6, 1)
|
||||
ax.imshow(im, cmap='gray', vmin=0, vmax=hi, extent=(x0, x1, y1, y0))
|
||||
t = datetime.strptime(k, '%Y%m%dT%H%M')
|
||||
for s, L in rows.items():
|
||||
d = next((d for u, d in L if u.strftime('%Y%m%dT%H%M') == k), None)
|
||||
if d and d['x'] and x0 <= d['x'] <= x1 and y0 <= d['y'] <= y1:
|
||||
ax.plot(d['x'], d['y'], '+', color='r' if types[s] != 'target' else 'c', ms=8)
|
||||
ax.text(d['x'] + 3, d['y'] - 3, s, color='y', fontsize=7)
|
||||
ax.set_title(f'{t:%m-%d %H:%M} UTC', fontsize=9)
|
||||
fig.tight_layout()
|
||||
fig.savefig(f'vues-deplacements/aiguiser/2026-10-26T1729Z_CLARIDEN/lot-01/corrige/img_{nom}.png', dpi=80)
|
||||
|
After Width: | Height: | Size: 173 KiB |
|
After Width: | Height: | Size: 107 KiB |
|
After Width: | Height: | Size: 170 KiB |
|
After Width: | Height: | Size: 108 KiB |
@@ -0,0 +1,12 @@
|
||||
"""Gros plan d'une zone de l'image (centre X, Y, demi-côté R) à plusieurs instants, cadre fixe.
|
||||
usage : zone.py X Y R AAAAMMJJTHHMM[,...] sortie.png"""
|
||||
import sys, glob
|
||||
import matplotlib; matplotlib.use('Agg')
|
||||
import matplotlib.pyplot as plt, matplotlib.image as mpimg
|
||||
X, Y, R = map(int, sys.argv[1:4]); inst = sys.argv[4].split(','); out = sys.argv[5]
|
||||
fig, ax = plt.subplots(1, len(inst), figsize=(3.2 * len(inst), 3.4))
|
||||
for a, k in zip(ax, inst):
|
||||
im = mpimg.imread(glob.glob(f'data/CLARIDEN/images/{k}Z_*.jpg')[0])
|
||||
a.imshow(im[Y - R:Y + R, X - R:X + R], cmap='gray', vmin=0, vmax=80, extent=(X - R, X + R, Y + R, Y - R))
|
||||
a.set_title(k[4:], fontsize=9)
|
||||
fig.suptitle(f'cadre fixe centré ({X}, {Y}), ±{R} px, gris 0-80'); fig.tight_layout(); fig.savefig(out, dpi=90)
|
||||
|
After Width: | Height: | Size: 57 KiB |