fix: stabilize localization comparison semantics
This commit is contained in:
@@ -118,6 +118,38 @@ test("WebGPU DAS가 CPU 수치 기준과 일치하거나 auto CPU fallback한다
|
||||
document.documentElement.dataset.webgpuRmsError = error.rms.toExponential(3);
|
||||
});
|
||||
|
||||
test("WebGPU DAS-PHAT가 CPU score map과 일치하거나 auto CPU fallback한다", async () => {
|
||||
const adapter = await globalThis.navigator?.gpu?.requestAdapter();
|
||||
const fixture = createFixture(adapter ? "webgpu" : "auto");
|
||||
fixture.experiment.beamforming.algorithm = "das-phat";
|
||||
fixture.experiment.frequencyBands = [
|
||||
{ id: "phase-1k", minHz: 900, maxHz: 1_100, color: "#65f2bf" },
|
||||
];
|
||||
|
||||
if (!adapter) {
|
||||
const result = await computeDasWithBackend(fixture);
|
||||
assertEqual(result.backend, "cpu", "DAS-PHAT auto fallback backend");
|
||||
assertEqual(result.algorithm, "das-phat", "DAS-PHAT fallback algorithm");
|
||||
assertEqual(result.bands[0].rawScale, "score", "DAS-PHAT fallback scale");
|
||||
return;
|
||||
}
|
||||
|
||||
const cpuResult = await computeDasMap(fixture);
|
||||
const gpuResult = await computeDasWebGpu(fixture);
|
||||
const cpuBand = cpuResult.bands[0];
|
||||
const gpuBand = gpuResult.bands[0];
|
||||
const error = normalizedMapError(cpuBand.rawMap, gpuBand.rawMap);
|
||||
|
||||
assertEqual(gpuResult.algorithm, "das-phat", "actual WebGPU DAS-PHAT algorithm");
|
||||
assertEqual(gpuBand.rawScale, "score", "actual WebGPU DAS-PHAT scale");
|
||||
assert(!("rawPower" in gpuBand.peak), "DAS-PHAT GPU peak is not mislabeled as power");
|
||||
assert(error.rms <= 0.005, `DAS-PHAT CPU/GPU normalized RMS error=${error.rms}`);
|
||||
assert(
|
||||
error.maximumAbsoluteError <= 0.02,
|
||||
`DAS-PHAT CPU/GPU normalized max error=${error.maximumAbsoluteError}`,
|
||||
);
|
||||
});
|
||||
|
||||
test("192채널 · 50×50 WebGPU map이 CPU baseline 허용 오차를 만족한다", async () => {
|
||||
const adapter = await globalThis.navigator?.gpu?.requestAdapter();
|
||||
if (!adapter) {
|
||||
|
||||
Reference in New Issue
Block a user