From 4f33fdc05987b5c5a5696d1a9b44579388886013 Mon Sep 17 00:00:00 2001 From: William Lucas Date: Tue, 10 Mar 2026 11:01:45 +0000 Subject: [PATCH 1/5] test_image checks whether fluxes are more than 4*sigma out from a mean of both the original and photon pooling results. --- tests/test_image.py | 46 ++++++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/tests/test_image.py b/tests/test_image.py index d070cf27..590bfc76 100644 --- a/tests/test_image.py +++ b/tests/test_image.py @@ -16,13 +16,17 @@ STAMP_SIZE = 1000 def assert_objects_at_positions(image, expected_positions, expected_brightness_values, pixel_radius=10, rtol=0.1): - """Sum the brightness values of squares of side length `2*pixel_radius` centered at `expected_positions` and compare against `expected_brightness_values`.""" + """Sum the brightness values of squares of side length `2*pixel_radius` centered + at `expected_positions` and compare against `expected_brightness_values` where the + maximum allowed difference is 3 * sqrt(expected).""" brightness_values = np.empty_like(expected_brightness_values) + sigma = 4. * np.sqrt(expected_brightness_values) for i, (col, row) in enumerate(expected_positions): neighbourhood = image[row-pixel_radius:row+pixel_radius, col-pixel_radius:col+pixel_radius] brightness_values[i] = np.sum(neighbourhood) - print("Object: ", i, expected_brightness_values[i], brightness_values[i]) - np.testing.assert_allclose(brightness_values, expected_brightness_values, rtol=rtol) + print("Object: ", i, expected_brightness_values[i], brightness_values[i], sigma[i]) + brightness_difference = np.abs(brightness_values - expected_brightness_values) + np.testing.assert_array_equal(brightness_difference <= sigma, True) def create_test_config( @@ -197,26 +201,26 @@ def run_lsst_image(image_type, stamp_type): [3452, 3751], ]) expected_brightness_values = np.array([ - 1.974843e+06, - 4.325211e+06, + 1.974717e+06, + 4.329067e+06, 0.0, - 1.978054e+06, - 1.973144e+06, - 1.981440e+06, + 1.971714e+06, + 1.971509e+06, + 1.976528e+06, 0.0, - 3.131857e+06, - 1.980739e+06, - 1.977764e+06, - 1.983800e+05, - 4.045435e+06, - 2.195470e+06, - 4.045435e+06, - 1.974780e+05, - 1.966890e+05, - 1.968660e+05, - 1.970680e+05, - 1.965050e+05, - 4.000000e+01, + 3.125554e+06, + 1.978627e+06, + 1.977857e+06, + 1.977190e+05, + 4.049977e+06, + 2.192697e+06, + 4.329907e+06, + 1.971800e+05, + 1.964360e+05, + 1.970330e+05, + 1.970620e+05, + 1.965160e+05, + 3.800000e+01, ]) assert_objects_at_positions(image.array, expected_positions, expected_brightness_values) From 0e4012a12a824fed2e280cacf81f73b641928d98 Mon Sep 17 00:00:00 2001 From: William Lucas Date: Tue, 17 Mar 2026 10:36:34 +0000 Subject: [PATCH 2/5] Pytest is verbose in CI to find which test is failing. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f127e9c5..eb9a3779 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -114,7 +114,7 @@ jobs: setup -r skyCatalogs -j eups list | grep LOCAL galsim --version - pytest --durations=10 -n auto + pytest --durations=10 -n auto -v - name: Check example config files run: | From 4ee6cb556be6aef978403ab3443dddd5e75a62f2 Mon Sep 17 00:00:00 2001 From: William Lucas Date: Tue, 17 Mar 2026 10:56:17 +0000 Subject: [PATCH 3/5] Use Ubuntu 22.04 runner rather than latest in CI. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb9a3779..7eaba8fc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: strategy: matrix: - os: [ ubuntu-latest ] + os: [ ubuntu-22.04 ] py: [ "3.13" ] CC: [ gcc ] CXX: [ g++ ] From 7431e195c3db63d39e45ccee5f31aaabbbfa1254 Mon Sep 17 00:00:00 2001 From: William Lucas Date: Tue, 17 Mar 2026 11:18:26 +0000 Subject: [PATCH 4/5] Move back to ubuntu-latest; single pytest worker. --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7eaba8fc..deec0fca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: strategy: matrix: - os: [ ubuntu-22.04 ] + os: [ ubuntu-latest ] py: [ "3.13" ] CC: [ gcc ] CXX: [ g++ ] @@ -114,7 +114,7 @@ jobs: setup -r skyCatalogs -j eups list | grep LOCAL galsim --version - pytest --durations=10 -n auto -v + pytest --durations=10 -n 1 -v - name: Check example config files run: | From 3b027fad9524e8687df461e8c661b2977700298d Mon Sep 17 00:00:00 2001 From: Mike Jarvis Date: Thu, 19 Mar 2026 13:14:05 -0400 Subject: [PATCH 5/5] Apply suggestion from @rmjarvis --- tests/test_image.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_image.py b/tests/test_image.py index 590bfc76..369dfcca 100644 --- a/tests/test_image.py +++ b/tests/test_image.py @@ -18,7 +18,7 @@ def assert_objects_at_positions(image, expected_positions, expected_brightness_values, pixel_radius=10, rtol=0.1): """Sum the brightness values of squares of side length `2*pixel_radius` centered at `expected_positions` and compare against `expected_brightness_values` where the - maximum allowed difference is 3 * sqrt(expected).""" + maximum allowed difference is 4 * sqrt(expected).""" brightness_values = np.empty_like(expected_brightness_values) sigma = 4. * np.sqrt(expected_brightness_values) for i, (col, row) in enumerate(expected_positions):