def setArgDict(self, md, argDict): """Set an argument dict for VisitInfo and pop associated metadata Parameters ---------- md : `lsst.daf.base.PropertyList` or `lsst.daf.base.PropertySet` Metadata to extract from. Extracted values are removed. argdict : `dict` A dict of arguments to add to values to. """ MakeRawVisitInfo.setArgDict(self, md, argDict) argDict["darkTime"] = self.popFloat(md, "DARKTIME") argDict["boresightAzAlt"] = SpherePoint( self.popAngle(md, "TELAZ"), self.popAngle(md, "TELALT"), ) argDict["boresightRaDec"] = SpherePoint( self.popAngle(md, "RA_DEG",), self.popAngle(md, "DEC_DEG"), ) argDict["boresightAirmass"] = self.popFloat(md, "AIRMASS") argDict["observatory"] = Observatory( self.popAngle(md, "LONGITUD"), self.popAngle(md, "LATITUDE"), 4204, # from Wikipedia ) argDict["weather"] = Weather( self.popFloat(md, "TEMPERAT"), self.popFloat(md, "PRESSURE")*100.0, # 100 Pascal per millibar self.popFloat(md, "RELHUMID"), ) # Using LST to compute ERA until we get UT1 (see: DM-8053) LST = self.popAngle(md, "LST-OBS", units=astropy.units.h) argDict['era'] = self.eraFromLstAndLongitude(LST, argDict["observatory"].getLongitude())
def setArgDict(self, md, argDict): """Set an argument dict for makeVisitInfo and pop associated metadata @param[in,out] md metadata, as an lsst.daf.base.PropertyList or PropertySet @param[in,out] argdict a dict of arguments """ MakeRawVisitInfo.setArgDict(self, md, argDict) argDict["darkTime"] = self.popFloat(md, "DARKTIME") argDict["boresightAzAlt"] = Coord( self.popAngle(md, "AZIMUTH"), self.altitudeFromZenithDistance(self.popAngle(md, "ZENITH")), ) argDict["boresightRaDec"] = IcrsCoord( self.popAngle(md, "RA_DEG"), self.popAngle(md, "DEC_DEG"), ) argDict["boresightAirmass"] = self.popFloat(md, "AIRMASS") argDict["boresightRotAngle"] = 90 * degrees - self.popAngle( md, "ROTANG") argDict["rotType"] = RotType_SKY argDict["observatory"] = self.observatory argDict["weather"] = Weather( self.popFloat(md, "TEMPERA"), self.pascalFromMmHg(self.popFloat(md, "PRESS")), float("nan"), ) return makeVisitInfo(**argDict)
def setArgDict(self, md, argDict): """Set an argument dict for VisitInfo and pop associated metadata @param[in,out] md metadata, as an lsst.daf.base.PropertyList or PropertySet @param[in,out] argdict a dict of arguments """ MakeRawVisitInfo.setArgDict(self, md, argDict) argDict["darkTime"] = self.popFloat(md, "DARKTIME") argDict["boresightAzAlt"] = Coord( self.popAngle(md, "AZ"), self.altitudeFromZenithDistance(self.popAngle(md, "ZD")), ) argDict["boresightRaDec"] = IcrsCoord( self.popAngle(md, "TELRA", units=astropy.units.h), self.popAngle(md, "TELDEC"), ) argDict["boresightAirmass"] = self.popFloat(md, "AIRMASS") argDict["observatory"] = Observatory( self.popAngle(md, "OBS-LONG"), self.popAngle(md, "OBS-LAT"), self.popFloat(md, "OBS-ELEV"), ) argDict["weather"] = Weather( self.popFloat(md, "OUTTEMP"), self.pascalFromMmHg(self.popFloat(md, "PRESSURE")), self.popFloat(md, "HUMIDITY")) longitude = argDict["observatory"].getLongitude() argDict['era'] = self.decamGetEra(md, argDict["boresightRaDec"][0], longitude)
def setUp(self): rawPath = os.path.join(testDataDirectory, "hsc", "raw") calibPath = os.path.join(testDataDirectory, "hsc", "calib") self.repoPath = createDataRepository("lsst.obs.hsc.HscMapper", rawPath, calibPath) self.butler = dafPersist.Butler(root=self.repoPath, calibRoot=calibPath) # The following properties of the provided data are known a priori. self.visit = 904024 self.ccdNum = 50 self.filter = 'i' self.rawSize = (2144, 4241) self.ccdSize = (2048, 4176) self.exptime = 30.0 self.darktime = self.exptime # No explicit darktime dateBeg = DateTime(56598.26106374757, DateTime.MJD, DateTime.UTC) dateAvgNSec = dateBeg.nsecs() + int(0.5e9*self.exptime) self.dateAvg = DateTime(dateAvgNSec, DateTime.TAI) self.boresightRaDec = afwGeom.SpherePoint(320.7499250000, 0.500019444, degrees) self.boresightAzAlt = afwGeom.SpherePoint(226.68922661, 63.04359233, degrees) self.boresightAirmass = 1.121626027604189 self.boresightRotAngle = 270.0*degrees self.rotType = RotType.SKY self.obs_longitude = -155.476667*degrees self.obs_latitude = 19.825556*degrees self.obs_elevation = 4139 self.weath_airTemperature = MakeRawVisitInfo.centigradeFromKelvin(272.35) self.weath_airPressure = MakeRawVisitInfo.pascalFromMmHg(621.7) self.weath_humidity = 33.1 # NOTE: if we deal with DM-8053 and get UT1 implemented, ERA will change slightly. lst = 340.189608333*degrees self.era = lst - self.obs_longitude
def setArgDict(self, md, argDict): """Set an argument dict for VisitInfo and pop associated metadata @param[in,out] md metadata, as an lsst.daf.base.PropertyList or PropertySet @param[in,out] argdict a dict of arguments """ MakeRawVisitInfo.setArgDict(self, md, argDict) #argDict["boresightRaDec"] = SpherePoint( #self.popAngle(md, "RA", units=astropy.units.h), #self.popAngle(md, "DEC"), #) #altitude = self.popAngle(md, "ALTITUDE") #altitude = self.popAngle(md, "EL") #if altitude > 90*degrees: # Sometimes during day observations, when not tracking # if self.log is not None: # self.log.warn("Clipping altitude (%f) at 90 degrees", altitude) # altitude = 90*degrees #argDict["boresightAzAlt"] = SpherePoint( # self.popAngle(md, "AZ"), # altitude, # ) #argDict["boresightAirmass"] = self.popFloat(md, "AIRMASS") #argDict["observatory"] = self.observatory #argDict["weather"] = Weather( # self.centigradeFromKelvin(self.popFloat(md, "OUT-TMP")), # self.pascalFromMmHg(self.popFloat(md, "OUT-PRS")), # self.popFloat(md, "OUT-HUM"), #) #LST = self.popAngle(md, "LST-STR", units=astropy.units.h) #argDict['era'] = self.eraFromLstAndLongitude(LST, self.observatory.getLongitude()) argDict['darkTime'] = argDict['exposureTime']
def setArgDict(self, md, argDict): """Set an argument dict for makeVisitInfo and pop associated metadata @param[in,out] md metadata, as an lsst.daf.base.PropertyList or PropertySet @param[in,out] argdict a dict of arguments """ MakeRawVisitInfo.setArgDict(self, md, argDict) argDict["boresightRaDec"] = IcrsCoord( self.popAngle(md, "RA2000", units=astropy.units.h), self.popAngle(md, "DEC2000"), ) # argDict["boresightAzAlt"] = Coord( # self.popAngle(md, "AZIMUTH"), # self.popAngle(md, "ALTITUDE"), # ) argDict["boresightAirmass"] = self.popFloat(md, "AIRMASS") argDict["observatory"] = self.observatory argDict["weather"] = Weather( self.centigradeFromKelvin(self.popFloat(md, "OUT-TMP")), self.pascalFromMmHg(self.popFloat(md, "OUT-PRS")), self.popFloat(md, "OUT-HUM"), ) LST = self.popAngle(md, "LST-STR", units=astropy.units.h) argDict['era'] = self.eraFromLstAndLongitude( LST, self.observatory.getLongitude()) argDict['darkTime'] = argDict['exposureTime']
def setArgDict(self, md, argDict): """Set an argument dict for VisitInfo and pop associated metadata @param[in,out] md metadata, as an lsst.daf.base.PropertyList or PropertySet @param[in,out] argdict a dict of arguments """ MakeRawVisitInfo.setArgDict(self, md, argDict) argDict["boresightRaDec"] = IcrsCoord( self.popAngle(md, "RA2000", units=astropy.units.h), self.popAngle(md, "DEC2000"), ) argDict["boresightAzAlt"] = Coord( self.popAngle(md, "AZIMUTH"), self.popAngle(md, "ALTITUDE"), ) argDict["boresightAirmass"] = self.popFloat(md, "AIRMASS") argDict["observatory"] = self.observatory argDict["weather"] = Weather( self.centigradeFromKelvin(self.popFloat(md, "OUT-TMP")), self.pascalFromMmHg(self.popFloat(md, "OUT-PRS")), self.popFloat(md, "OUT-HUM"), ) LST = self.popAngle(md, "LST-STR", units=astropy.units.h) argDict['era'] = self.eraFromLstAndLongitude( LST, self.observatory.getLongitude()) argDict['darkTime'] = argDict['exposureTime'] # Rotation angle formula determined empirically from visual inspection # of HSC images. See DM-9111. rotAngle = (270.0 * degrees - self.popAngle(md, "INST-PA")).wrap() argDict['boresightRotAngle'] = rotAngle argDict['rotType'] = RotType.SKY
def setArgDict(self, md, argDict): """Set an argument dict for makeVisitInfo and pop associated metadata @param[in,out] md metadata, as an lsst.daf.base.PropertyList or PropertySet @param[in,out] argdict a dict of arguments """ MakeRawVisitInfo.setArgDict(self, md, argDict)
def setArgDict(self, md, argDict): """Set an argument dict for VisitInfo and pop associated metadata @param[in,out] md metadata, as an lsst.daf.base.PropertyList or PropertySet @param[in,out] argdict a dict of arguments """ MakeRawVisitInfo.setArgDict(self, md, argDict) argDict["darkTime"] = self.popFloat(md, "DARKTIME") argDict["boresightAzAlt"] = Coord( self.popAngle(md, "AZIMUTH"), self.altitudeFromZenithDistance(self.popAngle(md, "ZENITH")), ) argDict["boresightRaDec"] = IcrsCoord( self.popAngle(md, "RA_DEG"), self.popAngle(md, "DEC_DEG"), ) argDict["boresightAirmass"] = self.popFloat(md, "AIRMASS") argDict["boresightRotAngle"] = -self.popAngle(md, "ROTANG") argDict["rotType"] = RotType.SKY argDict["observatory"] = self.observatory argDict["weather"] = Weather( self.popFloat(md, "TEMPERA"), self.pascalFromMmHg(self.popFloat(md, "PRESS")), float("nan"), ) # phosim doesn't supply LST, HA, or UT1, and the alt/az/ra/dec/time can be inconsistent. # We will leave ERA as NaN until a better answer is available. return VisitInfo(**argDict)
def setArgDict(self, md, argDict): """Set an argument dict for VisitInfo and pop associated metadata @param[in,out] md metadata, as an lsst.daf.base.PropertyList or PropertySet @param[in,out] argdict a dict of arguments """ MakeRawVisitInfo.setArgDict(self, md, argDict) argDict["darkTime"] = self.popFloat(md, "DARKTIME") argDict["boresightAzAlt"] = Coord( self.popAngle(md, "TELAZ"), self.popAngle(md, "TELALT"), ) argDict["boresightRaDec"] = IcrsCoord( self.popAngle( md, "RA_DEG", ), self.popAngle(md, "DEC_DEG"), ) argDict["boresightAirmass"] = self.popFloat(md, "AIRMASS") argDict["observatory"] = Observatory( self.popAngle(md, "LONGITUD"), self.popAngle(md, "LATITUDE"), 4204, # from Wikipedia ) argDict["weather"] = Weather( self.popFloat(md, "TEMPERAT"), self.popFloat(md, "PRESSURE") * 100.0, # 100 Pascal per millibar self.popFloat(md, "RELHUMID"), ) # Using LST to compute ERA until we get UT1 (see: DM-8053) LST = self.popAngle(md, "LST-OBS", units=astropy.units.h) argDict['era'] = self.eraFromLstAndLongitude( LST, argDict["observatory"].getLongitude())
def setArgDict(self, md, argDict): """Set an argument dict for VisitInfo and pop associated metadata @param[in,out] md metadata, as an lsst.daf.base.PropertyList or PropertySet @param[in,out] argdict a dict of arguments """ MakeRawVisitInfo.setArgDict(self, md, argDict) argDict["darkTime"] = self.popFloat(md, "DARKTIME") argDict["boresightAzAlt"] = Coord( self.popAngle(md, "AZIMUTH"), self.altitudeFromZenithDistance(self.popAngle(md, "ZENITH")), ) argDict["boresightRaDec"] = IcrsCoord( self.popAngle(md, "RA_DEG"), self.popAngle(md, "DEC_DEG"), ) argDict["boresightAirmass"] = self.popFloat(md, "AIRMASS") argDict["boresightRotAngle"] = -self.popAngle(md, "ROTANG") argDict["rotType"] = RotType.SKY argDict["observatory"] = self.observatory weather = defaultWeather(self.observatory.getElevation()) temperature = self.defaultMetadata(self.popFloat(md, "TEMPERA"), weather.getAirTemperature(), minimum=-10, maximum=40.) pressure = self.defaultMetadata(self.pascalFromMmHg( self.popFloat(md, "PRESS")), weather.getAirPressure(), minimum=50000., maximum=90000.) humidity = 40. # Not currently supplied by phosim, so set to a typical value. argDict["weather"] = Weather(temperature, pressure, humidity) longitude = argDict["observatory"].getLongitude() RA = argDict["boresightRaDec"][0] # phosim doesn't supply LST, HA, or UT1, and the alt/az/ra/dec/time can be inconsistent. # We will leave ERA as NaN until a better answer is available. try: # Other simulation tools don't have the same problem, and need hour angle if it is available. HA = self.popAngle(md, "HA", units=astropy.units.h) argDict['era'] = HA + RA - longitude except: self.log.warn("Hour angle missing from metadata, will be NAN") return VisitInfo(**argDict)
def setArgDict(self, md, argDict): """Set an argument dict for VisitInfo and pop associated metadata @param[in,out] md metadata, as an lsst.daf.base.PropertyList or PropertySet @param[in,out] argdict a dict of arguments """ MakeRawVisitInfo.setArgDict(self, md, argDict) argDict["darkTime"] = self.popFloat(md, "DARKTIME") argDict["boresightAzAlt"] = SpherePoint( self.popAngle(md, "AZ"), self.altitudeFromZenithDistance(self.popAngle(md, "ZD")), ) argDict["boresightRaDec"] = SpherePoint( self.popAngle(md, "TELRA", units=astropy.units.h), self.popAngle(md, "TELDEC"), ) argDict["boresightAirmass"] = self.popFloat(md, "AIRMASS") argDict["observatory"] = Observatory( self.popAngle(md, "OBS-LONG"), self.popAngle(md, "OBS-LAT"), self.popFloat(md, "OBS-ELEV"), ) # Default weather is based on typical conditions at an altitude of 2215 meters. temperature = self.defaultMetadata(self.popFloat(md, "OUTTEMP"), 10., minimum=-10., maximum=40.) pressure = self.defaultMetadata(self.pascalFromMmHg( self.popFloat(md, "PRESSURE")), 77161.1, minimum=70000., maximum=85000.) humidity = self.defaultMetadata(self.popFloat(md, "HUMIDITY"), 40., minimum=0., maximum=100.) argDict["weather"] = Weather(temperature, pressure, humidity) longitude = argDict["observatory"].getLongitude() argDict['era'] = self.decamGetEra(md, argDict["boresightRaDec"][0], longitude)
def setArgDict(self, md, argDict): """Set an argument dict for VisitInfo and pop associated metadata @param[in,out] md metadata, as an lsst.daf.base.PropertyList or PropertySet @param[in,out] argdict a dict of arguments """ MakeRawVisitInfo.setArgDict(self, md, argDict) argDict["darkTime"] = self.popFloat(md, "DARKTIME") argDict["boresightAzAlt"] = SpherePoint( self.popAngle(md, "AZIMUTH"), self.altitudeFromZenithDistance(self.popAngle(md, "ZENITH")), ) argDict["boresightRaDec"] = SpherePoint( self.popAngle(md, "RA_DEG"), self.popAngle(md, "DEC_DEG"), ) argDict["boresightAirmass"] = self.popFloat(md, "AIRMASS") argDict["boresightRotAngle"] = -self.popAngle(md, "ROTANG") argDict["rotType"] = RotType.SKY argDict["observatory"] = self.observatory weather = defaultWeather(self.observatory.getElevation()) temperature = self.defaultMetadata(self.popFloat(md, "TEMPERA"), weather.getAirTemperature(), minimum=-10, maximum=40.) pressure = self.defaultMetadata(self.pascalFromMmHg(self.popFloat(md, "PRESS")), weather.getAirPressure(), minimum=50000., maximum=90000.) humidity = 40. # Not currently supplied by phosim, so set to a typical value. argDict["weather"] = Weather(temperature, pressure, humidity) longitude = argDict["observatory"].getLongitude() RA = argDict["boresightRaDec"][0] # phosim doesn't supply LST, HA, or UT1, and the alt/az/ra/dec/time can be inconsistent. # We will leave ERA as NaN until a better answer is available. try: # Other simulation tools don't have the same problem, and need hour angle if it is available. HA = self.popAngle(md, "HA", units=astropy.units.h) argDict['era'] = HA + RA - longitude except Exception: self.log.warn("Hour angle missing from metadata, will be NAN") return VisitInfo(**argDict)
def setArgDict(self, md, argDict): """Set an argument dict for VisitInfo and pop associated metadata. Parameters ---------- md : `lsst.daf.base.PropertySet` Image metadata. argDict : `dict` A dict of arguments for the `lsst.afw.image.VisitInfo` constructor. Updated by this call. Returns ------- visitInfo : `lsst.afw.image.VisitInfo` Visit information. """ MakeRawVisitInfo.setArgDict(self, md, argDict) argDict["darkTime"] = self.popFloat(md, "DARKTIME") argDict["boresightAzAlt"] = SpherePoint( self.popAngle(md, "AZIMUTH"), self.altitudeFromZenithDistance(self.popAngle(md, "ZENITH")), ) argDict["boresightRaDec"] = SpherePoint( self.popAngle(md, "RA_DEG"), self.popAngle(md, "DEC_DEG"), ) argDict["boresightAirmass"] = self.popFloat(md, "AIRMASS") argDict["boresightRotAngle"] = -self.popAngle(md, "ROTANG") argDict["rotType"] = RotType.SKY argDict["observatory"] = self.observatory argDict["weather"] = Weather( self.popFloat(md, "TEMPERA"), self.pascalFromMmHg(self.popFloat(md, "PRESS")), float("nan"), ) return VisitInfo(**argDict)
def setUp(self): self.butler = dafPersist.Butler(root=os.path.join(os.path.dirname(__file__), "data")) self.exposureTime = 15.0 self.darkTime = 15.0 dateObs = DateTime(49552.28496, DateTime.MJD, DateTime.TAI) self.dateAvg = DateTime(dateObs.nsecs(DateTime.TAI) + int(0.5e9*self.exposureTime), DateTime.TAI) self.boresightRaDec = SpherePoint(359.936019771151, -2.3356222648145, degrees) self.boresightAzAlt = SpherePoint(127.158246182602, 90 - 40.6736117075876, degrees) self.boresightAirmass = 1.31849492005496 self.boresightRotAngle = -3.43228*degrees self.rotType = RotType.SKY self.obs_longitude = -70.749417*degrees self.obs_latitude = -30.244633*degrees self.obs_elevation = 2663.0 self.weath_airTemperature = 5.0 self.weath_airPressure = MakeRawVisitInfo.pascalFromMmHg(520.0) self.weath_humidity = 40.
era = HA + boresightRaDec[0] - 70.81489000000001 * degrees visit229388_info = { "dateAvg": DateTime("2013-09-01T06:05:10.753848", DateTime.TAI), "exposureTime": 200.0, "darkTime": 201.15662, "era": era, "boresightRaDec": boresightRaDec, "boresightAzAlt": Coord(61.24 * degrees, (90 - 50.46) * degrees), "boresightAirmass": 1.57, "boresightRotAngle": float("nan") * degrees, "rotType": RotType.UNKNOWN, "obs_longitude": 70.81489000000001 * degrees, "obs_latitude": -30.16606 * degrees, "obs_elevation": 2215.0, "weath_airTemperature": 11.9, "weath_airPressure": MakeRawVisitInfo.pascalFromMmHg(779.0), "weath_humidity": 23.0 } class GetRawTestCase(lsst.utils.tests.TestCase): """Testing butler raw image retrieval""" def setUp(self): try: datadir = getPackageDir("testdata_decam") except pexExcept.NotFoundError: message = "testdata_decam not setup. Skipping." warnings.warn(message) raise unittest.SkipTest(message) self.repoPath = os.path.join(datadir, "rawData")