Skip to content

Commit

Permalink
DM-42126: Remove ignored detectors exposures from being processed in …
Browse files Browse the repository at this point in the history
…SubtractBrightStarsTask
  • Loading branch information
bazkiaei committed Dec 12, 2023
1 parent 9527b94 commit 0c19e69
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions python/lsst/pipe/tasks/subtractBrightStars.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,14 @@ def __init__(self, *args, **kwargs):
def runQuantum(self, butlerQC, inputRefs, outputRefs):
# Docstring inherited.
inputs = butlerQC.get(inputRefs)
if inputs["inputExtendedPsf"].default_extended_psf is None:
if not self.detInRegions(inputs):
self.log.warn(
"Extended PSF model is not available for detector %i. Skipping withouth processing this "
"exposure.",
inputs["inputExposure"].detector.getId(),
)
return None
dataId = butlerQC.quantum.dataId
refObjLoader = ReferenceObjectLoader(
dataIds=[ref.datasetRef.dataId for ref in inputRefs.refCat],
Expand Down Expand Up @@ -364,6 +372,32 @@ def run(

return subtractorExp, invImages, badStamps

def detInRegions(self, inputs):
"""Determine whether the input exposure's detector is in the region(s)
where the extended PSF model(s) is(are) available.
Parameters
----------
inputs : `dict`
Dictionary containing the inputs to the task, including
`inputExposure` and `inputExtendedPsf`.
Returns
-------
`bool`
True if the detector is in the region(s) where the extended PSF
model(s) is(are) available, False otherwise.
"""
availableDets = [
det
for detList in inputs["inputExtendedPsf"].detectors_focal_plane_regions.values()
for det in detList.detectors
]
if inputs["inputExposure"].detector.getId() in availableDets:
return True
else:
return False

def _setUpStatistics(self, exampleMask):
"""Configure statistics control and flag, for use if ``scalingType`` is
`leastSquare`.
Expand Down

0 comments on commit 0c19e69

Please sign in to comment.