diff --git a/python/lsst/ap/association/diaPipe.py b/python/lsst/ap/association/diaPipe.py index 10f29077..5df40fc1 100644 --- a/python/lsst/ap/association/diaPipe.py +++ b/python/lsst/ap/association/diaPipe.py @@ -244,6 +244,12 @@ class DiaPipelineConfig(pipeBase.PipelineTaskConfig, target=DiaObjectCalculationTask, doc="Task to compute summary statistics for DiaObjects.", ) + doLoadForcedSources = pexConfig.Field( + dtype=bool, + default=True, + doc="Load forced DiaSource history from the APDB?" + "This should only be turned off for debugging purposes.", + ) diaForcedSource = pexConfig.ConfigurableField( target=DiaForcedSourceTask, doc="Task used for force photometer DiaObject locations in direct and " @@ -370,7 +376,8 @@ def run(self, DiaSources. (`pandas.DataFrame`) """ # Load the DiaObjects and DiaSource history. - loaderResult = self.diaCatalogLoader.run(diffIm, self.apdb) + loaderResult = self.diaCatalogLoader.run(diffIm, self.apdb, + doLoadForcedSources=self.config.doLoadForcedSources) if len(loaderResult.diaObjects) > 0: diaObjects = self.purgeDiaObjects(diffIm.getBBox(), diffIm.getWcs(), loaderResult.diaObjects, buffer=self.config.imagePixelMargin) diff --git a/python/lsst/ap/association/loadDiaCatalogs.py b/python/lsst/ap/association/loadDiaCatalogs.py index 60dbb32a..a2a032b7 100644 --- a/python/lsst/ap/association/loadDiaCatalogs.py +++ b/python/lsst/ap/association/loadDiaCatalogs.py @@ -56,7 +56,7 @@ def __init__(self, **kwargs): pipeBase.Task.__init__(self, **kwargs) @timeMethod - def run(self, exposure, apdb): + def run(self, exposure, apdb, doLoadForcedSources=True): """Preload all DiaObjects and DiaSources from the Apdb given the current exposure. @@ -66,6 +66,9 @@ def run(self, exposure, apdb): An exposure with a bounding box. apdb : `lsst.dax.apdb.Apdb` AP database connection object. + doLoadForcedSources : `bool`, optional + Load forced DiaSource history from the APDB? + This should only be turned off for debugging purposes. Returns ------- @@ -79,6 +82,11 @@ def run(self, exposure, apdb): exposure padded by ``pixelMargin``. DataFrame is indexed by ``diaObjectId``, ``band``, ``diaSourceId`` columns. (`pandas.DataFrame`) + + Raises + ------ + RuntimeError + If the Database query failed to load DiaObjects """ region = self._getRegion(exposure) @@ -95,7 +103,10 @@ def run(self, exposure, apdb): diaSources = self.loadDiaSources(diaObjects, region, dateTime, apdb) - diaForcedSources = self.loadDiaForcedSources(diaObjects, region, dateTime, apdb) + if doLoadForcedSources: + diaForcedSources = self.loadDiaForcedSources(diaObjects, region, dateTime, apdb) + else: + diaForcedSources = pd.DataFrame(columns=["diaObjectId", "diaForcedSourceId"]) return pipeBase.Struct( diaObjects=diaObjects,