Add the Displacements page: permanent displacements of the targets (D-055)
Mechanical anomaly detection on the hourly displacements in mm, data unchanged: for each target and axis, the largest gap between the median of the next 24 h and the previous 24 h, kept above 3 times the target's daily swing (provisional). Jumps within 6 h form one event, so a common jump is not several anomalies. Grey curves for all targets, colour for those that jumped; a click opens Explore, Diagnosis. Note on the idea, first trial and leads in vues-deplacements/contexte/detection-d-anomalies.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
14cca7a29b
commit
261f8c9038
7 files changed
+218
-9
No files matched your search
@@ -28,6 +28,8 @@
|
||||
.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; }
|
||||
.nav a[data-page] { cursor: pointer; }
|
||||
.nav a.active { background: #3e5367; }
|
||||
|
||||
.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; }
|
||||
@@ -107,6 +109,17 @@
|
||||
#d-question { min-width: 300px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 4px; }
|
||||
#d-request textarea { width: 100%; font: 13px/1.4 monospace; padding: 6px 8px; border: 1px solid var(--line); }
|
||||
#d-request p { margin: 4px 0; color: var(--text); }
|
||||
|
||||
/* Page Displacements (D-055) : un événement par groupe de sauts, ses sauts en tableau, puis les courbes en mm. */
|
||||
#p-displacements .note { margin: 14px 6px; }
|
||||
#r-events details { margin: 0 6px 12px; color: var(--text); }
|
||||
#r-events summary { font-size: 15px; cursor: pointer; padding: 4px 0; }
|
||||
.rtable { border-collapse: collapse; width: 100%; margin-top: 4px; }
|
||||
.rtable th, .rtable td { padding: 5px 10px; border-bottom: 1px solid var(--line); text-align: left; }
|
||||
.rtable th { color: var(--muted); font-weight: normal; }
|
||||
.rtable tbody tr { cursor: pointer; }
|
||||
.rtable tbody tr:hover { background: #f2f5f8; }
|
||||
.rtable i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -116,6 +129,7 @@
|
||||
<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="trend" viewBox="0 0 20 20"><path d="M2 15l5-5 4 3 7-8" fill="none" stroke="currentColor" stroke-width="2.2"/></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>
|
||||
|
||||
@@ -125,7 +139,8 @@
|
||||
<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 data-page="explore"><svg class="i"><use href="#list"/></svg>Explore<svg class="i chev"><use href="#chev"/></svg></a>
|
||||
<a data-page="displacements"><svg class="i"><use href="#trend"/></svg>Displacements</a>
|
||||
<a><svg class="i"><use href="#cog"/></svg>Settings<svg class="i chev"><use href="#chev"/></svg></a>
|
||||
</nav>
|
||||
</aside>
|
||||
@@ -136,7 +151,13 @@
|
||||
</header>
|
||||
|
||||
<main>
|
||||
<section class="panel">
|
||||
<section class="panel" id="p-displacements" hidden>
|
||||
<div class="panel-title"><h2><!--PLATFORM--><small>Displacements</small></h2></div>
|
||||
<p class="note" id="r-note"></p>
|
||||
<div id="r-events"></div>
|
||||
<div id="r-curves"></div>
|
||||
</section>
|
||||
<section class="panel" id="p-explore">
|
||||
<div class="panel-title">
|
||||
<h2><!--PLATFORM--><small>Explore</small></h2>
|
||||
<span class="tools"><svg class="i"><use href="#wrench"/></svg> ▾</span>
|
||||
@@ -686,7 +707,7 @@ for (const id of ["v-marks", "v-color"]) document.getElementById(id).addEventLis
|
||||
|
||||
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 (document.getElementById("p-explore").hidden || !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);
|
||||
@@ -716,6 +737,72 @@ IM.forEach((im, k) => { // une étiquette sous le glisseur au début de chaque
|
||||
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>';
|
||||
|
||||
// Page Displacements (D-055) : les sauts de niveau qui durent (déplacements permanents), calculés par explore.py
|
||||
// (regime_changes), groupés en événements ; puis toutes les courbes en mm, en gris, celles qui ont sauté en couleur. Un
|
||||
// clic sur un saut ouvre Explore, onglet Diagnosis, sur cette cible à cette heure. Données inchangées.
|
||||
const REG = D.regime, RCOL = {};
|
||||
REG.forEach(e => e.targets.forEach(n => { if (!(n in RCOL)) RCOL[n] = PALETTE[Object.keys(RCOL).length % PALETTE.length]; }));
|
||||
const signed = v => `${v > 0 ? "+" : v < 0 ? "−" : ""}${Math.abs(v).toFixed(1)} mm`;
|
||||
document.getElementById("r-note").textContent = `Permanent displacements: a target whose level over the next 24 h differs ` +
|
||||
`from its level over the previous 24 h by more than ${D.ratio} × its usual daily swing (median of max − min per UTC day). ` +
|
||||
`Daily and weather cycles come back; these jumps lasted at least 24 h. Jumps within 6 h of each other form one event. ` +
|
||||
`Hourly export in mm, unchanged.`;
|
||||
document.getElementById("r-events").innerHTML = REG.length ? REG.map(e => `
|
||||
<details${e.jumps.length <= 4 ? " open" : ""}><summary><b>${e.start === e.end ? utc(e.start) : `${utc(e.start)} → ${utc(e.end)}`}</b>
|
||||
· ${e.targets.length === 1 ? `${e.targets[0]} alone` : `${e.targets.length} targets together`}</summary>
|
||||
<table class="rtable"><thead><tr><th>Target</th><th>Axis</th><th>From</th><th>Jump</th><th>Usual daily swing</th>
|
||||
<th>Left at end of data</th></tr></thead><tbody>${e.jumps.map(f => `
|
||||
<tr data-target="${f.target}" data-t="${f.t}" title="Open in Explore · Diagnosis"><td><i style="background:${RCOL[f.target]}"></i>${f.target}</td>
|
||||
<td>${f.axis}</td><td>${utc(f.t)}</td><td>${signed(f.jump)}</td><td>${f.swing.toFixed(1)} mm</td><td>${signed(f.left)}</td></tr>`).join("")}
|
||||
</tbody></table></details>`).join("")
|
||||
: `<p class="empty">No permanent displacement: no target's level jumped by more than ${D.ratio} × its daily swing.</p>`;
|
||||
document.getElementById("r-events").addEventListener("click", ev => { // un saut : Explore, Diagnosis, cette cible à cette heure
|
||||
const tr = ev.target.closest("tr[data-target]");
|
||||
if (!tr) return;
|
||||
goPage("explore");
|
||||
activate(tabButton("diagnosis"), false);
|
||||
const i = NAMES.indexOf(tr.dataset.target), j = nearestIndex(Date.parse(tr.dataset.t), TMS);
|
||||
if (i >= 0) SEL = [i];
|
||||
if (j >= 0) setT(j);
|
||||
markTargets();
|
||||
drawCurves();
|
||||
});
|
||||
|
||||
function drawRegime() { // toutes les cibles en gris fin, celles qui ont sauté en couleur par-dessus
|
||||
const grey = [], lit = [];
|
||||
for (const [name, mm] of Object.entries(D.hourly.sensors)) [["h", "horizontal"], ["v", "vertical"]].forEach(([k, label], r) => {
|
||||
const c = RCOL[name];
|
||||
(c ? lit : grey).push({ type: "scatter", mode: "lines", x: D.hourly.times, y: mm[k], name, legendgroup: name,
|
||||
showlegend: !!c && !r, yaxis: `y${r ? 2 : ""}`, line: { color: c || "#d3d8de", width: c ? 2 : 1 },
|
||||
hovertemplate: `${name} · %{x|%d %b %H:%M} UTC (hour start)<br>${label} %{y:.2f} mm<extra></extra>` });
|
||||
});
|
||||
if (!grey.length && !lit.length) {
|
||||
document.getElementById("r-curves").innerHTML = '<p class="empty">No hourly export: no displacement in mm.</p>';
|
||||
return;
|
||||
}
|
||||
Plotly.newPlot("r-curves", [...grey, ...lit], {
|
||||
height: 600, margin: { l: 70, r: 10, t: 40, b: 40 }, legend: { orientation: "h", x: 0, y: 1.07 },
|
||||
xaxis: { type: "date", anchor: "y2" },
|
||||
yaxis: { domain: [0.53, 1], fixedrange: true, title: { text: "horizontal (mm)" } },
|
||||
yaxis2: { domain: [0, 0.47], fixedrange: true, title: { text: "vertical (mm)" } },
|
||||
annotations: [{ text: "grey: the other targets · hourly export, in mm, hour start in UTC", xref: "paper", yref: "paper",
|
||||
x: 1, y: 1.07, xanchor: "right", showarrow: false, font: { size: 11, color: "#73879c" } }],
|
||||
}, CONFIG).then(() => autoscale("r-curves"));
|
||||
}
|
||||
|
||||
// Pages : Explore ou Displacements, depuis la barre latérale. Départ : Displacements, sauf adresse d'Explore (#tab=…,
|
||||
// #img=…) ou #page=explore.
|
||||
function goPage(p) {
|
||||
document.querySelectorAll("main > .panel").forEach(e => (e.hidden = e.id !== `p-${p}`));
|
||||
document.querySelectorAll(".nav a[data-page]").forEach(a => a.classList.toggle("active", a.dataset.page === p));
|
||||
const plots = p === "explore" ? "#p-explore .pane.active .js-plotly-plot" : "#p-displacements .js-plotly-plot";
|
||||
document.querySelectorAll(plots).forEach(g => Plotly.Plots.resize(g));
|
||||
if (p === "explore") zoom(); // la taille des noms sur les images se calcule sur un cadre visible
|
||||
}
|
||||
document.querySelectorAll(".nav a[data-page]").forEach(a => a.addEventListener("click", () => goPage(a.dataset.page)));
|
||||
goPage(ASKED.get("page") || (location.hash.length > 1 ? "explore" : "displacements"));
|
||||
drawRegime();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user