Skip to content

Commit

Permalink
Merge pull request #477 from lsst/tickets/DM-29017
Browse files Browse the repository at this point in the history
DM-29017: Update visitSummary catalogs to use detector id as index.
  • Loading branch information
erykoff committed Mar 3, 2021
2 parents f0327e3 + 990e6e5 commit 7832a3a
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions python/lsst/pipe/tasks/postprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import lsst.geom
import lsst.pex.config as pexConfig
import lsst.pipe.base as pipeBase
import lsst.daf.base as dafBase
from lsst.pipe.base import connectionTypes
import lsst.afw.table as afwTable
from lsst.meas.base import SingleFrameMeasurementTask
Expand Down Expand Up @@ -889,7 +890,9 @@ class ConsolidateVisitSummaryConnections(pipeBase.PipelineTaskConnections,
multiple=True,
)
visitSummary = connectionTypes.Output(
doc="Consolidated visit-level exposure metadata",
doc=("Per-visit consolidated exposure metadata. These catalogs use "
"detector id for the id and are sorted for fast lookups of a "
"detector."),
name="visitSummary",
storageClass="ExposureCatalog",
dimensions=("instrument", "visit"),
Expand Down Expand Up @@ -984,7 +987,6 @@ def _combineExposureMetadata(self, visit, dataRefs, isGen3=True):
"""
schema = afwTable.ExposureTable.makeMinimalSchema()
schema.addField('visit', type='I', doc='Visit number')
schema.addField('detector_id', type='I', doc='Detector number')
schema.addField('physical_filter', type='String', size=32, doc='Physical filter')
schema.addField('band', type='String', size=32, doc='Name of band')
schema.addField('psfSigma', type='F',
Expand Down Expand Up @@ -1041,7 +1043,7 @@ def _combineExposureMetadata(self, visit, dataRefs, isGen3=True):

rec['physical_filter'] = filterLabel.physicalLabel if filterLabel.hasPhysicalLabel() else ""
rec['band'] = filterLabel.bandLabel if filterLabel.hasBandLabel() else ""
rec['detector_id'] = detector.getId()
rec.setId(detector.getId())
shape = psf.computeShape(bbox.getCenter())
rec['psfSigma'] = shape.getDeterminantRadius()
rec['psfIxx'] = shape.getIxx()
Expand All @@ -1058,6 +1060,13 @@ def _combineExposureMetadata(self, visit, dataRefs, isGen3=True):
rec['raCorners'][:] = [sph.getRa().asDegrees() for sph in sph_pts]
rec['decCorners'][:] = [sph.getDec().asDegrees() for sph in sph_pts]

metadata = dafBase.PropertyList()
metadata.add("COMMENT", "Catalog id is detector id, sorted.")
# We are looping over existing datarefs, so the following is true
metadata.add("COMMENT", "Only detectors with data have entries.")
cat.setMetadata(metadata)

cat.sort()
return cat


Expand Down

0 comments on commit 7832a3a

Please sign in to comment.