Skip to content
Draft
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
8 changes: 7 additions & 1 deletion jax_galsim/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -877,9 +877,15 @@ def calculate_fft(self):
# dk = 2pi / (N dk)
dk = jnp.pi / (No2 * dx)

# Use complex64 for float32 inputs, complex128 for float64
if self.dtype == jnp.float32:
fft_dtype = np.complex64
else:
fft_dtype = np.complex128

out = Image(
BoundsI(xmin=0, deltax=No2 + 1, ymin=-No2, deltay=2 * No2),
dtype=np.complex128,
dtype=fft_dtype,
scale=dk,
)
# we shift the image before and after the FFT to match the layout of the modes
Expand Down
3 changes: 2 additions & 1 deletion jax_galsim/interpolatedimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,8 @@ def _image(self):
"InterpolatedImages do not support 'depixelize' in jax_galsim."
)
else:
image = self._jax_children[0].copy(dtype=float)
# Preserve the input dtype
image = self._jax_children[0].copy()

if self._jax_aux_data["_recenter_image"]:
image.setCenter(0, 0)
Expand Down
Loading