feat: add standard peak grouping methods

This commit is contained in:
2026-08-29 09:00:40 +09:00
parent 447f77dfa7
commit e048ccbadc
7 changed files with 299 additions and 4 deletions
+17
View File
@@ -126,6 +126,7 @@ const elements = {
normalization: byId("normalization"),
dynamicRange: byId("dynamic-range"),
detectionThreshold: byId("detection-threshold"),
detectionMethod: byId("detection-method"),
addBandButton: byId("add-band-button"),
bandList: byId("band-list"),
exportSceneButton: byId("export-scene-button"),
@@ -206,6 +207,9 @@ function applyExperimentDefaults(experiment) {
if (experiment.evaluation.detectionThresholdRatio === undefined) {
experiment.evaluation.detectionThresholdRatio = DEFAULT_DETECTION_THRESHOLD_RATIO;
}
if (experiment.evaluation.detectionMethod === undefined) {
experiment.evaluation.detectionMethod = "local-max";
}
return experiment;
}
@@ -426,6 +430,7 @@ function syncControls() {
const detectionThresholdRatio =
experiment.evaluation?.detectionThresholdRatio ?? DEFAULT_DETECTION_THRESHOLD_RATIO;
elements.detectionThreshold.value = String(Number((detectionThresholdRatio * 100).toFixed(4)));
elements.detectionMethod.value = experiment.evaluation?.detectionMethod ?? "local-max";
elements.arrayPreset.value = ARRAY_PRESET_URLS.has(state.arrayDefinition.id)
? state.arrayDefinition.id
: "custom";
@@ -781,6 +786,11 @@ function renderResult() {
`${formatNumber(detectionThreshold * 100, 0)}%`,
"최강 map 값 기준 · 낮을수록 민감",
);
appendMetric(
"Peak 묶기",
displayed.snapshot.experiment.evaluation?.detectionMethod ?? "local-max",
"raw map 불변 · 검출 후보만 군집화",
);
for (const band of displayed.snapshot.experiment.frequencyBands) {
const evaluation = displayed.evaluations.get(band.id);
if (!evaluation) continue;
@@ -1165,6 +1175,7 @@ async function runSimulation() {
detectionThresholdRatio:
snapshot.experiment.evaluation?.detectionThresholdRatio ??
DEFAULT_DETECTION_THRESHOLD_RATIO,
detectionMethod: snapshot.experiment.evaluation?.detectionMethod ?? "local-max",
});
evaluations.set(band.id, evaluation);
exportedEvaluations.set(band.id, exportBandEvaluation(evaluation));
@@ -1300,6 +1311,7 @@ function evaluateLiveFrames(snapshot, plan, frames) {
detectionThresholdRatio:
snapshot.experiment.evaluation?.detectionThresholdRatio ??
DEFAULT_DETECTION_THRESHOLD_RATIO,
detectionMethod: snapshot.experiment.evaluation?.detectionMethod ?? "local-max",
}),
);
}
@@ -1758,6 +1770,11 @@ function installDocumentInputListeners() {
state.experiment.evaluation.detectionThresholdRatio = value / 100;
markChanged();
});
elements.detectionMethod.addEventListener("change", () => {
state.experiment.evaluation ??= {};
state.experiment.evaluation.detectionMethod = elements.detectionMethod.value;
markChanged();
});
}
function installBandListeners() {