Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions jax_galsim/interpolatedimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
from jax_galsim.interpolant import Quintic
from jax_galsim.photon_array import PhotonArray
from jax_galsim.position import PositionD
from jax_galsim.random import UniformDeviate
from jax_galsim.transform import Transformation
from jax_galsim.utilities import convert_interpolant
from jax_galsim.wcs import BaseWCS, PixelScale
Expand Down Expand Up @@ -866,13 +865,12 @@ def _shoot(self, photons, rng):
).astype(int)
yinds, xinds = jnp.unravel_index(inds, img.array.shape)

xedges = jnp.arange(0, img.bounds.deltax + 1) - 0.5
yedges = jnp.arange(0, img.bounds.deltay + 1) - 0.5
# the photons come from this index location
xcens = jnp.arange(0, img.bounds.deltax + 1) + img.bounds.xmin
ycens = jnp.arange(0, img.bounds.deltay + 1) + img.bounds.ymin
photons.x = xcens[xinds]
photons.y = ycens[yinds]

# now we draw the position within the pixel
ud = UniformDeviate(rng)
photons.x = ud.generate(photons.x) + xedges[xinds] + img.bounds.xmin
photons.y = ud.generate(photons.y) + yedges[yinds] + img.bounds.ymin
# this magic set of factors comes from the galsim C++ code in
# a few spots it is
#
Expand Down
2 changes: 1 addition & 1 deletion tests/GalSim
Loading