fix: use total spots according to MW #26

Merged
duan_j merged 3 commits from fix/use_total_spots into main 2026-08-27 17:03:47 +02:00
2 changed files with 3 additions and 13 deletions
+3 -1
View File
@@ -365,9 +365,11 @@ def compute_crystal_score_array(
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.
TODO: update spots and its naming all over the place by middle of Sept 2026
"""
arr_bkg = rebuild_array_from_scan_results(scan_results, "bkg")
arr_low = rebuild_array_from_scan_results(scan_results, "spots_low_res")
arr_low = rebuild_array_from_scan_results(scan_results, "spots")
arr_idx = rebuild_array_from_scan_results(scan_results, "spots_indexed")
def _norm(a: np.ndarray) -> np.ndarray:
-12
View File
@@ -4,7 +4,6 @@ import numpy as np
import pytest
from aarecommon.math.find_xtal import (
compute_crystal_score_array,
create_quality_filtered_array,
get_best_b_factor,
get_best_res,
@@ -134,17 +133,6 @@ def mock_score_results():
return results
def test_compute_crystal_score_array(mock_score_results):
score = compute_crystal_score_array(mock_score_results)
assert score.shape == (2, 2)
# weights sum to 1.0 and each input is min-max normalised to [0, 100]
assert score.min() >= 0.0 and score.max() <= 100.0
# (1, 1) is max in all three inputs -> 100; weak corner (0, 0) is min in all -> 0
assert score[1, 1] == pytest.approx(100.0)
assert score[0, 0] == pytest.approx(0.0)
assert np.unravel_index(np.argmax(score), score.shape) == (1, 1)
def test_raster_highest_score(mock_score_results):
com = raster_highest_score(mock_score_results)
assert com.n_x == 1.0