From 292095016620331c2d30b96af8c24484d69f696d Mon Sep 17 00:00:00 2001 From: "Matthew R. Becker" Date: Tue, 10 Dec 2024 10:42:55 -0600 Subject: [PATCH 1/6] fix: make sure bounds for images are set consistently when using `center` with `nx`/`ny` --- jax_galsim/gsobject.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/jax_galsim/gsobject.py b/jax_galsim/gsobject.py index 9441c854..c7e841ab 100644 --- a/jax_galsim/gsobject.py +++ b/jax_galsim/gsobject.py @@ -415,6 +415,9 @@ def _setup_image( ) image = Image(nx, ny, dtype=dtype) if center is not None: + # this code has to match the code in _get_new_bounds + # for the same branch of the if statement block + # if center, nx, and ny are given. image.shift( PositionI( jnp.floor(center.x + 0.5 - image.true_center.x), @@ -486,10 +489,13 @@ def _get_new_bounds(self, image, nx, ny, bounds, center): elif nx is not None and ny is not None: b = BoundsI(1, nx, 1, ny) if center is not None: + # this code has to match the code in _setup_image + # for the same branch of the if statement block + # if center, nx and ny are given. b = b.shift( PositionI( - jnp.floor(center.x + 0.5) - b.center.x, - jnp.floor(center.y + 0.5) - b.center.y, + jnp.floor(center.x + 0.5) - b.true_center.x, + jnp.floor(center.y + 0.5) - b.true_center.y, ) ) return b From e2b106e833d9861d87d80d3f30fe0a6d158f47ef Mon Sep 17 00:00:00 2001 From: beckermr Date: Tue, 10 Dec 2024 12:42:32 -0600 Subject: [PATCH 2/6] test: update to latest test suite --- tests/GalSim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/GalSim b/tests/GalSim index d8a549e5..1513366e 160000 --- a/tests/GalSim +++ b/tests/GalSim @@ -1 +1 @@ -Subproject commit d8a549e581a0d4bf32f82e1df3f8c5c17600aa9a +Subproject commit 1513366e3e446a7fbb58500d0b25b388ae271c03 From 8bd804a84c15ea73490f6edad763ef102d5401ab Mon Sep 17 00:00:00 2001 From: beckermr Date: Tue, 10 Dec 2024 12:46:14 -0600 Subject: [PATCH 3/6] fix: make sure to get the pytest import --- tests/GalSim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/GalSim b/tests/GalSim index 1513366e..ea74f8c3 160000 --- a/tests/GalSim +++ b/tests/GalSim @@ -1 +1 @@ -Subproject commit 1513366e3e446a7fbb58500d0b25b388ae271c03 +Subproject commit ea74f8c3422d5235f186afab54adaba0f246fd40 From db8a9c76d00dde5aad1230a796bc9be0f6c974ac Mon Sep 17 00:00:00 2001 From: beckermr Date: Tue, 10 Dec 2024 12:53:03 -0600 Subject: [PATCH 4/6] test: update test module for more export bugs --- tests/GalSim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/GalSim b/tests/GalSim index ea74f8c3..178f1b6f 160000 --- a/tests/GalSim +++ b/tests/GalSim @@ -1 +1 @@ -Subproject commit ea74f8c3422d5235f186afab54adaba0f246fd40 +Subproject commit 178f1b6f79f85d9214925651d138e251b4a4e22f From dac27dfacb341e3945fad546e1dd7e6d48531f53 Mon Sep 17 00:00:00 2001 From: beckermr Date: Tue, 10 Dec 2024 13:09:18 -0600 Subject: [PATCH 5/6] fix: need to have center in the floor operation --- jax_galsim/gsobject.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jax_galsim/gsobject.py b/jax_galsim/gsobject.py index c7e841ab..296173ff 100644 --- a/jax_galsim/gsobject.py +++ b/jax_galsim/gsobject.py @@ -494,8 +494,8 @@ def _get_new_bounds(self, image, nx, ny, bounds, center): # if center, nx and ny are given. b = b.shift( PositionI( - jnp.floor(center.x + 0.5) - b.true_center.x, - jnp.floor(center.y + 0.5) - b.true_center.y, + jnp.floor(center.x + 0.5 - b.true_center.x), + jnp.floor(center.y + 0.5 - b.true_center.y), ) ) return b From 1d2374feb5990d3763df04baba621966aa87bfd8 Mon Sep 17 00:00:00 2001 From: beckermr Date: Tue, 10 Dec 2024 16:53:44 -0600 Subject: [PATCH 6/6] test: ensure path to test input is correct --- tests/GalSim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/GalSim b/tests/GalSim index 178f1b6f..92049283 160000 --- a/tests/GalSim +++ b/tests/GalSim @@ -1 +1 @@ -Subproject commit 178f1b6f79f85d9214925651d138e251b4a4e22f +Subproject commit 92049283e39a45348e6dfc133df0edbf4821d3b3