Skip to content

Commit

Permalink
Move streak detection configs before measurement configs
Browse files Browse the repository at this point in the history
  • Loading branch information
isullivan committed Dec 10, 2024
1 parent 4e169fb commit aefc48a
Showing 1 changed file with 21 additions and 24 deletions.
45 changes: 21 additions & 24 deletions python/lsst/ip/diffim/detectAndMeasure.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,27 @@ def setDefaults(self):
"NO_DATA",
]

# Copy configs for binned streak detection from the base detection task
self.streakDetection.thresholdType = self.detection.thresholdType
self.streakDetection.reEstimateBackground = self.detection.reEstimateBackground
self.streakDetection.excludeMaskPlanes = self.detection.excludeMaskPlanes
self.streakDetection.thresholdValue = self.detection.thresholdValue
# Only detect positive streaks
self.streakDetection.thresholdPolarity = "positive"
# Do not grow detected mask for streaks
self.streakDetection.nSigmaToGrow = 0
# Set the streak mask along the entire fit line, not only where the
# detected mask is set.
self.maskStreaks.onlyMaskDetected = False
# Restrict streak masking from growing too large
self.maskStreaks.maxStreakWidth = 100
# Restrict the number of iterations allowed for fitting streaks
# When the fit is good it should solve quickly, and exit a bad fit quickly
self.maskStreaks.maxFitIter = 10
# Only mask to 2 sigma in width
self.maskStreaks.nSigmaMask = 2
self.maskStreaks.absMinimumKernelHeight = 2

self.measurement.plugins.names |= ["ext_trailedSources_Naive",
"base_LocalPhotoCalib",
"base_LocalWcs",
Expand All @@ -244,30 +265,6 @@ def setDefaults(self):
"STREAK", "INJECTED", "INJECTED_TEMPLATE"]
self.skySources.avoidMask = ["DETECTED", "DETECTED_NEGATIVE", "BAD", "NO_DATA", "EDGE"]

self.streakDetection.thresholdPolarity = "positive"
# self.streakDetection.minPixels = 20
self.streakDetection.nSigmaToGrow = 0 # Do not grow detected mask for streaks
self.streakDetection.thresholdValue = 5.0
self.streakDetection.thresholdType = "pixel_stdev"
self.streakDetection.reEstimateBackground = False
self.streakDetection.excludeMaskPlanes = ["EDGE",
"SAT",
"BAD",
"INTRP",
"NO_DATA",
]
# Set the streak mask along the entire fit line, not only where the
# detected mask is set.
self.maskStreaks.onlyMaskDetected = False
# Restrict streak masking from growing too large
self.maskStreaks.maxStreakWidth = 100
# Restrict the number of iterations allowed for fitting streaks
# When the fit is good it should solve quickly, and exit a bad fit quickly
self.maskStreaks.maxFitIter = 10
# Only mask to 2 sigma in width
self.maskStreaks.nSigmaMask = 2
self.maskStreaks.absMinimumKernelHeight = 2


class DetectAndMeasureTask(lsst.pipe.base.PipelineTask):
"""Detect and measure sources on a difference image.
Expand Down

0 comments on commit aefc48a

Please sign in to comment.