Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-28759: Support driver to write new parquet tables from old src tables #472

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion python/lsst/pipe/tasks/postprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ def runDataRef(self, dataRef):
ccdVisitId = dataRef.get('ccdExposureId')
result = self.run(src, ccdVisitId=ccdVisitId)
dataRef.put(result.table, 'source')
return result

def run(self, catalog, ccdVisitId=None):
"""Convert `src` catalog to parquet
Expand Down Expand Up @@ -266,14 +267,14 @@ def addCalibColumns(self, catalog, dataRef):
newCat: `afwTable.SourceCatalog`
Source Catalog with requested local calib columns
"""
mapper = afwTable.SchemaMapper(catalog.schema)
measureConfig = SingleFrameMeasurementTask.ConfigClass()
measureConfig.doReplaceWithNoise = False

# Just need the WCS or the PhotoCalib attached to an exposue
exposure = dataRef.get('calexp_sub',
bbox=lsst.geom.Box2I(lsst.geom.Point2I(0, 0), lsst.geom.Point2I(0, 0)))

aliasMap = catalog.schema.getAliasMap()
mapper = afwTable.SchemaMapper(catalog.schema)
mapper.addMinimalSchema(catalog.schema, True)
schema = mapper.getOutputSchema()
Expand All @@ -295,6 +296,7 @@ def addCalibColumns(self, catalog, dataRef):
measureConfig.plugins.names.add(plugin)

measurement = SingleFrameMeasurementTask(config=measureConfig, schema=schema)
schema.setAliasMap(aliasMap)
newCat = afwTable.SourceCatalog(schema)
newCat.extend(catalog, mapper=mapper)
measurement.run(measCat=newCat, exposure=exposure, exposureId=exposureIdInfo.expId)
Expand Down