fix: stabilize localization comparison semantics
This commit is contained in:
@@ -174,6 +174,18 @@ test("GCC-PHAT workload reports reference-pair scan reduction and rejects aliase
|
||||
"maximum geometric lag is exposed and unaliased",
|
||||
);
|
||||
|
||||
let preflightError;
|
||||
try {
|
||||
estimateGccPhatWorkload({ ...fixture, maximumWorkingBytes: 1 });
|
||||
} catch (error) {
|
||||
preflightError = error;
|
||||
}
|
||||
assert(
|
||||
preflightError instanceof RangeError &&
|
||||
preflightError.message.includes("before geometry allocation"),
|
||||
"unplanned workload is rejected before allocating its distance matrix",
|
||||
);
|
||||
|
||||
let memoryError;
|
||||
try {
|
||||
createGccPhatAnalysisPlan({ ...fixture, maximumPlanBytes: 1 });
|
||||
@@ -241,8 +253,8 @@ test("GCC-PHAT corrected lag sign finds a deterministic broadband source and emi
|
||||
assertNear(result.maximumLagSamples, result.workload.maximumLagSamples, 0, "lag metadata");
|
||||
assertEqual(band.rawScale, "score", "raw map scale");
|
||||
assert(
|
||||
band.rawMap.every((value) => Number.isFinite(value) && value >= 0),
|
||||
"shifted and squared score map is finite and nonnegative",
|
||||
band.rawMap.every((value) => Number.isFinite(value) && value >= 0 && value <= 1),
|
||||
"pair- and bandwidth-normalized score map is finite and bounded",
|
||||
);
|
||||
assert(
|
||||
distance3(peakPosition, fixture.target) <= 0.15,
|
||||
@@ -263,6 +275,48 @@ test("GCC-PHAT corrected lag sign finds a deterministic broadband source and emi
|
||||
"X_m * conj(X_ref) correlation uses the physical arrival-lag sign",
|
||||
);
|
||||
assertNear(Math.max(...band.displayMap), 1, 1e-6, "normalized score display");
|
||||
|
||||
const expandedFixture = createBroadbandFixture();
|
||||
expandedFixture.experiment.scan = {
|
||||
...expandedFixture.experiment.scan,
|
||||
xMin: -0.8,
|
||||
xMax: 0.8,
|
||||
yMin: -0.8,
|
||||
yMax: 0.8,
|
||||
columns: 17,
|
||||
rows: 17,
|
||||
};
|
||||
const expanded = await computeGccPhatMap({
|
||||
...expandedFixture,
|
||||
phatFloorRatio: 1e-5,
|
||||
pointBatchSize: 1024,
|
||||
stftTransformBatchSize: 1024,
|
||||
});
|
||||
const expandedTargetIndex = scanIndexFor(
|
||||
expandedFixture.experiment.scan,
|
||||
expandedFixture.target[0],
|
||||
expandedFixture.target[1],
|
||||
);
|
||||
assertNear(
|
||||
expanded.bands[0].rawMap[expandedTargetIndex],
|
||||
band.rawMap[targetIndex],
|
||||
1e-6,
|
||||
"raw score at a fixed hypothesis is independent of scan extent",
|
||||
);
|
||||
});
|
||||
|
||||
test("GCC-PHAT compute rejects an oversized unplanned working set before geometry", async () => {
|
||||
const fixture = createBroadbandFixture();
|
||||
let error;
|
||||
try {
|
||||
await computeGccPhatMap({ ...fixture, maximumWorkingBytes: 1 });
|
||||
} catch (candidate) {
|
||||
error = candidate;
|
||||
}
|
||||
assert(
|
||||
error instanceof RangeError && error.message.includes("before geometry allocation"),
|
||||
"compute preflight error",
|
||||
);
|
||||
});
|
||||
|
||||
test("GCC-PHAT analysis plan reuses geometry and FFT workspaces and releases its busy lock", async () => {
|
||||
|
||||
Reference in New Issue
Block a user