Coverage for tests/test_processCcd.py : 96%

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-2016 AURA/LSST. # # 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 <https://www.lsstcorp.org/LegalNotices/>. #
Run the task on one obs_test image and perform various checks on the results """
"""Helper function to get a command-line task config customized by obs_test.
This duplicates the config override code in pipe_base's ArgumentParser, but essentially in order to test it. """
"""test ProcessCcdTask via parseAndRun (simulating the command line)
This is intended as a sanity check of the task, not a detailed test of its sub-tasks. As such comparisons are intentionally loose, so as to allow evolution of the sub-tasks over time without breaking this test. """ args=[InputDir, "--output", outPath, "--clobber-config", "--doraise", "-c", "charImage.doWriteExposure=True", "--id"] + dataIdStrList, doReturnResults=True )
# the following makes pyflakes linter happy and the code more robust
afwGeom.Box2I(afwGeom.Point2I(0, 0), afwGeom.Extent2I(1018, 2000)))
(bgMean, 191.51453611409124), (bgStdDev, 0.22438381414455047), (numGoodPix, 1965508), (imMean, 0.99592485493752636), (imStdDev, 95.64609939459902), (varMean, 131.16293718847217), (varStdDev, 64.806576059889963), (psfIxx, 2.8540480723051846), (psfIyy, 2.173868563513369), (psfIxy, 0.14397457739362085) ]:
else:
finally: else: print("testProcessCcd.py's output data saved to %r" % (OutputName,))
"""Compare two Catalogs for equality.
This should only be used in contexts where it's unlikely that the catalogs will be subtly different; instead of comparing all values we simply do a spot check of a few cells.
This does not require that either catalog be contiguous (which is why we can't use column access). """
fixNaN(record1.get(item.key)), fixNaN(record2.get(item.key)), "{} != {} in field {}".format(record1.get(item.key), record2.get(item.key), name) )
"""Compare two BackgroundLists for equality.
This should only be used in contexts where it's unlikely that the catalogs will be subtly different; instead of comparing all values we simply do a spot check of a few cells.
This does not require that either catalog be contiguous (which is why we can't use column access). """
"""Test that we can run the first-level subtasks of ProcessCcdTasks.
This tests that we can run these subtasks from the command-line independently (they're all CmdLineTasks) as well as directly from Python (without giving them access to a Butler).
Aside from verifying that no exceptions are raised, we simply tests that most persisted results are present and equivalent to both in-memory results. """ # We'll use an input butler to get data for the tasks we call from Python, but we won't ever give it # to those tasks. # Construct task instances we can use directly from Python config=getObsTestConfig(IsrTask), name="isr2" ) # If we ever enable astrometry and photocal in obs_test, we'll need to pass a refObjLoader to these # tasks. To maintain the spirit of these tests, we'd ideally have a LoadReferenceObjectsTask class # that doesn't require a Butler. If we don't, we should construct a butler-based on outside these # task constructors and pass the LoadReferenceObjectsTask instance to the task constructors. config=getObsTestConfig(CharacterizeImageTask), name="charImage2" ) config=getObsTestConfig(CalibrateTask), name="calibrate2", icSourceSchema=charImageTask.schema )
args=[InputDir, "--output", outPath, "--clobber-config", "--doraise", "--id"] + dataIdStrList, doReturnResults=True, ) # We'll just use the butler to get the original image and calibration frames; it's not clear # extending the test coverage to include that is worth it. rawExposure, bias=isrData.bias, linearizer=isrData.linearizer, flat=isrData.flat, defects=isrData.defects, fringes=isrData.fringes, bfKernel=isrData.bfKernel, camera=camera, ) isrResult1.parsedCmd.butler.get("postISRCCD", dataId, immediate=True).getMaskedImage(), isrResult1.resultList[0].result.exposure.getMaskedImage() ) isrResult2.exposure.getMaskedImage(), isrResult1.resultList[0].result.exposure.getMaskedImage() )
args=[InputDir, "--output", outPath, "--clobber-config", "--doraise", "--id"] + dataIdStrList, doReturnResults=True, ) icResult1.parsedCmd.butler.get("icExp", dataId, immediate=True).getMaskedImage(), icResult1.resultList[0].result.exposure.getMaskedImage() ) icResult2.exposure.getMaskedImage(), icResult1.resultList[0].result.exposure.getMaskedImage() ) icResult1.parsedCmd.butler.get("icSrc", dataId, immediate=True), icResult1.resultList[0].result.sourceCat ) icResult2.sourceCat, icResult1.resultList[0].result.sourceCat, skipCols=("id", "parent") # since we didn't want to pass in an ExposureIdInfo, IDs disagree ) icResult1.parsedCmd.butler.get("icExpBackground", dataId, immediate=True), icResult1.resultList[0].result.background ) icResult2.background, icResult1.resultList[0].result.background )
args=[InputDir, "--output", outPath, "--clobber-config", "--doraise", "--id"] + dataIdStrList, doReturnResults=True, ) icResult2.exposure, background=icResult2.background, icSourceCat=icResult2.sourceCat ) calResult1.parsedCmd.butler.get("calexp", dataId, immediate=True).getMaskedImage(), calResult1.resultList[0].result.exposure.getMaskedImage() ) calResult2.exposure.getMaskedImage(), calResult1.resultList[0].result.exposure.getMaskedImage() ) calResult1.parsedCmd.butler.get("src", dataId, immediate=True), calResult1.resultList[0].result.sourceCat ) calResult2.sourceCat, calResult1.resultList[0].result.sourceCat, skipCols=("id", "parent") ) calResult1.parsedCmd.butler.get("calexpBackground", dataId, immediate=True), calResult1.resultList[0].result.background ) calResult2.background, calResult1.resultList[0].result.background )
finally: else: print("testProcessCcd.py's output data saved to %r" % (OutputName,))
lsst.utils.tests.init() unittest.main() |