Skip to content

Commit ab65031

Browse files
Merge pull request #342 from lsst/tickets/DM-36311
DM-36311: Remove deprecated kernelSize and related fields
2 parents b773a10 + 002aa71 commit ab65031

File tree

3 files changed

+12
-68
lines changed

3 files changed

+12
-68
lines changed

python/lsst/meas/algorithms/pcaPsfDeterminer.py

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
__all__ = ["PcaPsfDeterminerConfig", "PcaPsfDeterminerTask"]
2323

24-
import math
2524
import sys
2625

2726
import numpy
@@ -262,28 +261,11 @@ def determinePsf(self, exposure, psfCandidateList, metadata=None, flagKey=None):
262261
raise RuntimeError("No usable PSF candidates supplied")
263262
nEigenComponents = self.config.nEigenComponents # initial version
264263

265-
# TODO: DM-36311: Keep only the if block below.
266-
if self.config.stampSize:
267-
actualKernelSize = int(self.config.stampSize)
268-
elif self.config.kernelSize >= 15:
269-
self.log.warning("NOT scaling kernelSize by stellar quadrupole moment "
270-
"because config.kernelSize=%s >= 15; "
271-
"using config.kernelSize as the width, instead",
272-
self.config.kernelSize)
273-
actualKernelSize = int(self.config.kernelSize)
274-
else:
275-
self.log.warning("scaling kernelSize by stellar quadrupole moment "
276-
"because config.kernelSize=%s < 15. This behavior is deprecated.",
277-
self.config.kernelSize)
278-
medSize = numpy.median(sizes)
279-
actualKernelSize = 2*int(self.config.kernelSize*math.sqrt(medSize) + 0.5) + 1
280-
if actualKernelSize < self.config.kernelSizeMin:
281-
actualKernelSize = self.config.kernelSizeMin
282-
if actualKernelSize > self.config.kernelSizeMax:
283-
actualKernelSize = self.config.kernelSizeMax
264+
actualKernelSize = int(self.config.stampSize)
265+
266+
if display:
267+
print("Median size=%s" % (numpy.median(sizes),))
284268

285-
if display:
286-
print("Median size=%s" % (medSize,))
287269
self.log.trace("Kernel size=%s", actualKernelSize)
288270

289271
if actualKernelSize > psfCandidateList[0].getWidth():

python/lsst/meas/algorithms/psfDeterminer.py

Lines changed: 8 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
# This file is part of meas_algorithms.
12
#
2-
# LSST Data Management System
3-
#
4-
# Copyright 2008-2017 AURA/LSST.
5-
#
6-
# This product includes software developed by the
7-
# LSST Project (http://www.lsst.org/).
3+
# Developed for the LSST Data Management System.
4+
# This product includes software developed by the LSST Project
5+
# (https://www.lsst.org).
6+
# See the COPYRIGHT file at the top-level directory of this distribution
7+
# for details of code ownership.
88
#
99
# This program is free software: you can redistribute it and/or modify
1010
# it under the terms of the GNU General Public License as published by
@@ -16,10 +16,8 @@
1616
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1717
# GNU General Public License for more details.
1818
#
19-
# You should have received a copy of the LSST License Statement and
20-
# the GNU General Public License along with this program. If not,
21-
# see <https://www.lsstcorp.org/LegalNotices/>.
22-
#
19+
# You should have received a copy of the GNU General Public License
20+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
2321

2422
__all__ = ["BasePsfDeterminerConfig", "BasePsfDeterminerTask", "psfDeterminerRegistry"]
2523

@@ -40,41 +38,6 @@ class BasePsfDeterminerConfig(pexConfig.Config):
4038
optional=True,
4139
check=lambda x: (x > 0) & (x % 2 == 1),
4240
)
43-
kernelSize = pexConfig.Field[int](
44-
doc="Size of the kernel to create. "
45-
"If less than 15, then the median of the square root of the "
46-
"stellar quadrupole moments is multiplied by kernelSize and "
47-
"used as the kernel size.",
48-
default=None,
49-
optional=True,
50-
deprecated="This field is deprecated and will be removed after v25. "
51-
"Use stampSize instead.",
52-
)
53-
kernelSizeMin = pexConfig.Field[int](
54-
doc="Minimum radius of the kernel. Relevant only if kernelSize < 15.",
55-
default=25,
56-
deprecated="This field is deprecated and will be removed after v25.",
57-
)
58-
kernelSizeMax = pexConfig.Field[int](
59-
doc="Maximum radius of the kernel. Relevant only if kernelSize < 15.",
60-
default=45,
61-
deprecated="This field is deprecated and will be removed after v25.",
62-
)
63-
64-
def validate(self):
65-
# TODO: DM-36311: Lines involving kernelSize* (or the entire method)
66-
# may be removed after v25.
67-
super().validate()
68-
# Ensure that stampSize and kernelSize are not contradictory.
69-
if self.stampSize is not None and self.kernelSize is not None:
70-
raise pexConfig.FieldValidationError(self.__class__.kernelSize, self,
71-
"Only one of stampSize (preferable) and kernelSize "
72-
"(deprecated) must be set."
73-
)
74-
if self.kernelSizeMin > self.kernelSizeMax:
75-
raise pexConfig.FieldValidationError(self.__class__.kernelSizeMax, self,
76-
"kernelSizeMin must be <= kernelSizeMax"
77-
)
7841

7942

8043
class BasePsfDeterminerTask(pipeBase.Task, metaclass=abc.ABCMeta):

tests/test_psfSelectTest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@ def setUp(self):
245245
psfDeterminerConfig.sizeCellY = height//3
246246
psfDeterminerConfig.nEigenComponents = nEigenComponents
247247
psfDeterminerConfig.spatialOrder = 1
248-
psfDeterminerConfig.kernelSizeMin = 31
249248
psfDeterminerConfig.nStarPerCell = 0
250249
psfDeterminerConfig.nStarPerCellSpatialFit = 0 # unlimited
251250
self.psfDeterminer = psfDeterminerFactory(psfDeterminerConfig)

0 commit comments

Comments
 (0)