Coverage for tests/test_jointcal_cfht_minimal.py : 20%

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
"""Test with a minimal catalog extracted from cfht."""
# for MemoryTestCase lsst.utils.tests.init()
def setUpClass(cls): try: cls.data_dir = os.path.join(lsst.utils.getPackageDir('jointcal'), 'tests/data') anet_data_dir = lsst.utils.getPackageDir('testdata_jointcal') os.environ['ASTROMETRY_NET_DATA_DIR'] = os.path.join(anet_data_dir, 'cfht_and_index') except lsst.pex.exceptions.NotFoundError: raise unittest.SkipTest("testdata_jointcal not setup")
do_plot = False
# center of the cfht validation_data catalog center = lsst.afw.geom.SpherePoint(214.884832, 52.6622199, lsst.afw.geom.degrees) radius = 3*lsst.afw.geom.degrees
input_dir = os.path.join(self.data_dir, 'cfht_minimal') all_visits = [849375, 850587] other_args = ['ccd=12']
self.setUp_base(center, radius, input_dir=input_dir, all_visits=all_visits, other_args=other_args, do_plot=do_plot, log_level="debug")
self.config = lsst.jointcal.jointcal.JointcalConfig() self.config.photometryModel = "simpleFlux" self.config.photometryRefObjLoader.retarget(LoadAstrometryNetObjectsTask) self.config.doAstrometry = False self.config.writeInitMatrix = True # write Hessian/gradient files self.jointcalStatistics.do_astrometry = False
# NOTE: ndof==1 from 4 fit parameters (2 model, 2 fittedStar), and # 5 degrees-of-freedom (3 star measurements, with 2 reference stars). metrics = {'collected_photometry_refStars': 183, 'selected_photometry_refStars': 2, 'associated_photometry_fittedStars': 2, 'selected_photometry_fittedStars': 2, 'selected_photometry_ccdImages': 2, 'photometry_final_chi2': 2.336915, 'photometry_final_ndof': 1 }
# The output repo is named after this method. caller = inspect.stack()[0].function self._runJointcalTask(2, caller, metrics=metrics)
# Check that the Hessian/gradient files were written. self.assertTrue(os.path.exists("photometry_preinit-mat.txt")) os.remove("photometry_preinit-mat.txt") self.assertTrue(os.path.exists("photometry_preinit-grad.txt")) os.remove("photometry_preinit-grad.txt") self.assertTrue(os.path.exists("photometry_postinit-mat.txt")) os.remove("photometry_postinit-mat.txt") self.assertTrue(os.path.exists("photometry_postinit-grad.txt")) os.remove("photometry_postinit-grad.txt")
self.config = lsst.jointcal.jointcal.JointcalConfig() self.config.photometryRefObjLoader.retarget(LoadAstrometryNetObjectsTask) self.config.photometryModel = "simpleMagnitude" self.config.doAstrometry = False self.jointcalStatistics.do_astrometry = False
# NOTE: ndof==1 from 4 fit parameters (2 model, 2 fittedStar), and # 5 degrees-of-freedom (3 star measurements, with 2 reference stars). metrics = {'collected_photometry_refStars': 183, 'selected_photometry_refStars': 2, 'associated_photometry_fittedStars': 2, 'selected_photometry_fittedStars': 2, 'selected_photometry_ccdImages': 2, 'photometry_final_chi2': 2.23008, 'photometry_final_ndof': 1 }
# The output repo is named after this method. caller = inspect.stack()[0].function self._runJointcalTask(2, caller, metrics=metrics)
"""Raise an exception if there is no data to process.""" self.config = lsst.jointcal.jointcal.JointcalConfig() self.config.setDefaults() self.config.photometryModel = "simpleFlux" self.config.photometryRefObjLoader.retarget(LoadAstrometryNetObjectsTask) self.config.sourceSelector['astrometry'].minSnr = 10000 self.config.doAstrometry = False
# The output repo is named after this method. caller = inspect.stack()[0].function nCatalogs = 2 visits = '^'.join(str(v) for v in self.all_visits[:nCatalogs]) output_dir = os.path.join('.test', self.__class__.__name__, caller) args = [self.input_dir, '--output', output_dir, '--clobber-versions', '--clobber-config', '--doraise', '--id', 'visit=%s'%visits] args.extend(self.other_args) with self.assertRaises(RuntimeError): jointcal.JointcalTask.parseAndRun(args=args, doReturnResults=True, config=self.config)
"""exitStatus=1 if there is no data to process.""" self.config = lsst.jointcal.jointcal.JointcalConfig() self.config.setDefaults() self.config.photometryModel = "simpleFlux" self.config.photometryRefObjLoader.retarget(LoadAstrometryNetObjectsTask) self.config.sourceSelector['astrometry'].minSnr = 10000 self.config.doAstrometry = False
# The output repo is named after this method. caller = inspect.stack()[0].function nCatalogs = 2 visits = '^'.join(str(v) for v in self.all_visits[:nCatalogs]) output_dir = os.path.join('.test', self.__class__.__name__, caller) args = [self.input_dir, '--output', output_dir, '--clobber-versions', '--clobber-config', '--noExit', # have to specify noExit, otherwise the test quits '--id', 'visit=%s'%visits] args.extend(self.other_args) result = jointcal.JointcalTask.parseAndRun(args=args, doReturnResults=True, config=self.config) self.assertEqual(result.resultList[0].exitStatus, 1)
"""exitStatus=1 if there is no data to process.""" self.config = lsst.jointcal.jointcal.JointcalConfig() self.config.setDefaults() self.config.photometryModel = "simpleFlux" self.config.photometryRefObjLoader.retarget(LoadAstrometryNetObjectsTask) self.config.sourceSelector['astrometry'].minSnr = 10000 self.config.doAstrometry = False
# The output repo is named after this method. caller = inspect.stack()[0].function nCatalogs = 2 visits = '^'.join(str(v) for v in self.all_visits[:nCatalogs]) output_dir = os.path.join('.test', self.__class__.__name__, caller) args = [self.input_dir, '--output', output_dir, '--clobber-versions', '--clobber-config', '--noExit', # have to specify noExit, otherwise the test quits '--id', 'visit=%s'%visits] args.extend(self.other_args) result = jointcal.JointcalTask.parseAndRun(args=args, config=self.config) self.assertEqual(result.resultList[0].exitStatus, 1)
lsst.utils.tests.init() unittest.main() |