Skip to content

Commit

Permalink
Enable CutOutDonutsScienceSensorTask to operate for a pair with same-…
Browse files Browse the repository at this point in the history
…sign focusZ. (#281)

* Enable CutOutDonutsScienceSensorTask to operate for a pair with same-sign focusZ.
  • Loading branch information
jfcrenshaw authored Oct 29, 2024
1 parent 164c127 commit 51a838b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 32 deletions.
8 changes: 8 additions & 0 deletions doc/versionHistory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
Version History
##################

.. _lsst.ts.wep-12.5.0:

-------------
12.5.0
-------------

* Enable CutOutDonutsScienceSensorTask to operate for a pair with same-sign focusZ.

.. _lsst.ts.wep-12.4.2:

-------------
Expand Down
14 changes: 2 additions & 12 deletions python/lsst/ts/wep/task/cutOutDonutsScienceSensorTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,22 +183,12 @@ def assignExtraIntraIdx(self, focusZVal0, focusZVal1, cameraName):
"""

if cameraName in ["LSSTCam", "LSSTComCam", "LSSTComCamSim"]:
errorStr = "Must have one extra-focal and one intra-focal image."
if focusZVal0 < 0:
# Check that other image does not have same defocal direction
if focusZVal1 <= 0:
raise ValueError(errorStr)
if focusZVal0 < focusZVal1:
extraExpIdx = 1
intraExpIdx = 0
elif focusZVal0 > 0:
# Check that other image does not have same defocal direction
if focusZVal1 >= 0:
raise ValueError(errorStr)
else:
extraExpIdx = 0
intraExpIdx = 1
else:
# Need to be defocal images ('FOCUSZ != 0')
raise ValueError(errorStr)
elif cameraName == "LATISS":
errorStr = "Must have two images with different FOCUSZ parameter."
if focusZVal0 != focusZVal1:
Expand Down
20 changes: 0 additions & 20 deletions tests/task/test_cutOutDonutsScienceSensorTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,26 +193,6 @@ def testAssignExtraIntraIdxLsstComCamSim(self):
self.assertEqual(extraIdx, 0)
self.assertEqual(intraIdx, 1)

def testAssignExtraIntraIdxFocusZValueError(self):
focusZNegative = -1
focusZPositive = 1
focusZ0 = 0

with self.assertRaises(ValueError):
self.task.assignExtraIntraIdx(focusZPositive, focusZPositive, "LSSTCam")
with self.assertRaises(ValueError):
self.task.assignExtraIntraIdx(focusZPositive, focusZ0, "LSSTCam")
with self.assertRaises(ValueError):
self.task.assignExtraIntraIdx(focusZNegative, focusZNegative, "LSSTCam")
with self.assertRaises(ValueError):
self.task.assignExtraIntraIdx(focusZNegative, focusZ0, "LSSTCam")
with self.assertRaises(ValueError) as context:
self.task.assignExtraIntraIdx(focusZ0, focusZPositive, "LSSTCam")
self.assertEqual(
"Must have one extra-focal and one intra-focal image.",
str(context.exception),
)

def testAssignExtraIntraIdxInvalidCamera(self):
cameraName = "WrongCam"
with self.assertRaises(ValueError) as context:
Expand Down

0 comments on commit 51a838b

Please sign in to comment.