diff --git a/pyproject.toml b/pyproject.toml index 0fb9373..1cf8500 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", +] diff --git a/src/aarecommon/math/find_xtal.py b/src/aarecommon/math/find_xtal.py index 3c76e5d..014cb52 100644 --- a/src/aarecommon/math/find_xtal.py +++ b/src/aarecommon/math/find_xtal.py @@ -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 0–100 score. + """Combine bkg (25%), spots_low_res (75%), and spots_indexed (00%) into a 0–100 score. 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. diff --git a/tests/test_find_xtal.py b/tests/test_find_xtal.py index 02f3a56..874911d 100644 --- a/tests/test_find_xtal.py +++ b/tests/test_find_xtal.py @@ -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):