Coverage for python/lsst/obs/lsstSim/lsstSimMapper.py : 74%

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, 2009, 2010, 2011, 2012, 2013 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/>. #
# Solely to get boost serialization registrations for Measurement subclasses
for kw in inputPolicy.paramNames(True): if kw == "doFootprints": self.doFootprints = True else: kwargs[kw] = inputPolicy.get(kw)
# The LSST Filters from L. Jones 04/07/10 # official y filter # If/when y3 sim data becomes available, uncomment this and # modify the schema appropriately # afwImageUtils.defineFilter('y3', 1002.44) # candidate y-band
"""Transform an ID dict into standard form for LSST
Standard keys are as follows: - raft: in the form <x>,<y> - sensor: in the form <x>,<y>,<c> where <c> = A or B - channel: in the form <x>,<y> - snap: exposure number
Other supported keys, which are used to set the above, if not already set: - ccd: an alias for sensor (hence NOT the full ccd name) - ccdName or sensorName: full ccd name in the form R:<x>,<y> S:<x>,<y>[,<c>] if found, used to set raft and sensor, if not already set - channelName, ampName: an alternate way to specify channel, in the form: IDxx - amp: an alias for channel - exposure: an alias for snap
@param dataId[in] (dict) Dataset identifier; this must not be modified @return (dict) Transformed dataset identifier @raise RuntimeError if a value is not valid """ ccdName = actualId[ccdAlias].upper() m = self._CcdNameRe.match(ccdName) if m is None: raise RuntimeError("Invalid value for %s: %r" % (ccdAlias, ccdName)) actualId.setdefault("raft", m.group(1)) actualId.setdefault("sensor", m.group(2)) break actualId.setdefault("sensor", actualId["ccd"]) actualId.setdefault("channel", actualId["amp"]) m = re.match(r'ID(\d+)$', actualId[ampName]) channelNumber = int(m.group(1)) channelX = channelNumber % 8 channelY = channelNumber // 8 actualId['channel'] = str(channelX) + "," + str(channelY) break actualId.setdefault("snap", actualId["exposure"])
# why strip out the commas after carefully adding them?
"%s identifier should be type str, not %s: %r" % (component.title(), type(val), val)) else:
"""get dataId dict from visit and ccd identifier
@param visit 32 or 64-bit depending on camera @param ccdId detector name: same as detector.getName() """ dataId = {'visit': int(visit)} m = self._CcdNameRe.match(ccdId) if m is None: raise RuntimeError("Cannot parse ccdId=%r" % (ccdId,)) dataId['raft'] = m.group(0) dataId['sensor'] = m.group(1) return dataId
m = re.match(r'(\d),(\d)', dataId['channel']) # Note that indices are swapped in the camera geometry vs. official # channel specification. return (self._extractDetectorName(dataId), int(m.group(1)), int(m.group(2)))
# visit, snap, raft, sensor, channel): """Compute the 64-bit (long) identifier for an amp exposure.
@param dataId (dict) Data identifier with visit, snap, raft, sensor, channel """
(int(r1) * 5 + int(r2)) * 160 + \ (int(s1) * 3 + int(s2)) * 16 + \ (int(c1) * 8 + int(c2))
"""Compute the 64-bit (long) identifier for a CCD exposure.
@param dataId (dict) Data identifier with visit, raft, sensor """
(int(r1) * 5 + int(r2)) * 10 + \ (int(s1) * 3 + int(s2))
"""Compute the 64-bit (long) identifier for a coadd.
@param dataId (dict) Data identifier with tract and patch. @param singleFilter (bool) True means the desired ID is for a single- filter coadd, in which case dataId must contain filter. """ raise RuntimeError('tract not in range [0,128)') raise RuntimeError('patch component not in range [0, 8192)') return id
"""The number of bits used up for patch ID bits""" return 64 - self._nbit_id
return self._computeCoaddExposureId(dataId, False)
"""The number of bits used up for patch ID bits""" return self.bypass_deepMergedCoaddId_bits(*args, **kwargs)
return self.bypass_deepMergedCoaddId(datasetType, pythonType, location, dataId)
def getShortCcdName(ccdId): """Convert a CCD name to a form useful as a filename
This LSST version converts spaces to underscores and elides colons and commas. """
propertyList.set("Computed_ccdExposureId", self._computeCcdExposureId(dataId)) return propertyList
###############################################################################
# CRVAL is FK5 at date of observation system=dafBase.DateTime.MJD, scale=dafBase.DateTime.TAI) scale=dafBase.DateTime.TAI)
"""Standardize a eimage dataset by converting it to an Exposure instead of an Image"""
###############################################################################
return self.bypass_deepCoaddId(datasetType, pythonType, location, dataId)
return self.bypass_deepCoaddId_bits(datasetType, pythonType, location, dataId)
###############################################################################
ampExposureId = self._computeAmpExposureId(dataId) return {"ampExposureId": ampExposureId, "sdqaRatingScope": "AMP"}
ccdExposureId = self._computeCcdExposureId(dataId) return {"ccdExposureId": ccdExposureId, "sdqaRatingScope": "CCD"}
###############################################################################
lambda self, item, dataId: self._setAmpExposureId(item, dataId)) lambda self, item, dataId: self._setCcdExposureId(item, dataId)) |