From abf9156faf8f793ed107dcbbc6311f52e0dc0a51 Mon Sep 17 00:00:00 2001 From: Trys McCann Date: Thu, 29 Jun 2023 15:28:38 -0400 Subject: [PATCH] Remove already-deprecated fake-source insertion interfaces --- ...t.pipe.tasks.fakes.BaseFakeSourcesTask.rst | 26 ------ python/lsst/pipe/tasks/calibrate.py | 15 ---- python/lsst/pipe/tasks/fakes.py | 80 ------------------- python/lsst/pipe/tasks/multiBand.py | 10 --- 4 files changed, 131 deletions(-) delete mode 100644 doc/lsst.pipe.tasks/tasks/lsst.pipe.tasks.fakes.BaseFakeSourcesTask.rst delete mode 100644 python/lsst/pipe/tasks/fakes.py diff --git a/doc/lsst.pipe.tasks/tasks/lsst.pipe.tasks.fakes.BaseFakeSourcesTask.rst b/doc/lsst.pipe.tasks/tasks/lsst.pipe.tasks.fakes.BaseFakeSourcesTask.rst deleted file mode 100644 index 41c0f0915..000000000 --- a/doc/lsst.pipe.tasks/tasks/lsst.pipe.tasks.fakes.BaseFakeSourcesTask.rst +++ /dev/null @@ -1,26 +0,0 @@ -.. lsst-task-topic:: lsst.pipe.tasks.fakes.BaseFakeSourcesTask - -################### -BaseFakeSourcesTask -################### - -.. _lsst.pipe.tasks.fakes.BaseFakeSourcesTask-api: - -Python API summary -================== - -.. lsst-task-api-summary:: lsst.pipe.tasks.fakes.BaseFakeSourcesTask - -.. _lsst.pipe.tasks.fakes.BaseFakeSourcesTask-subtasks: - -Retargetable subtasks -===================== - -.. lsst-task-config-subtasks:: lsst.pipe.tasks.fakes.BaseFakeSourcesTask - -.. _lsst.pipe.tasks.fakes.BaseFakeSourcesTask-configs: - -Configuration fields -==================== - -.. lsst-task-config-fields:: lsst.pipe.tasks.fakes.BaseFakeSourcesTask diff --git a/python/lsst/pipe/tasks/calibrate.py b/python/lsst/pipe/tasks/calibrate.py index c05261dbf..b65f841a7 100644 --- a/python/lsst/pipe/tasks/calibrate.py +++ b/python/lsst/pipe/tasks/calibrate.py @@ -44,7 +44,6 @@ from lsst.meas.deblender import SourceDeblendTask from lsst.utils.timer import timeMethod from lsst.pipe.tasks.setPrimaryFlags import SetPrimaryFlagsTask -from .fakes import BaseFakeSourcesTask from .photoCal import PhotoCalTask from .computeExposureSummaryStats import ComputeExposureSummaryStatsTask @@ -286,20 +285,6 @@ class CalibrateConfig(pipeBase.PipelineTaskConfig, pipelineConnections=Calibrate target=CatalogCalculationTask, doc="Subtask to run catalogCalculation plugins on catalog" ) - doInsertFakes = pexConfig.Field( - dtype=bool, - default=False, - doc="Run fake sources injection task", - deprecated=("doInsertFakes is no longer supported. This config will be removed after v24. " - "Please use ProcessCcdWithFakesTask instead.") - ) - insertFakes = pexConfig.ConfigurableField( - target=BaseFakeSourcesTask, - doc="Injection of fake sources for testing purposes (must be " - "retargeted)", - deprecated=("insertFakes is no longer supported. This config will be removed after v24. " - "Please use ProcessCcdWithFakesTask instead.") - ) doComputeSummaryStats = pexConfig.Field( dtype=bool, default=True, diff --git a/python/lsst/pipe/tasks/fakes.py b/python/lsst/pipe/tasks/fakes.py deleted file mode 100644 index 46d9a2f84..000000000 --- a/python/lsst/pipe/tasks/fakes.py +++ /dev/null @@ -1,80 +0,0 @@ -# This file is part of pipe_tasks. -# -# Developed for the LSST Data Management System. -# This product includes software developed by the LSST Project -# (https://www.lsst.org). -# See the COPYRIGHT file at the top-level directory of this distribution -# for details of code ownership. -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -__all__ = ["BaseFakeSourcesConfig", "BaseFakeSourcesTask"] - -import abc - -from deprecated.sphinx import deprecated - -import lsst.pex.config -import lsst.pipe.base -import lsst.afw.image - - -class BaseFakeSourcesConfig(lsst.pex.config.Config): - maskPlaneName = lsst.pex.config.Field( - dtype=str, default="FAKE", - doc="Mask plane to set on pixels affected by fakes. Will be added if not already present." - ) - - -@deprecated(reason=("The fakes code has been deprecated in favor of ProcessCcdWithFakes. " - "This will be removed after v24."), - category=FutureWarning, - version="24.0") -class BaseFakeSourcesTask(lsst.pipe.base.Task, metaclass=abc.ABCMeta): - """An abstract base class for subtasks that inject fake sources into images to test completeness and - other aspects of the processing. - - This class simply adds a mask plane that subclasses should use to mark pixels that have been touched. - - This is an abstract base class (abc) and is not intended to be directly used. To create a fake sources - injector, create a child class and re-implement the required methods. - """ - - ConfigClass = BaseFakeSourcesConfig - _DefaultName = "baseFakeSources" - - def __init__(self, **kwargs): - """Initialize the Task. - - Subclasses that define their own __init__ should simply forward all arguments to the base - class constructor. They can then assume self.config is an instance of their ConfigClass. - - If an external catalog is used to add sources consistently to multiple overlapping images, - that catalog should generally be loaded and attached to self here, so it can be used - multiple times by the run() method. - """ - lsst.pipe.base.Task.__init__(self, **kwargs) - lsst.afw.image.Mask[lsst.afw.image.MaskPixel].addMaskPlane(self.config.maskPlaneName) - self.bitmask = lsst.afw.image.Mask[lsst.afw.image.MaskPixel]\ - .getPlaneBitMask(self.config.maskPlaneName) - - @abc.abstractmethod - def run(self, exposure, background): - """Add fake sources to the given Exposure, making use of the given BackgroundList if desired. - - If pixels in the Exposure are replaced, not added to, extra care should be taken with the background, - mask, and variance planes. The Exposure as given is background-subtracted (using the supplied - background model) and should be returned in the same state. - """ - raise NotImplementedError("FakeSourcesTask is abstract, create a child class to use this method") diff --git a/python/lsst/pipe/tasks/multiBand.py b/python/lsst/pipe/tasks/multiBand.py index 6b8ed0c71..02348c15f 100644 --- a/python/lsst/pipe/tasks/multiBand.py +++ b/python/lsst/pipe/tasks/multiBand.py @@ -34,7 +34,6 @@ SkyMapIdGeneratorConfig, ) from lsst.meas.astrom import DirectMatchTask, denormalizeMatches -from lsst.pipe.tasks.fakes import BaseFakeSourcesTask from lsst.pipe.tasks.setPrimaryFlags import SetPrimaryFlagsTask from lsst.pipe.tasks.propagateSourceFlags import PropagateSourceFlagsTask import lsst.afw.table as afwTable @@ -109,15 +108,6 @@ class DetectCoaddSourcesConfig(PipelineTaskConfig, pipelineConnections=DetectCoa scaleVariance = ConfigurableField(target=ScaleVarianceTask, doc="Variance rescaling") detection = ConfigurableField(target=DynamicDetectionTask, doc="Source detection") coaddName = Field(dtype=str, default="deep", doc="Name of coadd") - doInsertFakes = Field(dtype=bool, default=False, - doc="Run fake sources injection task", - deprecated=("doInsertFakes is no longer supported. This config will be removed " - "after v24.")) - insertFakes = ConfigurableField(target=BaseFakeSourcesTask, - doc="Injection of fake sources for testing " - "purposes (must be retargeted)", - deprecated=("insertFakes is no longer supported. This config will " - "be removed after v24.")) hasFakes = Field( dtype=bool, default=False,