Skip to content

Commit 410c69c

Browse files
committed
Make PhotonDCR work correctly with both sky_pos and zenith_angle
1 parent 41106ab commit 410c69c

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

galsim/dcr.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ def parse_dcr_angles(**kwargs):
131131
if 'zenith_angle' in kwargs:
132132
zenith_angle = kwargs.pop('zenith_angle')
133133
parallactic_angle = kwargs.pop('parallactic_angle', 0.0*degrees)
134+
kwargs.pop('obj_coord', None) # Ok if present, but want to make sure we remove it.
134135
if not isinstance(zenith_angle, Angle):
135136
raise TypeError("zenith_angle must be a galsim.Angle.")
136137
if not isinstance(parallactic_angle, Angle):

tests/test_photon_array.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,12 @@ def test_dcr():
710710
im2c = galsim.config.BuildImage(config)
711711
assert im2c == im2
712712

713+
# Make sure it's ok if sky_pos is set. (This used to be a bug.)
714+
config['sky_pos'] = galsim.CelestialCoord(15 * galsim.degrees, -25 * galsim.degrees)
715+
galsim.config.RemoveCurrent(config)
716+
im2d = galsim.config.BuildImage(config)
717+
assert im2c == im2
718+
713719
# Should work with fft, but not quite match (because of inexact photon locations).
714720
im3 = galsim.ImageF(50, 50, scale=pixel_scale)
715721
achrom.drawImage(image=im3, method='fft', rng=rng, photon_ops=photon_ops)

0 commit comments

Comments
 (0)