Skip to content

Commit 89723bc

Browse files
committed
doc: add comments on test failure
1 parent e6d0200 commit 89723bc

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

tests/test_draw.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,7 +1106,10 @@ def test_shoot():
11061106
obj = galsim.Gaussian(sigma=0.2398318) + 0.1*galsim.Gaussian(sigma=0.47966352)
11071107
obj = obj.withFlux(100001)
11081108
if is_jax_galsim():
1109-
# jax galsim needs double images here
1109+
# for some reason the galsim tests pass at a much higher accuracy
1110+
# than one would expect for float computations (as opposed to double)
1111+
# so for jax-galsim, we do everything in double explicitly to reach
1112+
# the same accuracy
11101113
image1 = galsim.ImageD(32,32, init_value=100)
11111114
else:
11121115
image1 = galsim.ImageF(32,32, init_value=100)
@@ -1117,7 +1120,10 @@ def test_shoot():
11171120
# The test here is really just that it doesn't crash.
11181121
# But let's do something to check correctness.
11191122
if is_jax_galsim():
1120-
# jax galsim needs double images here
1123+
# for some reason the galsim tests pass at a much higher accuracy
1124+
# than one would expect for float computations (as opposed to double)
1125+
# so for jax-galsim, we do everything in double explicitly to reach
1126+
# the same accuracy
11211127
image2 = galsim.ImageD(32,32)
11221128
else:
11231129
image2 = galsim.ImageF(32,32)
@@ -1126,7 +1132,9 @@ def test_shoot():
11261132
maxN=100000)
11271133
image2 += 100
11281134
if is_jax_galsim():
1129-
# jax galsim works not as well
1135+
# jax galsim works not quite as well (matches to 10 decimal places in stead of 12)
1136+
# that is a small enough difference that we should not worry
1137+
# it does not appear to depend on the random number seed
11301138
np.testing.assert_array_almost_equal(image2.array, image1.array, decimal=10)
11311139
else:
11321140
np.testing.assert_array_almost_equal(image2.array, image1.array, decimal=12)

0 commit comments

Comments
 (0)