Skip to content

Commit

Permalink
Merge pull request #164 from LSSTDESC/fix_optics_psf
Browse files Browse the repository at this point in the history
Fix optics psf

I'll also merge this into the `dc2_run2.0_rc` branch.
  • Loading branch information
jchiang87 committed Sep 14, 2018
2 parents d9018ba + cb15b0b commit 365e169
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
18 changes: 15 additions & 3 deletions python/desc/imsim/atmPSF.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@
class OptWF(object):
def __init__(self, rng, wavelength, gsparams=None):
u = galsim.UniformDeviate(rng)
self.deviations = mock_deviations(seed=int(u()*2**31))
# Fudge factor below comes from an attempt to force the PSF ellipticity distribution to
# match more closely the targets in the SRD (not be too round). (See the discussion at
# https://github.com/LSSTDESC/DC2-production/issues/259). Since the values in the
# mock_deviations function currently rely on a small set of simulations (7), this was deemed
# reasonable.
deviationsFudgeFactor = 3.0
self.deviations = deviationsFudgeFactor*mock_deviations(seed=int(u()*2**31))
self.oz = OpticalZernikes(self.deviations)
self.dynamic = False
self.reversible = True
Expand All @@ -29,8 +35,14 @@ def __eq__(self, rhs):
and self.stepk == rhs.stepk)

def _wavefront_gradient(self, u, v, t, theta):
z = self.oz.cartesian_coeff(theta[0].rad, theta[1].rad)
Z = galsim.OpticalScreen(diam=8.36, obscuration=0.61, aberrations=[0]*4+list(z))
# remap theta to prevent extrapolation beyond a radius of 1.708 degrees, which is the
# radius of the outermost sampling point.
fudgeFactor = 1.708/2.04

z = self.oz.cartesian_coeff(theta[0]/galsim.degrees*fudgeFactor,
theta[1]/galsim.degrees*fudgeFactor)
Z = galsim.OpticalScreen(diam=8.36, obscuration=0.61, aberrations=[0]*4+list(z),
annular_zernike=True)
return Z._wavefront_gradient(u, v, t, theta)

def _stepK(self, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion python/desc/imsim/optical_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def _optimize_fits(self):
"""

x, y = self.cartesian_coords
basis = zernikeBasis(22, x, y)
basis = zernikeBasis(15, x, y)

out = []
for coefficient in self.sampling_coeff:
Expand Down

0 comments on commit 365e169

Please sign in to comment.