Skip to content

Commit 7061ca2

Browse files
committed
fix: smaller diff
1 parent 7da01da commit 7061ca2

1 file changed

Lines changed: 28 additions & 29 deletions

File tree

tests/test_interpolatedimage.py

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1892,38 +1892,37 @@ def test_drawreal_seg_fault():
18921892
"""Test to reproduce bug report in Issue #1164 that was causing seg faults
18931893
"""
18941894
# this test only runs with real galsim
1895-
if is_jax_galsim():
1896-
pass
1897-
else:
1898-
import pickle
1895+
if is_jax_galsim(): return
18991896

1900-
prof_file = os.path.join(
1901-
os.path.dirname(__file__),
1902-
'input/test_interpolatedimage_seg_fault_prof.pkl'
1903-
)
1904-
with open(prof_file, 'rb') as f:
1905-
prof = pickle.load(f)
1906-
print(repr(prof))
1907-
1908-
image = galsim.Image(
1909-
galsim.BoundsI(
1910-
xmin=-12,
1911-
xmax=12,
1912-
ymin=-12,
1913-
ymax=12
1914-
),
1915-
dtype=float,
1916-
scale=1
1917-
)
1897+
import pickle
1898+
1899+
prof_file = os.path.join(
1900+
os.path.dirname(__file__),
1901+
'input/test_interpolatedimage_seg_fault_prof.pkl'
1902+
)
1903+
with open(prof_file, 'rb') as f:
1904+
prof = pickle.load(f)
1905+
print(repr(prof))
1906+
1907+
image = galsim.Image(
1908+
galsim.BoundsI(
1909+
xmin=-12,
1910+
xmax=12,
1911+
ymin=-12,
1912+
ymax=12
1913+
),
1914+
dtype=float,
1915+
scale=1
1916+
)
19181917

1919-
image.fill(3)
1920-
prof.drawReal(image)
1918+
image.fill(3)
1919+
prof.drawReal(image)
19211920

1922-
# The problem was that the object is shifted fully off the target image and that was leading
1923-
# to an attempt to create a stack of length -1, which caused the seg fault.
1924-
# So mostly this test just confirms that this runs without seg faulting.
1925-
# But we can check that the image is now correctly all zeros.
1926-
np.testing.assert_array_equal(image.array, 0)
1921+
# The problem was that the object is shifted fully off the target image and that was leading
1922+
# to an attempt to create a stack of length -1, which caused the seg fault.
1923+
# So mostly this test just confirms that this runs without seg faulting.
1924+
# But we can check that the image is now correctly all zeros.
1925+
np.testing.assert_array_equal(image.array, 0)
19271926

19281927

19291928
@timer

0 commit comments

Comments
 (0)