2026-10-16 14:52:24 +02:00
|
|
|
|
<!doctype html>
|
|
|
|
|
|
<html lang="en">
|
|
|
|
|
|
<head>
|
|
|
|
|
|
<meta charset="utf-8">
|
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
|
|
|
<title><!--PLATFORM--> · Explore</title>
|
|
|
|
|
|
<script src="https://cdn.plot.ly/plotly-4.1.1.min.js"></script>
|
|
|
|
|
|
<style>
|
|
|
|
|
|
/* Maquette de la page Explore avec l'onglet Diagnosis (D-053, vues-deplacements/maquette/spec.md). Données injectées
|
|
|
|
|
|
par explore.py. Habillage repris de maquettes/user/summary_template.html. */
|
|
|
|
|
|
:root {
|
|
|
|
|
|
--sidebar: #2a3f54; --topbar: #ededed; --page: #f7f7f7; --panel-border: #e6e9ed;
|
|
|
|
|
|
--muted: #73879c; --text: #333; --line: #dee2e6; --blue: #2a78d6;
|
|
|
|
|
|
}
|
|
|
|
|
|
* { box-sizing: border-box; }
|
|
|
|
|
|
body { margin: 0; background: var(--page); color: var(--muted);
|
|
|
|
|
|
font: 13px/1.47 "Helvetica Neue", Roboto, Arial, "Droid Sans", sans-serif; }
|
|
|
|
|
|
svg.i { width: 15px; height: 15px; fill: currentColor; vertical-align: -2px; }
|
|
|
|
|
|
|
|
|
|
|
|
.sidebar { position: fixed; inset: 0 auto 0 0; width: 230px; background: var(--sidebar); color: #fff; }
|
|
|
|
|
|
.brand { height: 57px; padding: 0 10px; display: flex; align-items: center; font-size: 22px; }
|
|
|
|
|
|
.profile { display: flex; align-items: center; gap: 22px; padding: 18px 12px 24px; }
|
|
|
|
|
|
.avatar { width: 56px; height: 56px; border-radius: 50%; background: #9b59b6; border: 3px solid #fff;
|
|
|
|
|
|
display: grid; place-items: center; font-size: 19px; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
|
|
|
|
|
|
.profile small { display: block; color: #bab8b8; font-size: 13px; }
|
|
|
|
|
|
.profile span { font-size: 14px; }
|
|
|
|
|
|
.section { padding: 0 23px 18px; font-size: 11px; font-weight: bold; letter-spacing: .3px; }
|
|
|
|
|
|
.nav a { display: flex; align-items: center; gap: 4px; padding: 13px 15px; color: #e7e7e7;
|
|
|
|
|
|
text-decoration: none; font-weight: bold; }
|
|
|
|
|
|
.nav a .chev { margin-left: auto; }
|
|
|
|
|
|
|
|
|
|
|
|
.topbar { margin-left: 230px; height: 52px; background: var(--topbar); border-bottom: 1px solid #d9dee4;
|
|
|
|
|
|
display: flex; align-items: center; justify-content: space-between; padding: 0 15px; }
|
|
|
|
|
|
.topbar .burger { color: #5a738e; width: 26px; height: 26px; }
|
|
|
|
|
|
.user { display: flex; align-items: center; gap: 10px; color: #515356; }
|
|
|
|
|
|
.user .avatar { width: 29px; height: 29px; border-width: 0; font-size: 11px; box-shadow: none; }
|
|
|
|
|
|
|
|
|
|
|
|
main { margin-left: 230px; padding: 10px 28px; }
|
|
|
|
|
|
.panel { background: #fff; border: 1px solid var(--panel-border); padding: 10px 17px 20px; }
|
|
|
|
|
|
.panel-title { display: flex; align-items: center; border-bottom: 2px solid var(--panel-border); padding: 4px 6px 12px; }
|
|
|
|
|
|
.panel-title h2 { margin: 0; font-size: 18px; font-weight: 400; }
|
|
|
|
|
|
.panel-title h2 small { font-size: 14px; margin-left: 10px; }
|
|
|
|
|
|
.panel-title .tools { margin-left: auto; color: #c5c7cb; }
|
|
|
|
|
|
|
|
|
|
|
|
/* Période (inerte) et onglets, comme la page Explore de la plateforme. */
|
|
|
|
|
|
.period { display: flex; margin: 22px 22px 0; }
|
|
|
|
|
|
.period span { border: 1px solid #ced4da; border-radius: 4px 0 0 4px; padding: 7px 12px; color: var(--text); font-size: 15px; }
|
|
|
|
|
|
.period b { background: #6c757d; color: #fff; padding: 7px 12px; font-weight: normal; font-size: 15px; border-radius: 0 4px 4px 0; }
|
|
|
|
|
|
.tabs { display: flex; margin: 18px 22px 0; border-bottom: 1px solid var(--line); }
|
|
|
|
|
|
.tabs button { border: 1px solid transparent; border-bottom: 0; background: none; padding: 7px 16px; margin-bottom: -1px;
|
|
|
|
|
|
font: inherit; font-size: 15px; color: var(--blue); cursor: pointer; border-radius: 4px 4px 0 0; }
|
|
|
|
|
|
.tabs button.active { color: var(--text); background: #fff; border-color: var(--line); }
|
|
|
|
|
|
.pane { display: none; margin: 0 22px; padding-top: 14px; }
|
|
|
|
|
|
.pane.active { display: block; }
|
|
|
|
|
|
.pane > img { display: block; width: 100%; margin-bottom: 8px; border: 1px solid var(--line); }
|
|
|
|
|
|
.empty { padding: 30px 0; color: var(--muted); }
|
2026-10-16 14:53:52 +02:00
|
|
|
|
|
|
|
|
|
|
/* Onglet Diagnosis (spec §1 à §3). */
|
2026-10-16 16:48:38 +02:00
|
|
|
|
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; color: var(--text); font-size: 14px;
|
|
|
|
|
|
white-space: nowrap; }
|
2026-10-16 14:53:52 +02:00
|
|
|
|
.toolbar button { border: 1px solid var(--line); background: #fff; border-radius: 4px; padding: 4px 10px;
|
|
|
|
|
|
font: inherit; cursor: pointer; }
|
|
|
|
|
|
.toolbar button.active { background: var(--blue); border-color: var(--blue); color: #fff; }
|
|
|
|
|
|
.toolbar .meta { margin-left: auto; color: var(--muted); }
|
2026-10-16 14:54:22 +02:00
|
|
|
|
|
2026-10-16 16:48:38 +02:00
|
|
|
|
/* Onglet View (spec « L'onglet View ») : images au glisseur, film, comparaison à ±24 h, zoom commun. */
|
|
|
|
|
|
.viewer { margin: 0 auto; width: min(100%, calc((100vh - 370px) * 1.5 * var(--n, 1))); }
|
|
|
|
|
|
.frames { display: flex; gap: 8px; }
|
|
|
|
|
|
.frame { flex: 1; position: relative; margin: 0; aspect-ratio: 3 / 2; overflow: hidden; background: #000;
|
|
|
|
|
|
cursor: grab; touch-action: none; user-select: none; }
|
|
|
|
|
|
.layer { position: absolute; inset: 0; transform-origin: 0 0; } /* l'image et ses repères, zoomés ensemble */
|
|
|
|
|
|
.layer > * { position: absolute; inset: 0; width: 100%; height: 100%; }
|
|
|
|
|
|
/* Cercle et nom de chaque capteur ; le nom garde sa taille à l'écran quel que soit le zoom (font-size, voir zoom()). */
|
|
|
|
|
|
.marks { overflow: visible; pointer-events: none; font-family: sans-serif; }
|
|
|
|
|
|
.marks circle { fill: none; stroke: currentColor; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
|
|
|
|
|
|
.marks text { fill: currentColor; text-anchor: middle; paint-order: stroke; stroke: rgba(0,0,0,.85); stroke-width: .25em;
|
|
|
|
|
|
stroke-linejoin: round; }
|
|
|
|
|
|
.marks .target { color: #ffd400; }
|
|
|
|
|
|
.marks .global_ref { color: #3cc8ff; }
|
|
|
|
|
|
.marks .ref { color: #ff9f1c; }
|
|
|
|
|
|
.marks .sel text { font-weight: bold; text-decoration: underline; }
|
|
|
|
|
|
.marks .sel circle { stroke-width: 3; }
|
|
|
|
|
|
.marks .over circle { stroke-width: 3; stroke-dasharray: 5 3; } /* error_value au-dessus du seuil : mesure rejetée */
|
|
|
|
|
|
.strip figcaption.over { color: #d0021b; }
|
|
|
|
|
|
.legend b { font-weight: normal; padding: 0 4px; border-radius: 3px; background: #333; }
|
|
|
|
|
|
.frame figcaption { position: absolute; left: 8px; top: 6px; padding: 2px 8px; border-radius: 3px;
|
|
|
|
|
|
background: rgba(0,0,0,.6); color: #fff; font-size: 13px; pointer-events: none; }
|
|
|
|
|
|
#v-slider { width: 100%; margin: 10px 0 0; }
|
2026-10-16 16:53:25 +02:00
|
|
|
|
/* Bandes d'error_value (système, puis cible du gros plan) : une colonne par image, alignées sur le glisseur (8 px :
|
|
|
|
|
|
demi-curseur). */
|
|
|
|
|
|
#v-band { display: block; width: calc(100% - 16px); height: 19px; margin: 2px 8px 0; image-rendering: pixelated; cursor: pointer; }
|
2026-10-16 16:48:38 +02:00
|
|
|
|
.days { position: relative; height: 18px; font-size: 11px; }
|
|
|
|
|
|
.days span { position: absolute; transform: translateX(-50%); }
|
|
|
|
|
|
|
|
|
|
|
|
/* Gros plan d'une cible, avec les images d'avant et d'après (spec « L'onglet View »). */
|
|
|
|
|
|
.sub { margin: 22px 0 8px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 15px; color: var(--text); }
|
|
|
|
|
|
.toolbar input, .toolbar select { font: inherit; }
|
|
|
|
|
|
.note { margin: 0 0 10px; color: var(--text); }
|
|
|
|
|
|
.strip { display: flex; justify-content: safe center; align-items: flex-end; gap: 6px; overflow-x: auto; margin-bottom: 14px; }
|
|
|
|
|
|
.strip figure { flex: none; margin: 0; color: var(--text); font-size: 12px; white-space: pre-line; line-height: 1.3; }
|
|
|
|
|
|
.strip canvas { display: block; cursor: pointer; }
|
|
|
|
|
|
.strip .now canvas { outline: 2px solid var(--blue); cursor: default; }
|
|
|
|
|
|
|
2026-10-16 14:54:22 +02:00
|
|
|
|
/* Détail d'un capteur (spec §4). */
|
|
|
|
|
|
.detail { border: 1px solid var(--line); border-radius: 4px; margin-top: 10px; }
|
|
|
|
|
|
.detail header { display: flex; justify-content: space-between; align-items: center; padding: 6px 12px;
|
|
|
|
|
|
border-bottom: 1px solid var(--line); color: var(--text); font-size: 15px; }
|
|
|
|
|
|
.detail header button { border: 0; background: none; color: var(--muted); font-size: 20px; cursor: pointer; }
|
2026-10-16 14:52:24 +02:00
|
|
|
|
</style>
|
|
|
|
|
|
</head>
|
|
|
|
|
|
<body>
|
|
|
|
|
|
<svg style="display:none">
|
|
|
|
|
|
<symbol id="home" viewBox="0 0 20 20"><path d="M10 2 1 10h3v8h5v-5h2v5h5v-8h3z"/></symbol>
|
|
|
|
|
|
<symbol id="list" viewBox="0 0 20 20"><path d="M1 3h3v3H1zm5 0h13v3H6zM1 8.5h3v3H1zm5 0h13v3H6zM1 14h3v3H1zm5 0h13v3H6z"/></symbol>
|
|
|
|
|
|
<symbol id="cog" viewBox="0 0 20 20"><circle cx="10" cy="10" r="6" fill="none" stroke="currentColor" stroke-width="4" stroke-dasharray="2.4 2.3"/><circle cx="10" cy="10" r="5" fill="none" stroke="currentColor" stroke-width="3"/></symbol>
|
|
|
|
|
|
<symbol id="chev" viewBox="0 0 20 20"><path d="M4 7l6 6 6-6" fill="none" stroke="currentColor" stroke-width="2.2"/></symbol>
|
|
|
|
|
|
<symbol id="burger" viewBox="0 0 20 20"><path d="M2 4h16v2.4H2zm0 4.8h16v2.4H2zm0 4.8h16V16H2z"/></symbol>
|
|
|
|
|
|
<symbol id="wrench" viewBox="0 0 20 20"><path d="M13.5 1.5a5 5 0 0 0-4.6 6.9L2 15.3 4.7 18l6.9-6.9a5 5 0 0 0 6.9-4.6l-3 3-2.8-.6-.6-2.8z"/></symbol>
|
|
|
|
|
|
</svg>
|
|
|
|
|
|
|
|
|
|
|
|
<aside class="sidebar">
|
|
|
|
|
|
<div class="brand">AIMsight monitoring</div>
|
|
|
|
|
|
<div class="profile"><div class="avatar">MP</div><div><small>Welcome,</small><span>Maxime Pasquier</span></div></div>
|
|
|
|
|
|
<div class="section">GENERAL</div>
|
|
|
|
|
|
<nav class="nav">
|
|
|
|
|
|
<a><svg class="i"><use href="#home"/></svg>Home</a>
|
|
|
|
|
|
<a><svg class="i"><use href="#list"/></svg>Explore<svg class="i chev"><use href="#chev"/></svg></a>
|
|
|
|
|
|
<a><svg class="i"><use href="#cog"/></svg>Settings<svg class="i chev"><use href="#chev"/></svg></a>
|
|
|
|
|
|
</nav>
|
|
|
|
|
|
</aside>
|
|
|
|
|
|
|
|
|
|
|
|
<header class="topbar">
|
|
|
|
|
|
<svg class="burger"><use href="#burger"/></svg>
|
|
|
|
|
|
<div class="user"><div class="avatar">MP</div>Maxime Pasquier ▾</div>
|
|
|
|
|
|
</header>
|
|
|
|
|
|
|
|
|
|
|
|
<main>
|
|
|
|
|
|
<section class="panel">
|
|
|
|
|
|
<div class="panel-title">
|
|
|
|
|
|
<h2><!--PLATFORM--><small>Explore</small></h2>
|
|
|
|
|
|
<span class="tools"><svg class="i"><use href="#wrench"/></svg> ▾</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="period"><span id="period"></span><b>Apply</b></div>
|
|
|
|
|
|
<nav class="tabs">
|
|
|
|
|
|
<button type="button" data-pane="time_series">Time Series</button>
|
|
|
|
|
|
<button type="button" data-pane="advanced">Advanced</button>
|
2026-10-16 16:48:38 +02:00
|
|
|
|
<button type="button" data-pane="view" class="active">View</button>
|
|
|
|
|
|
<button type="button" data-pane="diagnosis">Diagnosis</button>
|
2026-10-16 14:52:24 +02:00
|
|
|
|
</nav>
|
|
|
|
|
|
<div class="pane" id="time_series"></div>
|
|
|
|
|
|
<div class="pane" id="advanced"></div>
|
2026-10-16 16:48:38 +02:00
|
|
|
|
<div class="pane active" id="view">
|
|
|
|
|
|
<div class="toolbar">
|
|
|
|
|
|
<button type="button" id="v-prev" title="Previous image (←)">◀</button>
|
|
|
|
|
|
<button type="button" id="v-play" title="Play / pause (Space)">▶ Play</button>
|
|
|
|
|
|
<button type="button" id="v-next" title="Next image (→)">▶</button>
|
|
|
|
|
|
<select id="v-speed" title="Images per second"><option>2</option><option selected>4</option><option>8</option></select> img/s
|
|
|
|
|
|
Compare <span id="v-cmp"><button type="button" data-cmp="0">Off</button><button type="button" data-cmp="-1">−24 h</button><button type="button" data-cmp="1">+24 h</button></span>
|
|
|
|
|
|
Zoom <button type="button" id="v-targets">Targets</button><button type="button" id="v-full">Full image</button>
|
|
|
|
|
|
<label><input type="checkbox" id="v-marks" checked> Sensors</label>
|
|
|
|
|
|
colored by <select id="v-color"><option value="error">error_value</option><option value="type">type</option></select>
|
|
|
|
|
|
<span class="legend" id="v-legend"></span>
|
|
|
|
|
|
<span class="meta">← → image · Shift ← → ±24 h · Space play · wheel zoom, drag to pan</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="viewer">
|
|
|
|
|
|
<div class="frames">
|
|
|
|
|
|
<figure class="frame"><div class="layer"><img alt="" draggable="false"><svg class="marks"></svg></div><figcaption></figcaption></figure>
|
|
|
|
|
|
<figure class="frame" hidden><div class="layer"><img alt="" draggable="false"><svg class="marks"></svg></div><figcaption></figcaption></figure>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<input type="range" id="v-slider" min="0" value="0">
|
2026-10-16 16:53:25 +02:00
|
|
|
|
<canvas id="v-band" height="3"></canvas>
|
2026-10-16 16:48:38 +02:00
|
|
|
|
<div class="days" id="v-days"></div>
|
|
|
|
|
|
<div class="toolbar">
|
|
|
|
|
|
<button type="button" id="v-prev-rej">◀ Previous rejection</button><button type="button" id="v-next-rej">Next rejection ▶</button>
|
|
|
|
|
|
<span id="v-rej"></span>
|
2026-10-16 16:53:25 +02:00
|
|
|
|
<span class="meta">bands: top all sensors (mean of error_value / threshold), bottom close-up target ·
|
|
|
|
|
|
green low, orange near threshold, red above · grey no value</span>
|
2026-10-16 16:48:38 +02:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<h3 class="sub">Target close-up</h3>
|
|
|
|
|
|
<div class="toolbar">
|
|
|
|
|
|
Target <select id="t-name"></select>
|
|
|
|
|
|
Crop ± <select id="t-r"><option>15</option><option selected>30</option><option>75</option><option>150</option><option>300</option></select> px
|
|
|
|
|
|
Step <select id="t-step"><option value="15">15 min</option><option value="60" selected>1 h</option><option value="180">3 h</option>
|
|
|
|
|
|
<option value="360">6 h</option><option value="1440">1 day</option></select>
|
|
|
|
|
|
Images on each side <select id="t-side"><option>2</option><option selected>3</option><option>4</option><option>6</option></select>
|
|
|
|
|
|
<span class="meta">before and after images appear when the film is paused</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<p class="note">Each image is centered on the target's raw position (x, y) measured at that image's time, not on corr.
|
|
|
|
|
|
The large image is the image above; the others are the images before and after it.</p>
|
|
|
|
|
|
<div class="strip"></div>
|
|
|
|
|
|
<div class="strip" hidden></div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="pane" id="diagnosis">
|
2026-10-16 14:52:24 +02:00
|
|
|
|
<div class="toolbar">Color <span id="columns"></span><span class="meta" id="instant"></span></div>
|
|
|
|
|
|
<div id="image"></div>
|
|
|
|
|
|
<div id="grid"></div>
|
|
|
|
|
|
<div id="details"></div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</section>
|
|
|
|
|
|
</main>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
const D = /*DATA*/null;
|
|
|
|
|
|
const day = t => `${+t.slice(8, 10)}/${+t.slice(5, 7)}/${t.slice(0, 4)}`;
|
|
|
|
|
|
document.getElementById("period").textContent = `${day(D.times[0])} → ${day(D.times[D.times.length - 1])}`;
|
|
|
|
|
|
|
|
|
|
|
|
// Onglets : un seul volet visible ; Plotly recalcule la taille des graphiques du volet qui s'affiche.
|
|
|
|
|
|
for (const b of document.querySelectorAll(".tabs button")) b.addEventListener("click", () => {
|
|
|
|
|
|
document.querySelectorAll(".tabs button, .pane").forEach(e => e.classList.remove("active"));
|
|
|
|
|
|
b.classList.add("active");
|
|
|
|
|
|
const pane = document.getElementById(b.dataset.pane);
|
|
|
|
|
|
pane.classList.add("active");
|
|
|
|
|
|
pane.querySelectorAll(".js-plotly-plot").forEach(p => Plotly.Plots.resize(p));
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// Time Series et Advanced : les captures de la plateforme, telles quelles (décor, spec « La page »).
|
|
|
|
|
|
for (const [tab, srcs] of Object.entries(D.captures)) {
|
|
|
|
|
|
const pane = document.getElementById(tab);
|
|
|
|
|
|
if (!srcs.length) pane.innerHTML = '<p class="empty">No capture of this page.</p>';
|
|
|
|
|
|
for (const src of srcs) pane.insertAdjacentHTML("beforeend", `<img src="${src}" alt="">`);
|
|
|
|
|
|
}
|
2026-10-16 14:53:52 +02:00
|
|
|
|
|
|
|
|
|
|
// Onglet Diagnosis (spec §1 à §3) : image à l'instant T et grille capteurs × temps, reliées.
|
|
|
|
|
|
const S = D.sensors, NAMES = S.map(s => s.name);
|
|
|
|
|
|
const COLUMNS = ["corr_x", "corr_y", "error_value"]; // grandeurs de la grille (spec §2)
|
|
|
|
|
|
const CAP = 10; // plafond de l'échelle de couleur, ±10 pas : choix d'affichage, pas un seuil (spec §2)
|
|
|
|
|
|
const TOL = 10 * 60e3; // image la plus proche de T, à 10 min près (spec §1)
|
|
|
|
|
|
const SCALE = [[0, "#2166ac"], [0.5, "#ffffff"], [1, "#b2182b"]]; // linéaire : négatif en bleu, positif en rouge,
|
|
|
|
|
|
// blanc au niveau des 24 premières heures, distinct du gris
|
|
|
|
|
|
const GAP = "#c8c8c8"; // case sans valeur, ligne sans niveau (spec §2)
|
|
|
|
|
|
const CONFIG = { responsive: true, scrollZoom: true, displaylogo: false };
|
|
|
|
|
|
const ASKED = new URLSearchParams(location.hash.slice(1)); // état de départ lu dans l'adresse (spec §3)
|
|
|
|
|
|
let col = COLUMNS.includes(ASKED.get("col")) ? ASKED.get("col") : "corr_y";
|
|
|
|
|
|
let T = D.times.includes(ASKED.get("t")) ? D.times.indexOf(ASKED.get("t")) : D.times.length - 1;
|
|
|
|
|
|
let W = 0, H = 0; // taille des images de la caméra, lue sur la première
|
2026-10-16 16:48:38 +02:00
|
|
|
|
const tab = document.querySelector(`.tabs button[data-pane="${ASKED.get("tab")}"]`);
|
|
|
|
|
|
if (tab) tab.click(); // onglet de départ lu dans l'adresse (#tab=diagnosis), View sinon
|
2026-10-16 14:53:52 +02:00
|
|
|
|
const utc = t => t.replace("T", " ").replace("Z", " UTC");
|
|
|
|
|
|
const tLine = () => ({ type: "line", xref: "x", yref: "paper", x0: D.times[T], x1: D.times[T], y0: 0, y1: 1,
|
|
|
|
|
|
line: { color: "#111", width: 1.5 } });
|
|
|
|
|
|
|
2026-10-16 16:48:38 +02:00
|
|
|
|
const IMS = D.images.map(im => Date.parse(im.t)), TMS = D.times.map(t => Date.parse(t)); // instants en ms
|
|
|
|
|
|
function nearestIndex(ms, list = IMS) { // index de l'image (ou de la mesure) la plus proche de ms, à TOL près ; -1 sinon
|
|
|
|
|
|
let best = -1, gap = Infinity;
|
|
|
|
|
|
list.forEach((t, k) => {
|
|
|
|
|
|
const g = Math.abs(t - ms);
|
|
|
|
|
|
if (g < gap) { gap = g; best = k; }
|
|
|
|
|
|
});
|
|
|
|
|
|
return gap <= TOL ? best : -1;
|
2026-10-16 14:53:52 +02:00
|
|
|
|
}
|
2026-10-16 16:48:38 +02:00
|
|
|
|
const nearestImage = () => D.images[nearestIndex(Date.parse(D.times[T]))] || null;
|
2026-10-16 14:53:52 +02:00
|
|
|
|
|
|
|
|
|
|
function drawGrid() {
|
|
|
|
|
|
return Plotly.react("grid", [{
|
|
|
|
|
|
type: "heatmap", x: D.times, y: NAMES, z: S.map(s => s.dev[col]), customdata: S.map(s => s.values[col]),
|
|
|
|
|
|
zmin: -CAP, zmax: CAP, colorscale: SCALE, hoverongaps: false, colorbar: { title: { text: "steps" }, thickness: 12 },
|
|
|
|
|
|
hovertemplate: `%{y} · %{x|%d %b %H:%M} UTC<br>${col} %{customdata:.4g} · %{z:.1f} steps<extra></extra>`,
|
|
|
|
|
|
}], {
|
|
|
|
|
|
height: 80 + 18 * S.length, margin: { l: 60, r: 10, t: 10, b: 40 }, plot_bgcolor: GAP, uirevision: "grid",
|
|
|
|
|
|
xaxis: { type: "date" }, yaxis: { autorange: "reversed", fixedrange: true, dtick: 1 }, shapes: [tLine()],
|
|
|
|
|
|
}, CONFIG);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function drawImage() {
|
|
|
|
|
|
const im = nearestImage();
|
|
|
|
|
|
const seen = S.map((s, i) => i).filter(i => S[i].x[T] !== null && S[i].y[T] !== null);
|
|
|
|
|
|
const markers = (ids, marker) => ({
|
|
|
|
|
|
type: "scatter", mode: "markers+text", x: ids.map(i => S[i].x[T]), y: ids.map(i => S[i].y[T]),
|
|
|
|
|
|
text: ids.map(i => NAMES[i]), customdata: ids, textposition: "top center", textfont: { color: "#fff", size: 11 },
|
|
|
|
|
|
marker: { size: 13, line: { color: "#fff", width: 1 }, ...marker }, hovertemplate: "%{text}<extra></extra>",
|
|
|
|
|
|
showlegend: false,
|
|
|
|
|
|
});
|
|
|
|
|
|
const valued = seen.filter(i => S[i].dev[col][T] !== null), blank = seen.filter(i => S[i].dev[col][T] === null);
|
|
|
|
|
|
const v = D.view || { x: [0, W || 1], y: [0, H || 1] };
|
|
|
|
|
|
return Plotly.react("image", [
|
|
|
|
|
|
markers(valued, { color: valued.map(i => S[i].dev[col][T]), cmin: -CAP, cmax: CAP, colorscale: SCALE }),
|
|
|
|
|
|
markers(blank, { color: GAP }),
|
|
|
|
|
|
], {
|
|
|
|
|
|
height: 520, margin: { l: 10, r: 10, t: 34, b: 10 }, plot_bgcolor: "#000", uirevision: "image",
|
|
|
|
|
|
title: { text: im ? `Image ${utc(im.t)}` : "", font: { size: 13 } },
|
|
|
|
|
|
xaxis: { range: v.x, showgrid: false, zeroline: false, showticklabels: false },
|
|
|
|
|
|
yaxis: { range: [v.y[1], v.y[0]], showgrid: false, zeroline: false, showticklabels: false, scaleanchor: "x" },
|
|
|
|
|
|
images: im && W ? [{ source: im.src, xref: "x", yref: "y", x: 0, y: 0, sizex: W, sizey: H,
|
|
|
|
|
|
xanchor: "left", yanchor: "top", sizing: "stretch", layer: "below" }] : [],
|
|
|
|
|
|
annotations: im ? [] : [{ text: "No image at this time", xref: "paper", yref: "paper", x: 0.5, y: 0.97,
|
|
|
|
|
|
showarrow: false, font: { color: "#fff", size: 15 } }],
|
|
|
|
|
|
}, CONFIG);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function setT(j) {
|
|
|
|
|
|
T = j;
|
|
|
|
|
|
document.getElementById("instant").textContent = `T = ${utc(D.times[T])}`;
|
|
|
|
|
|
Plotly.relayout("grid", { shapes: [tLine()] });
|
|
|
|
|
|
drawImage();
|
2026-10-16 14:54:22 +02:00
|
|
|
|
opened.forEach(i => Plotly.relayout(`detail-plot-${i}`, { shapes: [tLine()] }));
|
2026-10-16 14:53:52 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const columns = document.getElementById("columns");
|
|
|
|
|
|
columns.innerHTML = COLUMNS.map(c => `<button type="button" data-col="${c}">${c}</button>`).join("");
|
|
|
|
|
|
const markColumn = () => columns.querySelectorAll("button").forEach(b => b.classList.toggle("active", b.dataset.col === col));
|
|
|
|
|
|
columns.addEventListener("click", ev => {
|
|
|
|
|
|
if (!ev.target.dataset.col) return;
|
|
|
|
|
|
col = ev.target.dataset.col;
|
|
|
|
|
|
markColumn();
|
|
|
|
|
|
drawGrid();
|
|
|
|
|
|
drawImage();
|
2026-10-16 14:54:22 +02:00
|
|
|
|
opened.forEach(i => drawDetail(i));
|
2026-10-16 14:53:52 +02:00
|
|
|
|
});
|
|
|
|
|
|
|
2026-10-16 14:54:22 +02:00
|
|
|
|
// Détail d'un capteur (spec §4, version 0) : la grandeur de la grille, puis error_value et son seuil ; T marqué.
|
|
|
|
|
|
const opened = []; // index des capteurs dépliés, dans l'ordre d'ouverture
|
|
|
|
|
|
function autoscale(plotId) {
|
|
|
|
|
|
/*AUTOSCALE*/
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function detailFigure(i) {
|
|
|
|
|
|
const s = S[i], ends = [D.times[0], D.times[D.times.length - 1]];
|
|
|
|
|
|
return [[
|
|
|
|
|
|
{ type: "scatter", mode: "lines", x: D.times, y: s.values[col], name: col, line: { color: "#2a78d6", width: 1.5 } },
|
|
|
|
|
|
{ type: "scatter", mode: "lines", x: D.times, y: s.values.error_value, name: "error_value", yaxis: "y2",
|
|
|
|
|
|
line: { color: "#d03b3b", width: 1.5 } },
|
|
|
|
|
|
{ type: "scatter", mode: "lines", x: ends, y: [s.threshold, s.threshold], name: "error_threshold", yaxis: "y2",
|
|
|
|
|
|
line: { color: "#d03b3b", width: 1, dash: "dash" }, hoverinfo: "skip" },
|
|
|
|
|
|
], {
|
|
|
|
|
|
height: 380, margin: { l: 60, r: 10, t: 30, b: 40 }, legend: { orientation: "h", x: 0, y: 1.12 },
|
|
|
|
|
|
xaxis: { type: "date", anchor: "y2" },
|
|
|
|
|
|
yaxis: { domain: [0.55, 1], fixedrange: true, title: { text: col } },
|
|
|
|
|
|
yaxis2: { domain: [0, 0.45], fixedrange: true, title: { text: "error_value" } },
|
|
|
|
|
|
shapes: [tLine()],
|
|
|
|
|
|
}];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function drawDetail(i) {
|
|
|
|
|
|
const id = `detail-plot-${i}`;
|
|
|
|
|
|
Plotly.purge(id);
|
|
|
|
|
|
Plotly.newPlot(id, ...detailFigure(i), CONFIG).then(() => autoscale(id));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function openDetail(i) {
|
|
|
|
|
|
if (opened.includes(i)) return;
|
|
|
|
|
|
opened.push(i);
|
|
|
|
|
|
const box = document.createElement("div");
|
|
|
|
|
|
box.className = "detail";
|
|
|
|
|
|
box.innerHTML = `<header><b></b><button type="button" title="Close">×</button></header><div id="detail-plot-${i}"></div>`;
|
|
|
|
|
|
box.querySelector("b").textContent = `${NAMES[i]} · ${S[i].kind}`;
|
|
|
|
|
|
box.querySelector("button").addEventListener("click", () => {
|
|
|
|
|
|
Plotly.purge(`detail-plot-${i}`);
|
|
|
|
|
|
box.remove();
|
|
|
|
|
|
opened.splice(opened.indexOf(i), 1);
|
|
|
|
|
|
});
|
|
|
|
|
|
document.getElementById("details").append(box);
|
|
|
|
|
|
drawDetail(i);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-16 14:53:52 +02:00
|
|
|
|
markColumn();
|
|
|
|
|
|
document.getElementById("instant").textContent = `T = ${utc(D.times[T])}`;
|
|
|
|
|
|
Promise.all([drawGrid(), drawImage()]).then(() => {
|
2026-10-16 14:54:22 +02:00
|
|
|
|
document.getElementById("grid").on("plotly_click", ev => { // une case : T devient son instant, son capteur se déplie
|
|
|
|
|
|
const [i, j] = ev.points[0].pointNumber;
|
|
|
|
|
|
setT(j);
|
|
|
|
|
|
openDetail(i);
|
|
|
|
|
|
});
|
|
|
|
|
|
document.getElementById("image").on("plotly_click", ev => openDetail(ev.points[0].customdata)); // un marqueur
|
|
|
|
|
|
for (const name of (ASKED.get("open") || "").split(",")) if (NAMES.includes(name)) openDetail(NAMES.indexOf(name));
|
2026-10-16 14:53:52 +02:00
|
|
|
|
});
|
|
|
|
|
|
if (D.images.length) { // la taille de l'image, lue sur la première, place la photo sous les marqueurs
|
|
|
|
|
|
const probe = new Image();
|
2026-10-16 16:48:38 +02:00
|
|
|
|
probe.onload = () => {
|
|
|
|
|
|
W = probe.naturalWidth; H = probe.naturalHeight; drawImage();
|
|
|
|
|
|
frames.forEach(f => (f.style.aspectRatio = `${W} / ${H}`));
|
|
|
|
|
|
fit(D.view);
|
|
|
|
|
|
redrawMarks();
|
|
|
|
|
|
};
|
2026-10-16 14:53:52 +02:00
|
|
|
|
probe.src = D.images[0].src;
|
|
|
|
|
|
}
|
2026-10-16 16:48:38 +02:00
|
|
|
|
|
|
|
|
|
|
// Onglet View : une image à la fois, au glisseur, au clavier ou en film ; à côté, si demandée, l'image la plus proche
|
|
|
|
|
|
// de la même heure la veille ou le lendemain. Les deux images partagent le zoom : échelle k, décalage x, y en fraction
|
|
|
|
|
|
// du cadre (les deux cadres ont la même taille).
|
|
|
|
|
|
const IM = D.images, DAY = 24 * 3600e3;
|
|
|
|
|
|
const frames = [...document.querySelectorAll("#view .frame")];
|
|
|
|
|
|
const slider = document.getElementById("v-slider"), playBtn = document.getElementById("v-play");
|
|
|
|
|
|
let V = IM.length - 1, cmp = { "-24": -1, "24": 1 }[ASKED.get("cmp")] || 0; // image affichée, décalage en jours
|
|
|
|
|
|
let Z = { k: 1, x: 0, y: 0 }, run = 0, playing = false;
|
|
|
|
|
|
|
|
|
|
|
|
function paint(frame, im, label) {
|
|
|
|
|
|
const img = frame.querySelector("img");
|
|
|
|
|
|
img.hidden = !im;
|
|
|
|
|
|
if (im && img.getAttribute("src") !== im.src) img.src = im.src;
|
|
|
|
|
|
img.dataset.t = im ? im.t : "";
|
|
|
|
|
|
frame.querySelector("figcaption").textContent = `${label}${im ? utc(im.t) : "No image at this time"}`;
|
|
|
|
|
|
drawMarks(frame);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const RING = 22; // rayon du cercle autour d'un capteur, en px de l'image (une tache de nuit fait une quinzaine de px)
|
|
|
|
|
|
const LEGENDS = { // légende des cercles, selon leur couleur (type de capteur ou error_value)
|
|
|
|
|
|
type: '<b style="color:#ffd400">target</b> <b style="color:#3cc8ff">reference</b> <b style="color:#ff9f1c">local reference</b>',
|
|
|
|
|
|
error: '<b style="color:hsl(120,90%,55%)">low</b> <b style="color:hsl(30,90%,55%)">near threshold</b> ' +
|
|
|
|
|
|
'<b style="color:#ff3b3b">- - above threshold (rejected)</b> <b style="color:#aaa">no value</b>',
|
|
|
|
|
|
};
|
|
|
|
|
|
function errorColor(e, threshold) { // vert loin du seuil, orange à son approche, rouge au-dessus
|
|
|
|
|
|
if (e === null) return "#aaa";
|
|
|
|
|
|
return e > threshold ? "#ff3b3b" : `hsl(${120 - 90 * Math.max(0, e / threshold)}, 90%, 55%)`;
|
|
|
|
|
|
}
|
|
|
|
|
|
function errorText(s, t) { // error_value du capteur s à l'heure t, face à son seuil ; null sans mesure
|
|
|
|
|
|
const j = nearestIndex(Date.parse(t), TMS), e = j < 0 ? null : s.values.error_value[j];
|
|
|
|
|
|
return e === null ? null : { text: `error ${e.toFixed(2)} ${e > s.threshold ? ">" : "≤"} ${s.threshold}`, over: e > s.threshold };
|
|
|
|
|
|
}
|
|
|
|
|
|
function drawMarks(frame) { // un cercle et le nom de chaque capteur, à x, y mesurés à l'heure de l'image ; le capteur
|
|
|
|
|
|
// du gros plan en gras souligné
|
|
|
|
|
|
const img = frame.querySelector("img"), svg = frame.querySelector("svg"), mode = document.getElementById("v-color").value;
|
|
|
|
|
|
svg.innerHTML = "";
|
|
|
|
|
|
if (img.hidden || !W || !document.getElementById("v-marks").checked) return;
|
|
|
|
|
|
svg.setAttribute("viewBox", `0 0 ${W} ${H}`);
|
|
|
|
|
|
const j = nearestIndex(Date.parse(img.dataset.t), TMS), sel = +document.getElementById("t-name").value;
|
|
|
|
|
|
if (j < 0) return;
|
|
|
|
|
|
svg.innerHTML = S.map((s, i) => {
|
|
|
|
|
|
if (s.x[j] === null) return "";
|
|
|
|
|
|
const e = s.values.error_value[j], byError = mode === "error";
|
|
|
|
|
|
const cls = [byError ? "" : s.kind, byError && e !== null && e > s.threshold ? "over" : "", i === sel ? "sel" : ""].join(" ");
|
|
|
|
|
|
const label = byError ? `${s.name} ${e === null ? "–" : e.toFixed(2)}` : s.name;
|
|
|
|
|
|
return `<g class="${cls}"${byError ? ` style="color:${errorColor(e, s.threshold)}"` : ""}>` +
|
|
|
|
|
|
`<circle cx="${s.x[j]}" cy="${s.y[j]}" r="${RING}"/><text x="${s.x[j]}" y="${s.y[j] - RING - 6}">${label}</text></g>`;
|
|
|
|
|
|
}).join("");
|
|
|
|
|
|
document.getElementById("v-legend").innerHTML = LEGENDS[mode] + " · <u><b style='color:#fff'>close-up target</b></u>";
|
|
|
|
|
|
}
|
|
|
|
|
|
const redrawMarks = () => frames.forEach(drawMarks);
|
|
|
|
|
|
|
|
|
|
|
|
function show(k) {
|
|
|
|
|
|
V = Math.max(0, Math.min(IM.length - 1, k));
|
|
|
|
|
|
slider.value = V;
|
|
|
|
|
|
const other = cmp ? nearestIndex(Date.parse(IM[V].t) + cmp * DAY) : -1;
|
|
|
|
|
|
paint(frames[0], IM[V], "");
|
|
|
|
|
|
paint(frames[1], IM[other], cmp > 0 ? "+24 h · " : "−24 h · ");
|
|
|
|
|
|
for (const n of [V + 1, other + 1]) if (n > 0 && IM[n]) new Image().src = IM[n].src; // la suivante, en cache
|
|
|
|
|
|
drawStrips();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function setCompare(c) {
|
|
|
|
|
|
cmp = c;
|
|
|
|
|
|
frames[1].hidden = !cmp;
|
|
|
|
|
|
document.querySelector("#view .viewer").style.setProperty("--n", cmp ? 2 : 1);
|
|
|
|
|
|
document.querySelectorAll("#v-cmp button").forEach(b => b.classList.toggle("active", +b.dataset.cmp === cmp));
|
|
|
|
|
|
show(V);
|
|
|
|
|
|
zoom(); // la largeur des cadres a changé : taille des noms à recalculer
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function zoom() {
|
|
|
|
|
|
const px = W ? frames[0].clientWidth * Z.k / W : 0; // px d'écran par px de l'image
|
|
|
|
|
|
for (const f of frames) {
|
|
|
|
|
|
f.querySelector(".layer").style.transform = `translate(${Z.x * 100}%, ${Z.y * 100}%) scale(${Z.k})`;
|
|
|
|
|
|
if (px) f.querySelector("svg").style.fontSize = `${12 / px}px`; // les noms restent à 12 px à l'écran
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function fit(box) { // cadre en pixels de l'image ({x: [x0, x1], y: [y0, y1]}), ou rien pour l'image entière
|
|
|
|
|
|
if (!box || !W) Z = { k: 1, x: 0, y: 0 };
|
|
|
|
|
|
else {
|
|
|
|
|
|
const [u0, u1] = box.x.map(x => x / W), [v0, v1] = box.y.map(y => y / H), k = Math.min(1 / (u1 - u0), 1 / (v1 - v0));
|
|
|
|
|
|
Z = { k, x: 0.5 - k * (u0 + u1) / 2, y: 0.5 - k * (v0 + v1) / 2 };
|
|
|
|
|
|
}
|
|
|
|
|
|
zoom();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function play(on) { // film : l'image suivante une fois les images décodées, au rythme choisi ; arrêt à la dernière
|
|
|
|
|
|
playing = on;
|
|
|
|
|
|
const me = ++run;
|
|
|
|
|
|
playBtn.textContent = on ? "❚❚ Pause" : "▶ Play";
|
|
|
|
|
|
if (!on) return drawStrips(); // à l'arrêt, les images d'avant et d'après reviennent
|
|
|
|
|
|
if (V === IM.length - 1) show(0);
|
|
|
|
|
|
const step = () => {
|
|
|
|
|
|
if (me !== run) return;
|
|
|
|
|
|
if (V === IM.length - 1) return play(false);
|
|
|
|
|
|
show(V + 1);
|
|
|
|
|
|
Promise.all(frames.map(f => f.querySelector("img").decode().catch(() => {})))
|
|
|
|
|
|
.then(() => setTimeout(step, 1000 / document.getElementById("v-speed").value));
|
|
|
|
|
|
};
|
|
|
|
|
|
setTimeout(step, 1000 / document.getElementById("v-speed").value);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (const f of frames) {
|
|
|
|
|
|
f.addEventListener("wheel", ev => { // zoom autour du pointeur
|
|
|
|
|
|
ev.preventDefault();
|
|
|
|
|
|
const r = f.getBoundingClientRect(), u = (ev.clientX - r.left) / r.width, v = (ev.clientY - r.top) / r.height;
|
|
|
|
|
|
const k = Math.min(40, Math.max(1, Z.k * Math.exp(-ev.deltaY / 500)));
|
|
|
|
|
|
Z = { k, x: u - k * (u - Z.x) / Z.k, y: v - k * (v - Z.y) / Z.k };
|
|
|
|
|
|
zoom();
|
|
|
|
|
|
}, { passive: false });
|
|
|
|
|
|
f.addEventListener("pointerdown", ev => { // déplacement à la souris
|
|
|
|
|
|
f.setPointerCapture(ev.pointerId);
|
|
|
|
|
|
const r = f.getBoundingClientRect(), from = { ...Z, cx: ev.clientX, cy: ev.clientY };
|
|
|
|
|
|
f.onpointermove = e => { Z.x = from.x + (e.clientX - from.cx) / r.width; Z.y = from.y + (e.clientY - from.cy) / r.height; zoom(); };
|
|
|
|
|
|
f.onpointerup = () => (f.onpointermove = null);
|
|
|
|
|
|
});
|
|
|
|
|
|
f.addEventListener("dblclick", () => fit(D.view));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Gros plan d'une cible, pour son aspect d'une heure ou d'un jour à l'autre (perte de visibilité, obstacle…), pas pour
|
|
|
|
|
|
// son déplacement : chaque vignette est centrée sur x, y mesurés à sa propre heure (la position médiane du capteur
|
|
|
|
|
|
// s'il n'y a pas de mesure), pixels non lissés. Une rangée par image du haut (T, et sa comparaison à ±24 h) : au centre,
|
|
|
|
|
|
// en grand, l'image du haut ; de part et d'autre, les images d'avant et d'après, au pas choisi.
|
|
|
|
|
|
const tName = document.getElementById("t-name"), tR = document.getElementById("t-r");
|
|
|
|
|
|
const tStep = document.getElementById("t-step"), tSide = document.getElementById("t-side");
|
|
|
|
|
|
const strips = [...document.querySelectorAll("#view .strip")];
|
|
|
|
|
|
const short = t => `${+t.slice(8, 10)}/${+t.slice(5, 7)} ${t.slice(11, 16)}`;
|
|
|
|
|
|
const BIG = 300, SMALL = 140; // côté des vignettes à l'écran, en px
|
|
|
|
|
|
let stripTimer = null, loading = [];
|
|
|
|
|
|
|
|
|
|
|
|
function crop(canvas, img, s, t) { // gros plan de s dans img (heure t) ; false s'il n'y a pas de x, y à cette heure
|
|
|
|
|
|
const r = +tR.value, j = t ? nearestIndex(Date.parse(t), TMS) : -1, measured = j >= 0 && s.x[j] !== null;
|
|
|
|
|
|
const [cx, cy] = measured ? [s.x[j], s.y[j]] : s.home;
|
|
|
|
|
|
const ctx = canvas.getContext("2d"), n = canvas.width;
|
|
|
|
|
|
ctx.imageSmoothingEnabled = n < 2 * r;
|
|
|
|
|
|
ctx.fillStyle = "#000";
|
|
|
|
|
|
ctx.fillRect(0, 0, n, n);
|
|
|
|
|
|
if (img) ctx.drawImage(img, Math.round(cx) - r, Math.round(cy) - r, 2 * r, 2 * r, 0, 0, n, n);
|
|
|
|
|
|
return measured;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function shift(min) { // décalage en texte : −2 h, +1 d, +15 min
|
|
|
|
|
|
const a = Math.abs(min);
|
|
|
|
|
|
return (min < 0 ? "−" : "+") + (a % 1440 === 0 ? `${a / 1440} d` : a % 60 === 0 ? `${a / 60} h` : `${a} min`);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function drawStrips() { // un peu après le dernier changement, pour ne pas charger chaque pas du glisseur
|
|
|
|
|
|
clearTimeout(stripTimer);
|
|
|
|
|
|
stripTimer = setTimeout(() => {
|
|
|
|
|
|
loading.forEach(im => (im.src = "")); // abandonne les images encore en chargement
|
|
|
|
|
|
loading = [];
|
|
|
|
|
|
const s = S[+tName.value], step = +tStep.value, side = playing ? 0 : +tSide.value; // en film : l'image du haut seule
|
|
|
|
|
|
strips.forEach((row, n) => {
|
|
|
|
|
|
row.hidden = n === 1 && !cmp;
|
|
|
|
|
|
row.innerHTML = "";
|
|
|
|
|
|
if (row.hidden || !s) return;
|
|
|
|
|
|
const base = IMS[V] + (n ? cmp * DAY : 0);
|
|
|
|
|
|
for (let k = -side; k <= side; k++) {
|
|
|
|
|
|
const idx = nearestIndex(base + k * step * 60e3), size = k ? SMALL : BIG;
|
|
|
|
|
|
const label = k ? shift(k * step) : n ? (cmp > 0 ? "+24 h" : "−24 h") : "T";
|
|
|
|
|
|
const fig = document.createElement("figure");
|
|
|
|
|
|
if (!k) fig.className = "now";
|
|
|
|
|
|
fig.innerHTML = `<canvas width="${size}" height="${size}"></canvas><figcaption></figcaption>`;
|
|
|
|
|
|
row.append(fig);
|
|
|
|
|
|
const canvas = fig.querySelector("canvas"), cap = fig.querySelector("figcaption");
|
|
|
|
|
|
crop(canvas, null, s, null);
|
|
|
|
|
|
if (idx < 0) {
|
|
|
|
|
|
cap.textContent = `${label}\nno image`;
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
const err = errorText(s, IM[idx].t);
|
|
|
|
|
|
cap.textContent = `${label} · ${short(IM[idx].t)}\n${err ? err.text : "no error_value"}`;
|
|
|
|
|
|
cap.classList.toggle("over", !!err && err.over);
|
|
|
|
|
|
if (k) {
|
|
|
|
|
|
canvas.title = "Show this image above";
|
|
|
|
|
|
canvas.addEventListener("click", () => show(idx));
|
|
|
|
|
|
}
|
|
|
|
|
|
const img = new Image();
|
|
|
|
|
|
img.onload = () => { if (!crop(canvas, img, s, IM[idx].t)) cap.textContent += "\nno x, y: median position"; };
|
|
|
|
|
|
img.src = IM[idx].src;
|
|
|
|
|
|
loading.push(img);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}, 120);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
S.forEach((s, i) => { if (s.home) tName.add(new Option(`${s.name} · ${s.kind}`, i)); });
|
|
|
|
|
|
const wanted = NAMES.indexOf(ASKED.get("target") || "PR17");
|
|
|
|
|
|
if (wanted >= 0 && S[wanted].home) tName.value = wanted;
|
|
|
|
|
|
for (const sel of [tName, tR, tStep, tSide]) sel.addEventListener("change", () => {
|
|
|
|
|
|
sel.blur(); // les flèches reviennent aux images
|
|
|
|
|
|
drawStrips();
|
|
|
|
|
|
if (sel === tName) { // la cible du gros plan : soulignée sur les grandes images, et ses rejets sous le glisseur
|
|
|
|
|
|
redrawMarks();
|
|
|
|
|
|
drawBand();
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
2026-10-16 16:53:25 +02:00
|
|
|
|
// Deux bandes sous le glisseur, une colonne par image, couleur des cercles (errorColor) : en haut, le système entier,
|
|
|
|
|
|
// moyenne sur les capteurs mesurés de error_value / seuil du capteur (rouge si la moyenne dépasse 1) ; en bas, la cible
|
|
|
|
|
|
// du gros plan, error_value face à son seuil. Les boutons mènent au début de l'épisode de rejet (de la cible) précédent
|
|
|
|
|
|
// ou suivant ; le survol donne le détail.
|
2026-10-16 16:48:38 +02:00
|
|
|
|
const IMJ = IMS.map(t => nearestIndex(t, TMS)); // mesure de chaque image, -1 sans mesure à 10 min près
|
2026-10-16 16:53:25 +02:00
|
|
|
|
const SYSTEM = IMJ.map(j => { // par image : moyenne des error_value / seuil, et nombre de capteurs rejetés / mesurés
|
|
|
|
|
|
const r = j < 0 ? [] : S.filter(s => s.values.error_value[j] !== null && s.threshold > 0)
|
|
|
|
|
|
.map(s => s.values.error_value[j] / s.threshold);
|
|
|
|
|
|
return r.length ? { mean: r.reduce((a, b) => a + b) / r.length, over: r.filter(v => v > 1).length, n: r.length } : null;
|
|
|
|
|
|
});
|
2026-10-16 16:48:38 +02:00
|
|
|
|
const band = document.getElementById("v-band");
|
2026-10-16 16:53:25 +02:00
|
|
|
|
let over = []; // par image : true si la cible dépasse son seuil, false en dessous, null sans valeur
|
2026-10-16 16:48:38 +02:00
|
|
|
|
|
|
|
|
|
|
function drawBand() {
|
|
|
|
|
|
const s = S[+tName.value];
|
|
|
|
|
|
if (!s) return;
|
2026-10-16 16:53:25 +02:00
|
|
|
|
const errs = IMJ.map(j => (j < 0 ? null : s.values.error_value[j]));
|
|
|
|
|
|
over = errs.map(e => (e === null ? null : e > s.threshold));
|
2026-10-16 16:48:38 +02:00
|
|
|
|
band.width = Math.max(1, IM.length);
|
2026-10-16 16:53:25 +02:00
|
|
|
|
const ctx = band.getContext("2d"); // ligne 0 : système ; ligne 1 : vide ; ligne 2 : cible
|
|
|
|
|
|
ctx.clearRect(0, 0, band.width, band.height);
|
|
|
|
|
|
errs.forEach((e, k) => {
|
|
|
|
|
|
ctx.fillStyle = errorColor(SYSTEM[k] && SYSTEM[k].mean, 1);
|
2026-10-16 16:48:38 +02:00
|
|
|
|
ctx.fillRect(k, 0, 1, 1);
|
2026-10-16 16:53:25 +02:00
|
|
|
|
ctx.fillStyle = errorColor(e, s.threshold);
|
|
|
|
|
|
ctx.fillRect(k, 2, 1, 1);
|
2026-10-16 16:48:38 +02:00
|
|
|
|
});
|
|
|
|
|
|
document.getElementById("v-rej").textContent =
|
|
|
|
|
|
`${s.name} above its threshold (${s.threshold}): ${over.filter(o => o).length} images in ${episodes().length} episodes`;
|
|
|
|
|
|
}
|
|
|
|
|
|
const episodes = () => over.map((o, k) => (o && !over[k - 1] ? k : -1)).filter(k => k >= 0); // début de chaque épisode
|
|
|
|
|
|
document.getElementById("v-prev-rej").addEventListener("click", ev => {
|
|
|
|
|
|
ev.currentTarget.blur();
|
|
|
|
|
|
const k = episodes().filter(k => k < V).pop();
|
|
|
|
|
|
if (k !== undefined) show(k);
|
|
|
|
|
|
});
|
|
|
|
|
|
document.getElementById("v-next-rej").addEventListener("click", ev => {
|
|
|
|
|
|
ev.currentTarget.blur();
|
|
|
|
|
|
const k = episodes().find(k => k > V);
|
|
|
|
|
|
if (k !== undefined) show(k);
|
|
|
|
|
|
});
|
2026-10-16 16:53:25 +02:00
|
|
|
|
const bandIndex = ev => {
|
2026-10-16 16:48:38 +02:00
|
|
|
|
const r = band.getBoundingClientRect();
|
2026-10-16 16:53:25 +02:00
|
|
|
|
return Math.max(0, Math.min(IM.length - 1, Math.round((ev.clientX - r.left) / r.width * (IM.length - 1))));
|
|
|
|
|
|
};
|
|
|
|
|
|
band.addEventListener("click", ev => show(bandIndex(ev)));
|
|
|
|
|
|
band.addEventListener("mousemove", ev => { // détail de l'image sous le pointeur
|
|
|
|
|
|
const k = bandIndex(ev), sys = SYSTEM[k], s = S[+tName.value], e = IMJ[k] < 0 ? null : s.values.error_value[IMJ[k]];
|
|
|
|
|
|
band.title = `${utc(IM[k].t)}\nAll sensors: ${sys ? `mean error_value / threshold ${sys.mean.toFixed(2)}, ` +
|
|
|
|
|
|
`${sys.over} of ${sys.n} above threshold` : "no value"}\n${s.name}: ${e === null ? "no value" :
|
|
|
|
|
|
`error_value ${e.toFixed(2)} ${e > s.threshold ? ">" : "≤"} ${s.threshold}`}`;
|
2026-10-16 16:48:38 +02:00
|
|
|
|
});
|
|
|
|
|
|
if (IM.length) drawBand();
|
|
|
|
|
|
for (const id of ["v-marks", "v-color"]) document.getElementById(id).addEventListener("change", ev => {
|
|
|
|
|
|
ev.target.blur();
|
|
|
|
|
|
redrawMarks();
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const jumpDay = d => { const k = nearestIndex(Date.parse(IM[V].t) + d * DAY); if (k >= 0) show(k); };
|
|
|
|
|
|
document.addEventListener("keydown", ev => {
|
|
|
|
|
|
if (!document.getElementById("view").classList.contains("active")) return;
|
|
|
|
|
|
if (ev.target.matches("select, input:not([type=range])")) return; // les flèches restent au champ qui a le focus
|
|
|
|
|
|
const d = { ArrowLeft: -1, ArrowRight: 1 }[ev.key];
|
|
|
|
|
|
if (ev.key === " ") play(!playing);
|
|
|
|
|
|
else if (d) ev.shiftKey ? jumpDay(d) : show(V + d);
|
|
|
|
|
|
else return;
|
|
|
|
|
|
ev.preventDefault(); // ni défilement de la page, ni second pas du glisseur s'il a le focus
|
|
|
|
|
|
});
|
|
|
|
|
|
document.querySelector("#view .toolbar").addEventListener("click", ev => {
|
|
|
|
|
|
const b = ev.target.closest("button");
|
|
|
|
|
|
if (!b) return;
|
|
|
|
|
|
b.blur(); // la barre d'espace reste au film, sans recliquer le bouton
|
|
|
|
|
|
if (b.dataset.cmp !== undefined) setCompare(+b.dataset.cmp);
|
|
|
|
|
|
else if (b.id === "v-prev") show(V - 1);
|
|
|
|
|
|
else if (b.id === "v-next") show(V + 1);
|
|
|
|
|
|
else if (b.id === "v-play") play(!playing);
|
|
|
|
|
|
else if (b.id === "v-targets") fit(D.view);
|
|
|
|
|
|
else if (b.id === "v-full") fit(null);
|
|
|
|
|
|
});
|
|
|
|
|
|
slider.max = Math.max(0, IM.length - 1);
|
|
|
|
|
|
slider.addEventListener("input", () => show(+slider.value));
|
|
|
|
|
|
const daysBar = document.getElementById("v-days");
|
|
|
|
|
|
IM.forEach((im, k) => { // une étiquette sous le glisseur au début de chaque jour UTC
|
|
|
|
|
|
if (k && im.t.slice(0, 10) === IM[k - 1].t.slice(0, 10)) return;
|
|
|
|
|
|
daysBar.insertAdjacentHTML("beforeend",
|
|
|
|
|
|
`<span style="left:${100 * k / Math.max(1, IM.length - 1)}%">${+im.t.slice(8, 10)}/${+im.t.slice(5, 7)}</span>`);
|
|
|
|
|
|
});
|
|
|
|
|
|
if (ASKED.get("img")) { const k = nearestIndex(Date.parse(ASKED.get("img"))); if (k >= 0) V = k; }
|
|
|
|
|
|
if (IM.length) setCompare(cmp);
|
|
|
|
|
|
else document.querySelector("#view .viewer").innerHTML = '<p class="empty">No image in this folder.</p>';
|
2026-10-16 14:52:24 +02:00
|
|
|
|
</script>
|
|
|
|
|
|
</body>
|
|
|
|
|
|
</html>
|