fix: drop indexing score #15

Merged
perl_d merged 4 commits from drop-indexing-score into main 2026-07-28 12:51:32 +02:00
3 changed files with 12 additions and 6 deletions
+6
View File
@@ -58,3 +58,9 @@ line-length = 100
[tool.ruff.format]
skip-magic-trailing-comma = true
[dependency-groups]
dev = [
"pytest>=9.1.1",
"pytest-asyncio>=1.4.0",
]
+2 -2
View File
@@ -345,9 +345,9 @@ def has_sufficient_low_res_spots(result_array: np.ndarray, min_spots_low_res: fl
def compute_crystal_score_array(
scan_results: List, w_bkg: float = 0.25, w_low_res: float = 0.55, w_indexed: float = 0.20
scan_results: List, w_bkg: float = 0.25, w_low_res: float = 0.75, w_indexed: float = 0.00
) -> np.ndarray:
"""Combine bkg (25%), spots_low_res (55%), and spots_indexed (20%) into a 0100 score.
"""Combine bkg (25%), spots_low_res (75%), and spots_indexed (00%) into a 0100 score.
Each field is min-max normalised to [0, 100] within the grid before weighting,
so the final score is the probability (0100) that a pixel belongs to a crystal.
+4 -4
View File
@@ -145,8 +145,8 @@ def test_compute_crystal_score_array(mock_score_results):
def test_compute_crystal_score_array_weights():
# Cell A is the sole max in spots_low_res (weight 0.55); cell B is the sole
# max in spots_indexed (weight 0.20). A must outscore B.
# Cell A is the sole max in spots_low_res (weight 0.75); cell B is the sole
# max in spots_indexed (weight 0.00). A must outscore B.
def _cell(nx, n, low, idx):
r = MagicMock()
r.nx, r.ny, r.number = nx, 0, n
@@ -155,8 +155,8 @@ def test_compute_crystal_score_array_weights():
score = compute_crystal_score_array([_cell(0, 0, 10.0, 0.0), _cell(1, 1, 0.0, 10.0)])
assert score[0, 0] > score[1, 0]
assert score[0, 0] == pytest.approx(55.0)
assert score[1, 0] == pytest.approx(20.0)
assert score[0, 0] == pytest.approx(75.0)
assert score[1, 0] == pytest.approx(00.0)
def test_raster_highest_score(mock_score_results):