Coverage for tests/test_getEimage.py : 47%

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/>. #
"""Test ability to get an eimage from the butler. **Note that this is an lsstSim specific test and should not be considered generalizable. """
"""Test the accessors for various bits of metadata attached to eimages. The exposure is read in setUpClass. The different methods of VisitInfo are tested separately to simplify error reporting. """ def setUpClass(cls): # For lsstSim specific reasons, we need to specify the raft and sensor dataId = dict(visit=840, raft='2,2', sensor='1,1') butler = dafPersistence.Butler(InputDir) cls.exposure = butler.get('eimage', dataId=dataId) cls.visit_info = cls.exposure.getInfo().getVisitInfo()
def tearDownClass(cls): del cls.exposure del cls.visit_info
"""Test whether the Exposure has a Wcs attached."""
# Test for a Wcs object self.assertIsNotNone(self.exposure.getWcs())
self.assertEqual(1.00015190967402, self.visit_info.getBoresightAirmass())
coord = afwGeom.SpherePoint(0.0, 89.0, afwGeom.degrees) self.assertEqual(coord, self.visit_info.getBoresightAzAlt())
coord = afwGeom.SpherePoint(53.0091385, -27.4389488, afwGeom.degrees) self.assertEqual(coord, self.visit_info.getBoresightRaDec())
# Note test eimage header has ROTANG=236.983652. boresightRotAngle is -ROTANG. angle = afwGeom.Angle(-236.983652, afwGeom.degrees) self.assertAnglesAlmostEqual(angle, self.visit_info.getBoresightRotAngle())
self.assertEqual(30.0, self.visit_info.getDarkTime())
date = DateTime("1994-01-02T01:46:59.520000913", DateTime.TAI) self.assertEqual(date, self.visit_info.getDate())
# numpy.isnan fails on afw:Angle, so just get a number out and test that. self.assertTrue(np.isnan(self.visit_info.getEra().asRadians()))
self.assertEqual(430204, self.visit_info.getExposureId())
self.assertEqual(30.0, self.visit_info.getExposureTime())
observatory = Observatory(afwGeom.Angle(-70.749417, afwGeom.degrees), afwGeom.Angle(-30.244633, afwGeom.degrees), 2663) self.assertEqual(observatory, self.visit_info.getObservatory())
self.assertEqual(RotType.SKY, self.visit_info.getRotType())
def test_weather(w1, w2): """Test equality of two Weather objects @param[in] w1 First Weather object @param[in] w2 Second Weather object """ humid_bool = np.isnan(w1.getHumidity()) and np.isnan(w2.getHumidity()) if not humid_bool: humid_bool = (w1.getHumidity() == w2.getHumidity()) self.assertEqual(w1.getAirTemperature(), w2.getAirTemperature()) self.assertEqual(w1.getAirPressure(), w2.getAirPressure()) self.assertTrue(humid_bool)
weather = Weather(20, 69327.64145580001, 40.) test_weather(weather, self.visit_info.getWeather())
lsst.utils.tests.init()
lsst.utils.tests.init() unittest.main() |