Skip to content

DM-45990: Create initial_pvi background metric #1114

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
18 changes: 15 additions & 3 deletions python/lsst/pipe/tasks/computeExposureSummaryStats.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,11 +535,23 @@ def update_background_stats(self, summary, background):
as well.
"""
if background is not None:
bgStats = (bg[0].getStatsImage().getImage().array
for bg in background)
summary.skyBg = float(sum(np.median(bg[np.isfinite(bg)]) for bg in bgStats))
bgStats = []
for bg in background:
statsImageF = bg[0].getStatsImage().getImage()
bgArray = statsImageF.array
bgArray[~np.isfinite(bgArray)] = np.nan
bgStats.append(bgArray)
summary.skyBg = float(sum(np.nanmedian(bg) for bg in bgStats))
skyBgSumImage = np.sum(np.array(bgStats), axis=0)
try:
summary.skyBgNormRange = float(
(np.nanmax(skyBgSumImage) - np.nanmin(skyBgSumImage)) / np.nanmedian(skyBgSumImage)
)
except ZeroDivisionError:
summary.skyBgNormRange = float("nan")
else:
summary.skyBg = float("nan")
summary.skyBgNormRange = float("nan")

def update_masked_image_stats(self, summary, masked_image):
"""Compute summary-statistic fields that depend on the masked image
Expand Down