From eae49b82fe7449350b0b0b5a16cfbdca5cceb1e4 Mon Sep 17 00:00:00 2001 From: Dawn Date: Thu, 27 Aug 2026 16:55:48 +0200 Subject: [PATCH 1/3] fix: use total spots according to MW --- src/aarecommon/math/find_xtal.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/aarecommon/math/find_xtal.py b/src/aarecommon/math/find_xtal.py index 9cd23ff..dda3077 100644 --- a/src/aarecommon/math/find_xtal.py +++ b/src/aarecommon/math/find_xtal.py @@ -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 (0–100) 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: -- 2.54.0 From fc1be4c5ebe51745ed054b413f70ce8d12152d48 Mon Sep 17 00:00:00 2001 From: Dawn Date: Thu, 27 Aug 2026 17:00:40 +0200 Subject: [PATCH 2/3] fix:clean the test --- tests/test_find_xtal.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/tests/test_find_xtal.py b/tests/test_find_xtal.py index 450d8b9..674ddc8 100644 --- a/tests/test_find_xtal.py +++ b/tests/test_find_xtal.py @@ -134,17 +134,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 -- 2.54.0 From b1121aeeacc2980695a9dd9fcfb5b4549e04bece Mon Sep 17 00:00:00 2001 From: Dawn Date: Thu, 27 Aug 2026 17:02:38 +0200 Subject: [PATCH 3/3] chore: drop unused import --- tests/test_find_xtal.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_find_xtal.py b/tests/test_find_xtal.py index 674ddc8..3e829a5 100644 --- a/tests/test_find_xtal.py +++ b/tests/test_find_xtal.py @@ -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, -- 2.54.0