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

Capture algorithm metadata in source catalog #62

Merged
merged 2 commits into from
Jun 20, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions python/lsst/pipe/tasks/multiBand.py
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,8 @@ def run(self, patchRef):
self.log.warn("Patch %s contains %d large footprints that were not deblended" %
(patchRef.dataId, numBig))

table = sources.getTable()
table.setMetadata(self.algMetadata) # Capture algorithm metadata to write out to the source catalog.
# First run plugins with order up to and including APCORR_ORDER to measure all fluxes
# and apply the aperture correction (using the apCorrMap measured in the calibration
# task) to the measured fluxes whose plugins were registered with shouldApCorr=True
Expand Down
18 changes: 18 additions & 0 deletions tests/testCoadds.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import shutil
import os
import sys
import numbers

from lsst.utils import getPackageDir
import lsst.utils.tests
Expand Down Expand Up @@ -372,6 +373,23 @@ def testForcedPhotCcdTask(self):
task = lsst.meas.base.ForcedPhotCcdTask(config=config, butler=self.butler)
self.runTaskOnCcds(task)

def testAlgMetadataOutput(self):
"""Test to see if algMetadata is persisted correctly from MeasureMergedCoaddSourcesTask. This test
fails with a NotFoundError if the algorithm metadata is not persisted"""
patchList = ['0,0', '0,1', '1,0', '1,1']
for patch in patchList:
cat = self.butler.get("deepCoadd_meas", filter = 'r', tract = 0, patch = patch)
meta = cat.getTable().getMetadata()
for circApertureFluxRadius in meta.get('base_CircularApertureFlux_radii'):
self.assertIsInstance(circApertureFluxRadius, numbers.Number)
for nOffset in meta.get('NOISE_OFFSET'):
self.assertIsInstance(nOffset, numbers.Number)
for noiseSrc in meta.get('NOISE_SOURCE'):
self.assertEqual(noiseSrc, 'measure')
for noiseExpID in meta.get('NOISE_EXPOSURE_ID'):
self.assertIsInstance(noiseExpID, numbers.Number)
for noiseSeedMul in meta.get('NOISE_SEED_MULTIPLIER'):
self.assertIsInstance(noiseSeedMul, numbers.Number)

class AssembleCoaddTestCase(lsst.utils.tests.TestCase):
def testSafeClipConfig(self):
Expand Down