Skip to content

Commit

Permalink
Deprecate NaiveDipoleCentroid and NaiveDipoleFlux
Browse files Browse the repository at this point in the history
  • Loading branch information
parejkoj committed Apr 25, 2024
1 parent 2e278b8 commit e94c68f
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 deletions.
8 changes: 6 additions & 2 deletions include/lsst/ip/diffim/DipoleAlgorithms.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@ inline DipoleFluxAlgorithm::DipoleFluxAlgorithm(
class that knows how to calculate centroids as a simple unweighted first
* moment of the 3x3 region around the peaks
*/
class NaiveDipoleFlux : public DipoleFluxAlgorithm {
class [[deprecated(
"This algorithm is deprecated and will be removed after v28.")]]
NaiveDipoleFlux : public DipoleFluxAlgorithm {
public:

typedef DipoleFluxControl Control;
Expand Down Expand Up @@ -240,7 +242,9 @@ class NaiveDipoleFlux : public DipoleFluxAlgorithm {
/**
* @brief Intermediate base class for algorithms that compute a centroid.
*/
class NaiveDipoleCentroid : public DipoleCentroidAlgorithm {
class [[deprecated(
"This algorithm is deprecated and will be removed after v28.")]]
NaiveDipoleCentroid : public DipoleCentroidAlgorithm {
public:

NaiveDipoleCentroid(Control const & ctrl, std::string const & name, afw::table::Schema & schema);
Expand Down
6 changes: 4 additions & 2 deletions python/lsst/ip/diffim/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@
# automatically register ip_diffim Algorithms;
# CENTROID_ORDER=0.0, FLUX_ORDER==2.0
from lsst.meas.base import wrapSimpleAlgorithm
wrapSimpleAlgorithm(NaiveDipoleCentroid, Control=DipoleCentroidControl, executionOrder=0.0)
wrapSimpleAlgorithm(NaiveDipoleFlux, Control=DipoleFluxControl, executionOrder=2.0)
wrapSimpleAlgorithm(NaiveDipoleCentroid, Control=DipoleCentroidControl, executionOrder=0.0,
deprecated="Plugin 'NaiveDipoleCentroid' is deprecated and will be removed after v28.0")
wrapSimpleAlgorithm(NaiveDipoleFlux, Control=DipoleFluxControl, executionOrder=2.0,
deprecated="Plugin 'NaiveDipoleFlux' is deprecated and will be removed after v28.0")
wrapSimpleAlgorithm(PsfDipoleFlux, Control=PsfDipoleFluxControl, executionOrder=2.0)

8 changes: 8 additions & 0 deletions python/lsst/ip/diffim/dipoleAlgorithms.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ void declareDipoleFluxAlgorithm(lsst::cpputils::python::WrapperCollection &wrapp
});
}

// Hide deprecation warnings when building pybind11.
// Remove these pragmas on DM-44030
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated"
void declareNaiveDipoleFlux(lsst::cpputils::python::WrapperCollection &wrappers) {
using PyNaiveDipoleFlux = py::class_<NaiveDipoleFlux, std::shared_ptr<NaiveDipoleFlux>, DipoleFluxAlgorithm>;

Expand Down Expand Up @@ -158,6 +162,10 @@ void wrapDipoleAlgorithms(lsst::cpputils::python::WrapperCollection &wrappers) {
declarePsfDipoleFlux(wrappers);
}

// Stop hiding deprecation warnings when building pybind11.
// Remove these pragmas on DM-44030
#pragma GCC diagnostic pop

} // diffim
} // ip
} // lsst
4 changes: 1 addition & 3 deletions python/lsst/ip/diffim/dipoleMeasurement.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ def setDefaults(self):
"base_PixelFlags",
"base_SkyCoord",
"base_PsfFlux",
"ip_diffim_NaiveDipoleCentroid",
"ip_diffim_NaiveDipoleFlux",
"ip_diffim_PsfDipoleFlux",
"ip_diffim_ClassificationDipole",
]
Expand All @@ -116,7 +114,7 @@ def setDefaults(self):
self.slots.modelFlux = None
self.slots.gaussianFlux = None
self.slots.shape = None
self.slots.centroid = "ip_diffim_NaiveDipoleCentroid"
self.slots.centroid = "ip_diffim_PsfDipoleFlux"
self.doReplaceWithNoise = False


Expand Down
2 changes: 2 additions & 0 deletions tests/test_dipole.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ def setUp(self):
self.w, self.h = 100, 100 # size of image
self.xc, self.yc = 50, 50 # location of center of dipole

# Remove this test on DM-44030
def testNaiveDipoleCentroid(self):
control = ipDiffim.DipoleCentroidControl()
psf, psfSum, exposure, s = createDipole(self.w, self.h, self.xc, self.yc)
Expand All @@ -147,6 +148,7 @@ def testNaiveDipoleCentroid(self):
except Exception:
self.fail()

# Remove this test on DM-44030
def testNaiveDipoleFluxControl(self):
psf, psfSum, exposure, s = createDipole(self.w, self.h, self.xc, self.yc)
control = ipDiffim.DipoleFluxControl()
Expand Down

0 comments on commit e94c68f

Please sign in to comment.