Coverage for tests/test_loadref_hsc.py : 26%

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
# See COPYRIGHT file at the top of the source tree. # # This file is part of fgcmcal. # # Developed for the LSST Data Management System. # This product includes software developed by the LSST Project # (https://www.lsst.org). # See the COPYRIGHT file at the top-level directory of this distribution # for details of code ownership. # # 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 GNU General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
def setUpClass(cls): try: cls.dataDir = lsst.utils.getPackageDir('testdata_jointcal') except LookupError: raise unittest.SkipTest("testdata_jointcal not setup")
self.inputDir = os.path.join(self.dataDir, 'hsc')
lsst.log.setLevel("HscMapper", lsst.log.FATAL)
""" Test loading of the fgcm reference catalogs. """
filterList = ['r', 'i']
config = fgcmcal.FgcmLoadReferenceCatalogConfig() config.applyColorTerms = True config.refObjLoader.ref_dataset_name = 'sdss-dr9-fink-v5b' config.colorterms.data = {} config.colorterms.data['sdss*'] = lsst.pipe.tasks.colorterms.ColortermDict() config.colorterms.data['sdss*'].data = {} config.colorterms.data['sdss*'].data['g'] = lsst.pipe.tasks.colorterms.Colorterm() config.colorterms.data['sdss*'].data['g'].primary = 'g' config.colorterms.data['sdss*'].data['g'].secondary = 'r' config.colorterms.data['sdss*'].data['g'].c0 = -0.00816446 config.colorterms.data['sdss*'].data['g'].c1 = -0.08366937 config.colorterms.data['sdss*'].data['g'].c2 = -0.00726883 config.colorterms.data['sdss*'].data['r'] = lsst.pipe.tasks.colorterms.Colorterm() config.colorterms.data['sdss*'].data['r'].primary = 'r' config.colorterms.data['sdss*'].data['r'].secondary = 'i' config.colorterms.data['sdss*'].data['r'].c0 = 0.0013181 config.colorterms.data['sdss*'].data['r'].c1 = 0.01284177 config.colorterms.data['sdss*'].data['r'].c2 = -0.03068248 config.colorterms.data['sdss*'].data['i'] = lsst.pipe.tasks.colorterms.Colorterm() config.colorterms.data['sdss*'].data['i'].primary = 'i' config.colorterms.data['sdss*'].data['i'].secondary = 'z' config.colorterms.data['sdss*'].data['i'].c0 = 0.00130204 config.colorterms.data['sdss*'].data['i'].c1 = -0.16922042 config.colorterms.data['sdss*'].data['i'].c2 = -0.01374245
butler = dafPersist.Butler(self.inputDir) loadCat = fgcmcal.FgcmLoadReferenceCatalogTask(butler, config=config)
ra = 320.0 dec = 0.0 rad = 0.1
refCat = loadCat.getFgcmReferenceStarsSkyCircle(ra, dec, rad, filterList)
# Check the number of mags and ranges self.assertEqual(len(filterList), refCat['refMag'].shape[1]) self.assertEqual(len(filterList), refCat['refMagErr'].shape[1]) self.assertLess(np.max(refCat['refMag'][:, 0]), 99.1) self.assertLess(np.max(refCat['refMag'][:, 1]), 99.1) self.assertLess(np.max(refCat['refMagErr'][:, 0]), 99.1) self.assertLess(np.max(refCat['refMagErr'][:, 1]), 99.1)
# Check the separations from the center self.assertLess(np.max(esutil.coords.sphdist(ra, dec, refCat['ra'], refCat['dec'])), rad)
# And load a healpixel nside = 256 pixel = 393614
refCat = loadCat.getFgcmReferenceStarsHealpix(nside, pixel, filterList)
ipring = hp.ang2pix(nside, np.radians(90.0 - refCat['dec']), np.radians(refCat['ra'])) self.assertEqual(pixel, np.max(ipring)) self.assertEqual(pixel, np.min(ipring))
lsst.utils.tests.init()
lsst.utils.tests.init() unittest.main() |