From 9b9244be8560811e8d43f5f21eb81b8ec98b763f Mon Sep 17 00:00:00 2001 From: MasterBabol Date: Fri, 28 Aug 2026 20:26:31 +0900 Subject: [PATCH] fix: preserve portable PHAT score semantics --- packages/acoustics-core/realtime-localizer.js | 4 +++- tests/unit/localization.test.js | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/acoustics-core/realtime-localizer.js b/packages/acoustics-core/realtime-localizer.js index 3661e00..913ca56 100644 --- a/packages/acoustics-core/realtime-localizer.js +++ b/packages/acoustics-core/realtime-localizer.js @@ -248,7 +248,9 @@ export function detectBandPeaks(rawMap, scan, options = {}) { position: [...peak.position], rawValue: peak.value, rawScale, - ...(rawScale === "power" ? { rawPower: peak.value } : {}), + ...(rawScale === "power" + ? { rawPower: peak.value } + : { rawScore: peak.value }), }); if (detections.length === peakDetection.maximumDetections) break; } diff --git a/tests/unit/localization.test.js b/tests/unit/localization.test.js index 660487a..2985b0c 100644 --- a/tests/unit/localization.test.js +++ b/tests/unit/localization.test.js @@ -194,5 +194,6 @@ test("portable and streaming API accept an algorithm choice without Scene synthe { rawScale: "score", minimumPeakDistanceM: 0 }, ); assertEqual(scorePeaks[0].rawScale, "score", "portable peak scale"); + assertEqual(scorePeaks[0].rawScore, scorePeaks[0].rawValue, "portable score alias"); assert(!("rawPower" in scorePeaks[0]), "score is not mislabeled as acoustic power"); });