Skip to content

Commit

Permalink
DecamMapper: Add datasets for coadd processing
Browse files Browse the repository at this point in the history
for makeCoaddTempExp, assembleCoadd, processCoadd,
detectCoaddSources, mergeCoaddDetections,
measureCoaddSources, and mergeCoaddMeasurements
  • Loading branch information
Hsin-Fang Chiang committed Dec 21, 2015
1 parent 025baca commit 1c4f85d
Show file tree
Hide file tree
Showing 2 changed files with 260 additions and 0 deletions.
219 changes: 219 additions & 0 deletions policy/DecamMapper.paf
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,15 @@ exposures: {
tables: raw
tables: raw_skyTile
}
deepCoadd_calexp_det: {
template: "deepCoadd-results/%(filter)s/%(tract)d/%(patch)s/calexp_det-%(filter)s-%(tract)d-%(patch)s.fits"
python: "lsst.afw.image.ExposureF"
persistable: "ExposureF"
storage: "FitsStorage"
level: "None"
tables: raw
tables: raw_skyTile
}
goodSeeingCoadd_tempExp: {
template: "goodSeeingCoadd/%(filter)s/%(tract)d/%(patch)stempExp/v%(visit)d-f%(filter)s.fits"
python: "lsst.afw.image.ExposureF"
Expand Down Expand Up @@ -203,6 +212,34 @@ datasets: {
storage: "ignored"
tables: "raw"
}
deepCoaddId: {
template: "ignored"
python: "lsst.daf.base.PropertySet"
persistable: "ignored"
storage: "ignored"
tables: "raw"
}
deepCoaddId_bits: {
template: "ignored"
python: "lsst.daf.base.PropertySet"
persistable: "ignored"
storage: "ignored"
tables: "raw"
}
deepMergedCoaddId: {
template: "ignored"
python: "lsst.daf.base.PropertySet"
persistable: "ignored"
storage: "ignored"
tables: "raw"
}
deepMergedCoaddId_bits: {
template: "ignored"
python: "lsst.daf.base.PropertySet"
persistable: "ignored"
storage: "ignored"
tables: "raw"
}
psf: {
template: "%(visit)07d/psf/psf-%(visit)07d_%(ccdnum)02d.boost"
python: "lsst.afw.detection.Psf"
Expand Down Expand Up @@ -312,6 +349,188 @@ datasets: {
storage: "BoostStorage"
tables: raw
}
deep_makeCoaddTempExp_config: {
template: "config/deep_makeCoaddTempExp.py"
python: "lsst.pipe.tasks.makeCoaddTempExp.MakeCoaddTempExpConfig"
persistable: "Config"
storage: "ConfigStorage"
tables: raw
tables: raw_skyTile
}
deep_makeCoaddTempExp_metadata: {
template: "deepCoadd/%(filter)s/%(tract)d/%(patch)s/makeCoaddTempExpMD.boost"
python: "lsst.daf.base.PropertySet"
persistable: "PropertySet"
storage: "BoostStorage"
tables: raw
tables: raw_skyTile
}
deep_safeClipAssembleCoadd_config: {
template: "config/deep_assembleCoadd.py"
python: "lsst.pipe.tasks.assembleCoadd.SafeClipAssembleCoaddConfig"
persistable: "Config"
storage: "ConfigStorage"
tables: raw
tables: raw_skyTile
}
deep_safeClipAssembleCoadd_metadata: {
template: "deepCoadd/%(filter)s/%(tract)d/%(patch)s/assembleCoaddMD.boost"
python: "lsst.daf.base.PropertySet"
persistable: "PropertySet"
storage: "BoostStorage"
tables: raw
tables: raw_skyTile
}
deep_processCoadd_config: {
template: "config/deep_processCoadd.py"
python: "lsst.pipe.tasks.processCoadd.ProcessCoaddConfig"
persistable: "Config"
storage: "ConfigStorage"
tables: raw
tables: raw_skyTile
}
deep_processCoadd_metadata: {
template: "deepCoadd-results/%(filter)s/%(tract)d/%(patch)s/processCoaddMD.boost"
python: "lsst.daf.base.PropertySet"
persistable: "PropertySet"
storage: "BoostStorage"
tables: raw
tables: raw_skyTile
}
deepCoadd_calexp_detBackground: {
template: "deepCoadd-results/%(filter)s/%(tract)d/%(patch)s/detBkgd-%(filter)s-%(tract)d-%(patch)s.fits"
python: "lsst.afw.math.BackgroundList"
persistable: "PurePythonClass"
storage: "FitsCatalogStorage"
tables: raw
tables: raw_skyTile
}
deepCoadd_det: {
template: "deepCoadd-results/%(filter)s/%(tract)d/%(patch)s/det-%(filter)s-%(tract)d-%(patch)s.fits"
python: "lsst.afw.table.SourceCatalog"
persistable: "ignored"
storage: "FitsCatalogStorage"
tables: raw
tables: raw_skyTile
}
deepCoadd_det_schema: {
template: "schema/deepCoadd_det.fits"
python: "lsst.afw.table.SourceCatalog"
persistable: "SourceCatalog"
storage: "FitsCatalogStorage"
}
deepCoadd_src: {
template: "deepCoadd-results/%(filter)s/%(tract)d/%(patch)s/src-%(filter)s-%(tract)d-%(patch)s.fits"
python: "lsst.afw.table.SourceCatalog"
persistable: "ignored"
storage: "FitsCatalogStorage"
tables: raw
tables: raw_skyTile
}
deepCoadd_src_schema: {
template: "schema/deepCoadd_src.fits"
python: "lsst.afw.table.SourceCatalog"
persistable: "ignored"
storage: "FitsCatalogStorage"
tables: raw
tables: raw_skyTile
}
deepCoadd_srcMatch: {
template: "deepCoadd-results/%(filter)s/%(tract)d/%(patch)s/srcMatch-%(filter)s-%(tract)d-%(patch)s.fits"
python: "lsst.afw.table.BaseCatalog"
persistable: "BaseCatalog"
storage: "FitsCatalogStorage"
tables: raw
tables: raw_visit
}
detectCoaddSources_config: {
template: "config/detectCoadd.py"
python: "lsst.pipe.tasks.multiBand.DetectCoaddSourcesConfig"
persistable: "Config"
storage: "ConfigStorage"
}
detectCoaddSources_metadata: {
template: "deepCoadd-results/%(filter)s/%(tract)d/%(patch)s/detectCoaddMD.boost"
python: "lsst.daf.base.PropertySet"
persistable: "PropertySet"
storage: "BoostStorage"
tables: raw
tables: raw_skyTile
}
mergeCoaddDetections_config: {
template: "config/mergeDetect.py"
python: "lsst.pipe.tasks.multiBand.MergeDetectionsConfig"
persistable: "Config"
storage: "ConfigStorage"
}
deepCoadd_mergeDet: {
template: "deepCoadd-results/merged/%(tract)d/%(patch)s/mergeDet-%(tract)d-%(patch)s.fits"
python: "lsst.afw.table.SourceCatalog"
persistable: "ignored"
storage: "FitsCatalogStorage"
tables: raw
tables: raw_skyTile
}
deepCoadd_mergeDet_schema: {
template: "schema/deepCoadd_mergeDet.fits"
python: "lsst.afw.table.SourceCatalog"
persistable: "SourceCatalog"
storage: "FitsCatalogStorage"
}
deepCoadd_peak_schema: {
template: "schema/deepCoadd_peak.fits"
python: "lsst.afw.detection.PeakCatalog"
persistable: "PeakCatalog"
storage: "FitsCatalogStorage"
}
measureCoaddSources_config: {
template: "config/measureMergedCoadd.py"
python: "lsst.pipe.tasks.multiBand.MeasureMergedCoaddSourcesConfig"
persistable: "Config"
storage: "ConfigStorage"
}
measureCoaddSources_metadata: {
template: "deepCoadd-results/%(filter)s/%(tract)d/%(patch)s/measMD.boost"
python: "lsst.daf.base.PropertySet"
persistable: "PropertySet"
storage: "BoostStorage"
tables: raw
tables: raw_skyTile
}
deepCoadd_meas: {
template: "deepCoadd-results/%(filter)s/%(tract)d/%(patch)s/meas-%(filter)s-%(tract)d-%(patch)s.fits"
python: "lsst.afw.table.SourceCatalog"
persistable: "ignored"
storage: "FitsCatalogStorage"
tables: raw
tables: raw_skyTile
}
deepCoadd_meas_schema: {
template: "schema/deepCoadd_meas.fits"
python: "lsst.afw.table.SourceCatalog"
persistable: "SourceCatalog"
storage: "FitsCatalogStorage"
}
mergeCoaddMeasurements_config: {
template: "config/mergeMeasure.py"
python: "lsst.pipe.tasks.multiBand.MergeSourcesConfig"
persistable: "Config"
storage: "ConfigStorage"
}
mergeCoaddMeasurements_metadata: {
template: "deepCoadd-results/merged/%(tract)d/%(patch)s/mergeMeasMD.boost"
python: "lsst.daf.base.PropertySet"
persistable: "PropertySet"
storage: "BoostStorage"
tables: raw
tables: raw_skyTile
}
deepCoadd_ref_schema: {
template: "schema/deepCoadd_ref.fits"
python: "lsst.afw.table.SourceCatalog"
persistable: "SourceCatalog"
storage: "FitsCatalogStorage"
}
deepDiff_config: {
template: "config/deepDiff.py"
python: "lsst.pipe.tasks.imageDifference.ImageDifferenceConfig"
Expand Down
41 changes: 41 additions & 0 deletions python/lsst/obs/decam/decamMapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ def __init__(self, inputPolicy=None, **kwargs):
# Add it so raw dataset know about the data ID key ccdnum.
self.mappings["raw"].keyDict.update({'ccdnum': int})

# The number of bits allocated for fields in object IDs
# TODO: This needs to be updated; also see Trac #2797
DecamMapper._nbit_tract = 10
DecamMapper._nbit_patch = 10
DecamMapper._nbit_filter = 4
DecamMapper._nbit_id = 64 - (DecamMapper._nbit_tract +
2*DecamMapper._nbit_patch +
DecamMapper._nbit_filter)

def _extractDetectorName(self, dataId):
nameTuple = self.registry.executeQuery(['side','ccd'], ['raw',], [('ccdnum','?'), ('visit','?')],
None, (dataId['ccdnum'], dataId['visit']))
Expand All @@ -73,6 +82,38 @@ def _computeCcdExposureId(self, dataId):
ccdnum = dataId['ccdnum']
return int("%07d%02d" % (visit, ccdnum))

def _computeCoaddExposureId(self, dataId, singleFilter):
"""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.
"""
tract = long(dataId['tract'])
if tract < 0 or tract >= 2**DecamMapper._nbit_tract:
raise RuntimeError('tract not in range [0,%d)' % (2**DecamMapper._nbit_tract))
patchX, patchY = map(int, dataId['patch'].split(','))
for p in (patchX, patchY):
if p < 0 or p >= 2**DecamMapper._nbit_patch:
raise RuntimeError('patch component not in range [0, %d)' % 2**DecamMapper._nbit_patch)
oid = (((tract << DecamMapper._nbit_patch) + patchX) << DecamMapper._nbit_patch) + patchY
if singleFilter:
return (oid << DecamMapper._nbit_filter) + afwImage.Filter(dataId['filter']).getId()
return oid

def bypass_deepCoaddId(self, datasetType, pythonType, location, dataId):
return self._computeCoaddExposureId(dataId, True)

def bypass_deepCoaddId_bits(self, *args, **kwargs):
return 64 - DecamMapper._nbit_id

def bypass_deepMergedCoaddId(self, datasetType, pythonType, location, dataId):
return self._computeCoaddExposureId(dataId, False)

def bypass_deepMergedCoaddId_bits(self, *args, **kwargs):
return 64 - DecamMapper._nbit_id

def translate_dqmask(self, dqmask):
# TODO: make a class member variable that knows the mappings
# below instead of hard-coding them
Expand Down

0 comments on commit 1c4f85d

Please sign in to comment.