Skip to content

Commit

Permalink
forcedPhotCoadd: add command-line PSF cache configuration
Browse files Browse the repository at this point in the history
The size of the PSF cache can have a significant effect upon the runtime
for complicated PSF models. For coadds, CoaddPsf can be complicated.
  • Loading branch information
PaulPrice committed Mar 22, 2018
1 parent b9e430a commit 1918140
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
9 changes: 9 additions & 0 deletions python/lsst/meas/base/forcedPhotCoadd.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ def validate(self):
## @}


class ForcedPhotCoaddRunner(lsst.pipe.base.ButlerInitializedTaskRunner):
"""Get the psfCache setting into ForcedPhotCoaddTask"""
@staticmethod
def getTargetList(parsedCmd, **kwargs):
return lsst.pipe.base.ButlerInitializedTaskRunner.getTargetList(parsedCmd,
psfCache=parsedCmd.psfCache)


class ForcedPhotCoaddTask(ForcedPhotImageTask):
"""!
A command-line driver for performing forced measurement on coadd images
Expand Down Expand Up @@ -169,4 +177,5 @@ def _makeArgumentParser(cls):
parser = lsst.pipe.base.ArgumentParser(name=cls._DefaultName)
parser.add_id_argument("--id", "deepCoadd_forced_src", help="data ID, with raw CCD keys + tract",
ContainerClass=lsst.coadd.utils.CoaddDataIdContainer)
parser.add_argument("--psfCache", type=int, default=100000, help="Size of CoaddPsf cache")
return parser
6 changes: 5 additions & 1 deletion python/lsst/meas/base/forcedPhotImage.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def __init__(self, butler=None, refSchema=None, **kwds):
self.makeSubtask("applyApCorr", schema=self.measurement.schema)
self.makeSubtask('catalogCalculation', schema=self.measurement.schema)

def run(self, dataRef):
def run(self, dataRef, psfCache=None):
"""!Measure a single exposure using forced detection for a reference catalog.
@param[in] dataRef An lsst.daf.persistence.ButlerDataRef. It is passed to the
Expand All @@ -135,9 +135,13 @@ def run(self, dataRef):
passed to the writeOutputs() method (implemented by derived classes)
which writes the outputs. See derived class documentation for which
datasets and data ID keys are used.
@param[in] psfCache Size of PSF cache, or None. The size of the PSF cache can have
a significant effect upon the runtime for complicated PSF models.
"""
refWcs = self.references.getWcs(dataRef)
exposure = self.getExposure(dataRef)
if psfCache is not None:
exposure.getPsf().setCacheSize(psfCache)
refCat = self.fetchReferences(dataRef, exposure)
measCat = self.measurement.generateMeasCat(exposure, refCat, refWcs,
idFactory=self.makeIdFactory(dataRef))
Expand Down

0 comments on commit 1918140

Please sign in to comment.