fix: preserve portable PHAT score semantics

This commit is contained in:
2026-08-28 20:26:31 +09:00
parent d58f673402
commit 9b9244be85
2 changed files with 4 additions and 1 deletions
@@ -248,7 +248,9 @@ export function detectBandPeaks(rawMap, scan, options = {}) {
position: [...peak.position], position: [...peak.position],
rawValue: peak.value, rawValue: peak.value,
rawScale, rawScale,
...(rawScale === "power" ? { rawPower: peak.value } : {}), ...(rawScale === "power"
? { rawPower: peak.value }
: { rawScore: peak.value }),
}); });
if (detections.length === peakDetection.maximumDetections) break; if (detections.length === peakDetection.maximumDetections) break;
} }
+1
View File
@@ -194,5 +194,6 @@ test("portable and streaming API accept an algorithm choice without Scene synthe
{ rawScale: "score", minimumPeakDistanceM: 0 }, { rawScale: "score", minimumPeakDistanceM: 0 },
); );
assertEqual(scorePeaks[0].rawScale, "score", "portable peak scale"); 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"); assert(!("rawPower" in scorePeaks[0]), "score is not mislabeled as acoustic power");
}); });