Skip to content
Merged
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
16 changes: 4 additions & 12 deletions tests/test_draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -1317,19 +1317,11 @@ def test_fft():
np.testing.assert_array_almost_equal(xim.array, xim2.array)

# Now use drawKImage (as above in test_drawKImage) to get a more realistic k-space image
# NB. It is useful to have this come out not a multiple of 4, since some of the
# calculation needs to be different when N/2 is odd.
if is_jax_galsim():
maxk_threshold = 0.78e-3
N = 912
Nfft = 1024
else:
maxk_threshold = 1.e-4
N = 1174
Nfft = 1536
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)
im1 = obj.drawKImage()
N = 1174 # NB. It is useful to have this come out not a multiple of 4, since some of the
# calculation needs to be different when N/2 is odd.
np.testing.assert_equal(im1.bounds, galsim.BoundsI(-N/2,N/2,-N/2,N/2),
"obj.drawKImage() produced image with wrong bounds")
nyq_scale = obj.nyquist_scale
Expand All @@ -1356,7 +1348,7 @@ def test_fft():
# If we give both a good size to use and match up the scales, then they should produce the
# same thing.
N = galsim.Image.good_fft_size(N)
assert N == Nfft
assert N == 1536 == 3 * 2**9
kscale = 2.*np.pi / (N * nyq_scale)
im2 = obj.drawKImage(nx=N+1, ny=N+1, scale=kscale)
im2_real = im2.calculate_inverse_fft()
Expand Down
Loading