Coverage for tests/test_profiles.py : 88%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# # LSST Data Management System # Copyright 2008-2017 LSST Corporation. # # This product includes software developed by the # LSST Project (http://www.lsst.org/). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the LSST License Statement and # the GNU General Public License along with this program. If not, # see <http://www.lsstcorp.org/LegalNotices/>. #
# These parameters match those used to generate the check images; see # tests/data/generate.py ("exp", 9, 8), ("dev", 9, 8), ]
"""Check RadialProfile definitions of moments and half-light radii. """ # lux and luv don't use the true half-light radius; instead they use the half-light radius # of the exp and dev profiles they approximate # lhs of this comparison is the moments radius (using a sum approximation to the integral) profile.getMomentsRadiusFactor(), rtol=0.01)
"""Test that the Gaussian profile's shapelet 'approximation' is actually exact. """
# check1 is the multi-Gaussian approximation, as convolved and evaluated by GalSim,
np.array([1.0], dtype=float))
# check2 is the exact profile, again by GalSim. # We only check exp against the exact profile. The other approximations are less # accurate, and we only really need to test one. The real measure of whether these # profiles are good enough is more complicated than what we can do in a unit test. os.path.join("tests", "data", name + "-exact.fits") ).getArray() rtol=1E-3, relTo=check2.max())
# This was once useful for debugging test failures, and may be again, but it's # redundant with the above and requires putting more check images in git, so # it's disabled by default. for n, sf in enumerate(msf.getComponents()): check = lsst.afw.image.ImageD( os.path.join("tests", "data", "%s-approx-%0d.fits" % (name, n)) ).getArray() image = np.zeros(check1.shape, dtype=float) sf.evaluate().addToImage(lsst.afw.image.ImageD(image, False)) self.assertFloatsAlmostEqual(check, image, plotOnFailure=False, rtol=5E-5, relTo=check1.max())
lsst.utils.tests.init() unittest.main() |