.
This commit is contained in:
1 parent
8e4ebca342
commit
58b630f2d5
112 files changed
+3172
-295
No files matched your search
@@ -0,0 +1,28 @@
|
||||
"""Drift of each target over a range against its distance: parallax check.
|
||||
Drift = median of the last N accepted measurements minus median of the first N (corr_x, corr_y, px and mm)."""
|
||||
import sys, statistics as st
|
||||
sys.path.insert(0, "tools/scripts")
|
||||
import data
|
||||
F = "data/BREITHORN"
|
||||
M = data.load(F); T = data.load_targets(F)
|
||||
refs = [s for s in M if data.is_reference(M[s])]
|
||||
inv_ref = st.mean(1000 / T[s]["distance_mm"] for s in refs if T.get(s, {}).get("distance_mm"))
|
||||
print("references:", {s: T[s]["distance_mm"] / 1000 for s in refs}, "mean 1/d_ref = %.4f /m" % inv_ref)
|
||||
N = 6
|
||||
for a, b in [(sys.argv[i], sys.argv[i + 1]) for i in range(1, len(sys.argv), 2)]:
|
||||
A, B = data.parse_time(a), data.parse_time(b)
|
||||
print(f"\n== {a} -> {b} (parallax term p = 1/d - mean 1/d_ref, /m)")
|
||||
print(f"{'sensor':10} {'d_m':>5} {'p':>7} {'dcx_px':>8} {'dcy_px':>8} {'dcx_mm':>7} {'dcy_mm':>7} {'n':>3}")
|
||||
rows = []
|
||||
for s in sorted(M, key=lambda s: T.get(s, {}).get("distance_mm") or 0):
|
||||
if s in refs: continue
|
||||
w = [m for m in data.filter_window(M[s], A, B) if m["corr_x"] is not None]
|
||||
if len(w) < 2 * N: print(s, "too few"); continue
|
||||
d = T[s]["distance_mm"] / 1000; p = 1 / d - inv_ref
|
||||
dd = {c: st.median(m[c] for m in w[-N:]) - st.median(m[c] for m in w[:N]) for c in ("corr_x", "corr_y", "corr_x_mm", "corr_y_mm")}
|
||||
rows.append((p, dd["corr_x"], dd["corr_y"]))
|
||||
print(f"{s:10} {d:5.1f} {p:7.4f} {dd['corr_x']:+8.4f} {dd['corr_y']:+8.4f} {dd['corr_x_mm']:+7.3f} {dd['corr_y_mm']:+7.3f} {len(w):3d}")
|
||||
for k, c in ((1, "corr_x"), (2, "corr_y")):
|
||||
xs = [r[0] for r in rows]; ys = [r[k] for r in rows]
|
||||
r = st.correlation(xs, ys); sl = st.linear_regression(xs, ys)
|
||||
print(f"{c}: r with p = {r:+.2f}, slope {sl.slope:+.3f} px*m, intercept {sl.intercept:+.4f} px")
|
||||
Reference in new issue
Block a user