From 2fe5a42f32367757b5c9be18a2aec821587a68e5 Mon Sep 17 00:00:00 2001 From: beckermr Date: Sat, 9 May 2026 04:54:20 -0500 Subject: [PATCH 1/2] fix: remove change in tests for KImage drawing --- tests/test_draw.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/tests/test_draw.py b/tests/test_draw.py index 082ed16cc1..e6e7179b7e 100644 --- a/tests/test_draw.py +++ b/tests/test_draw.py @@ -527,14 +527,9 @@ def test_drawKImage(): """Test the various optional parameters to the drawKImage function. In particular test the parameters image, and scale in various combinations. """ - if is_jax_galsim(): - maxk_threshold = 1.e-3 - N = 880 - Ns = 28 - else: - maxk_threshold = 1.e-4 - N = 1174 - Ns = 37 + maxk_threshold = 1.e-4 + N = 1174 + Ns = 37 # We use a Moffat profile with beta = 1.5, since its real-space profile is # flux / (2 pi rD^2) * (1 + (r/rD)^2)^3/2 From cfc73eaaf5dc87969693a3c340360f71bd2d976a Mon Sep 17 00:00:00 2001 From: beckermr Date: Sat, 9 May 2026 04:58:17 -0500 Subject: [PATCH 2/2] test: roll back more changes --- tests/test_draw.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/tests/test_draw.py b/tests/test_draw.py index e6e7179b7e..421231c464 100644 --- a/tests/test_draw.py +++ b/tests/test_draw.py @@ -527,10 +527,6 @@ def test_drawKImage(): """Test the various optional parameters to the drawKImage function. In particular test the parameters image, and scale in various combinations. """ - maxk_threshold = 1.e-4 - N = 1174 - Ns = 37 - # We use a Moffat profile with beta = 1.5, since its real-space profile is # flux / (2 pi rD^2) * (1 + (r/rD)^2)^3/2 # and the 2-d Fourier transform of that is @@ -538,13 +534,14 @@ def test_drawKImage(): # So this should draw in Fourier space the same image as the Exponential drawn in # test_drawImage(). obj = galsim.Moffat(flux=test_flux, beta=1.5, scale_radius=0.5) - obj = obj.withGSParams(maxk_threshold=maxk_threshold) + obj = obj.withGSParams(maxk_threshold=1.e-4) # First test drawKImage() with no kwargs. It should: # - create new images # - return the new images # - set the scale to 2pi/(N*obj.nyquist_scale) im1 = obj.drawKImage() + N = 1174 np.testing.assert_equal(im1.bounds, galsim.BoundsI(-N/2,N/2,-N/2,N/2), "obj.drawKImage() produced image with wrong bounds") stepk = obj.stepk @@ -566,7 +563,7 @@ def test_drawKImage(): # - also return that image # - set the scale to obj.stepk # - zero out any existing data - im3 = galsim.ImageCD(N-25,N-25) + im3 = galsim.ImageCD(1149,1149) im4 = obj.drawKImage(im3) np.testing.assert_almost_equal(im3.scale, stepk, 9, "obj.drawKImage(im3) produced image with wrong scale") @@ -614,7 +611,7 @@ def test_drawKImage(): np.testing.assert_almost_equal(CalculateScale(im7), 2, 1, "Measured wrong scale after obj.drawKImage(dx)") # This image is smaller because not using nyquist scale for stepk - np.testing.assert_equal(im7.bounds, galsim.BoundsI(-Ns,Ns,-Ns,Ns), + np.testing.assert_equal(im7.bounds, galsim.BoundsI(-37,37,-37,37), "obj.drawKImage(dx) produced image with wrong bounds") # Test if we provide an image with a defined scale. It should: