fix: preserve portable PHAT score semantics
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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");
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user