diff --git a/python/lsst/ap/association/diaPipe.py b/python/lsst/ap/association/diaPipe.py index 10f29077..3d2ebdff 100644 --- a/python/lsst/ap/association/diaPipe.py +++ b/python/lsst/ap/association/diaPipe.py @@ -244,6 +244,15 @@ class DiaPipelineConfig(pipeBase.PipelineTaskConfig, target=DiaObjectCalculationTask, doc="Task to compute summary statistics for DiaObjects.", ) + doLoadForcedSources = pexConfig.Field( + dtype=bool, + default=True, + deprecated="Added to allow disabling forced sources for performance" + "reasons during the ops rehearsal." + " It is expected to be removed.", + 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 +379,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..8cb0db0d 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,11 @@ 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. + Added to allow disabling forced sources for performance + reasons during the ops rehearsal. Returns ------- @@ -79,6 +84,13 @@ def run(self, exposure, apdb): exposure padded by ``pixelMargin``. DataFrame is indexed by ``diaObjectId``, ``band``, ``diaSourceId`` columns. (`pandas.DataFrame`) + - ``diaForcedSources`` : Complete set of forced photometered fluxes + on the past 12 months of difference images at DiaObject locations. + + Raises + ------ + RuntimeError + Raised if the Database query failed to load DiaObjects. """ region = self._getRegion(exposure) @@ -95,7 +107,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,