Data: choose the detectors, classic (detectors/scripts/) or manual (detectors/manual/, run in a process of its own)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maximeandClaude Opus 5.5 committed 2026-11-18 17:25:30 +01:00
1 parent 0db5775e97
commit 51e939fa3c
3 files changed
+39 -11

No files matched your search

+12 -6
View File
@@ -50,6 +50,7 @@ export default function Data({ selection, choose, analysis, setAnalysis, support
const [source, setSource] = useState("detectors"), [families, setFamilies] = useState(DETECTED), [targets, setTargets] = useState("");
const [focus, setFocus] = useState(false); // with an event open, the plots show only its sensors
const [hidden, setHidden] = useState([]); // the targets removed from the plots (the detectors still read them)
const [set, setSet] = useState("classic"); // the detectors: classic (detectors/scripts/) or manual (detectors/manual/)
const [cut, setCut] = useState(false); // the points under a label of the checked families removed, the curves joined
const { station, start, end } = selection;
useEffect(() => {
@@ -75,7 +76,7 @@ export default function Data({ selection, choose, analysis, setAnalysis, support
{loading && <Loader />}
{data && <TargetFilter d={data} hidden={hidden} setHidden={setHidden} />}
{data && <Curves key={`${station}${start}${end}`} selection={selection} d={data} setImage={(t, nearest) => setMoment({ t, nearest })}
source={source} setSource={setSource} families={families} targets={targets} focus={focus} hidden={hidden} cut={cut}
source={source} setSource={setSource} families={families} targets={targets} focus={focus} hidden={hidden} cut={cut} set={set}
analysis={analysis} setAnalysis={setAnalysis} support={support} setSupport={setSupport} />}
</Stack>
</Grid.Col>
@@ -85,7 +86,7 @@ export default function Data({ selection, choose, analysis, setAnalysis, support
<StationImages selection={selection} compact wide={wide} toggle={() => setWide(!wide)} moment={moment} />
{data && <Settings key={`${station}${start}${end}`} d={data} families={families} setFamilies={setFamilies}
targets={targets} setTargets={setTargets} detect={source === "detectors"}
focus={focus} setFocus={setFocus} cut={cut} setCut={setCut} />}
focus={focus} setFocus={setFocus} cut={cut} setCut={setCut} set={set} setSet={setSet} />}
</Stack>
</div>
</Grid.Col>
@@ -117,7 +118,7 @@ function TargetFilter({ d, hidden, setHidden }) {
// The families apply at once (filter of the page, Detectors and LLM); the targets, with the button: each set of targets
// runs the detectors again (the LLM labels do not state their sensors: they do not filter them)
function Settings({ d, families, setFamilies, targets, setTargets, detect, focus, setFocus, cut, setCut }) {
function Settings({ d, families, setFamilies, targets, setTargets, detect, focus, setFocus, cut, setCut, set, setSet }) {
const sensors = Object.keys(d.T).filter(k => k && !k.startsWith("system:"));
const refs = new Set(d.plots.flatMap(p => p.traces).filter(t => t.name.endsWith(" (ref.)")).map(t => t.t));
const [checked, setChecked] = useState(targets ? targets.split(",") : sensors);
@@ -126,6 +127,11 @@ function Settings({ d, families, setFamilies, targets, setTargets, detect, focus
<Card shadow="sm" withBorder>
<Stack gap="sm">
<Title order={5}>Diagnostic settings</Title>
<div>
<Text size="sm" fw={500}>Detectors</Text>
<SegmentedControl size="xs" mt={4} value={set} onChange={setSet}
data={[{ value: "classic", label: "Classic" }, { value: "manual", label: "Manual (detectors/manual/)" }]} />
</div>
<Switch label="Focus on event curves" description="With an event open, the plots show only its sensors"
checked={focus} onChange={e => setFocus(e.currentTarget.checked)} />
<Switch label="Remove labeled points" description="The points under a label of the families shown leave the plots; the curves join over the holes"
@@ -163,7 +169,7 @@ const mentions = (text, s) => new RegExp(`(^|[^\\w])${s.replace(/[^\w]/g, "\\$&"
const sensorsOf = (l, names) => l.sensors ?? names.filter(s => mentions(l.description, s));
// analysis, support: the folder of the analysis, of the support request shown, held by App (the sidebar opens one)
function Curves({ selection: { station, start, end }, d, setImage, source, setSource, families, targets, focus, hidden, cut, analysis, setAnalysis,
function Curves({ selection: { station, start, end }, d, setImage, source, setSource, families, targets, focus, hidden, cut, set, analysis, setAnalysis,
support, setSupport }) {
const { A, B, T, plots: PLOTS } = d;
const plotIndex = (title, otherwise) => { const i = PLOTS.findIndex(p => p.title === title); return i < 0 ? otherwise : i; };
@@ -355,14 +361,14 @@ function Curves({ selection: { station, start, end }, d, setImage, source, setSo
useEffect(() => {
let alive = true;
setReading(true);
const url = source === "detectors" ? `/api/detectors?${new URLSearchParams({ station, start, end, targets })}`
const url = source === "detectors" ? `/api/detectors?${new URLSearchParams({ station, start, end, targets, set })}`
: `/api/labels?${new URLSearchParams({ station, folder })}`;
call(url).then(l => {
if (!alive) return; // another source was chosen in the meantime
setReading(false); setAllLabels(l || []);
});
return () => { alive = false; };
}, [source, targets, rev]);
}, [source, targets, set, rev]);
// One more plot: the first one the page does not show yet, vertical displacement first
function addPlot() {