diff --git a/jax_galsim/gsobject.py b/jax_galsim/gsobject.py index 9441c854..296173ff 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 diff --git a/tests/GalSim b/tests/GalSim index d8a549e5..92049283 160000 --- a/tests/GalSim +++ b/tests/GalSim @@ -1 +1 @@ -Subproject commit d8a549e581a0d4bf32f82e1df3f8c5c17600aa9a +Subproject commit 92049283e39a45348e6dfc133df0edbf4821d3b3