Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-42087: Add more streak parameters to output #339

Merged
merged 1 commit into from
Sep 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions python/lsst/ip/diffim/detectAndMeasure.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,10 @@ def setDefaults(self):
"STREAK", "INJECTED", "INJECTED_TEMPLATE"]
self.skySources.avoidMask = ["DETECTED", "DETECTED_NEGATIVE", "BAD", "NO_DATA", "EDGE"]

# Set the streak mask along the entire fit line, not only where the
# detected mask is set.
self.maskStreaks.onlyMaskDetected = False
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great place to set it, thank you - suggest one final inline comment e.g. # Set the streak mask along the entire fit line, not only where the detected mask is set



class DetectAndMeasureTask(lsst.pipe.base.PipelineTask):
"""Detect and measure sources on a difference image.
Expand Down Expand Up @@ -642,15 +646,23 @@ def _runStreakMasking(self, maskedImage):
Distance from center of detected streak.
``sigma`` : `np.ndarray`
Width of streak profile.
``reducedChi2`` : `np.ndarray`
Reduced chi2 of the best-fit streak profile.
``modelMaximum`` : `np.ndarray`
Peak value of the fit line profile.
"""
streaks = self.maskStreaks.run(maskedImage)
if self.config.writeStreakInfo:
rhos = np.array([line.rho for line in streaks.lines])
thetas = np.array([line.theta for line in streaks.lines])
sigmas = np.array([line.sigma for line in streaks.lines])
streakInfo = {'rho': rhos, 'theta': thetas, 'sigma': sigmas}
chi2s = np.array([line.reducedChi2 for line in streaks.lines])
modelMaximums = np.array([line.modelMaximum for line in streaks.lines])
streakInfo = {'rho': rhos, 'theta': thetas, 'sigma': sigmas, 'reducedChi2': chi2s,
'modelMaximum': modelMaximums}
else:
streakInfo = {'rho': np.array([]), 'theta': np.array([]), 'sigma': np.array([])}
streakInfo = {'rho': np.array([]), 'theta': np.array([]), 'sigma': np.array([]),
'reducedChi2': np.array([]), 'modelMaximum': np.array([])}
return pipeBase.Struct(maskedStreaks=streakInfo)


Expand Down
Loading