Restore thin-feature fidelity in edge pass

This commit is contained in:
Meta Vens 2026-04-22 15:28:16 +01:00
commit 7c727f23dc
7 changed files with 123 additions and 75 deletions

View file

@ -121,7 +121,6 @@ def test_candidate_positions_include_sharp_and_edge_guided_samples() -> None:
for y, x in zip(candidate_y[0, 0].cpu().tolist(), candidate_x[0, 0].cpu().tolist())
}
assert (int(reference.sharp_y[0, 0]), int(reference.sharp_x[0, 0])) in cell_candidates
assert (int(reference.edge_peak_y[0, 0]), int(reference.edge_peak_x[0, 0])) in cell_candidates
assert len(cell_candidates) > 2

View file

@ -63,3 +63,18 @@ def test_source_lattice_reference_tracks_edge_peaks_and_gradients() -> None:
assert np.all(reference.edge_strength[:, 0] == 1.0)
assert np.all(reference.edge_grad_x[:, 0] == 1.0)
assert np.all(reference.edge_grad_y[:, 0] == 0.0)
def test_source_lattice_reference_computes_default_edge_metadata() -> None:
source = np.zeros((6, 6, 4), dtype=np.float32)
source[..., 3] = 1.0
source[:, 2, :3] = 1.0
reference = build_source_lattice_reference(
source,
target_width=2,
target_height=2,
phase_x=0.0,
phase_y=0.0,
)
assert np.all(reference.edge_strength[:, 0] > 0.0)
assert np.all(reference.edge_peak_x[:, 0] == 2)