Skip to content

Commit

Permalink
Add defects to calib stats.
Browse files Browse the repository at this point in the history
  • Loading branch information
czwa committed Feb 1, 2024
1 parent 21d4916 commit 13e6714
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
6 changes: 3 additions & 3 deletions python/lsst/ip/isr/defects.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,13 +290,13 @@ def updateCounters(self, columns=None, hot=None, cold=None):
"""
mdSupplemental = dict()
if columns:
mdSupplemental["N_BAD_COLUMNS"] = columns
mdSupplemental["LSST CALIB DEFECTS N_BAD_COLUMNS"] = columns
if hot:
for amp, count in hot.items():
mdSupplemental[f"N_HOT {amp}"] = count
mdSupplemental[f"LSST CALIB DEFECTS {amp} N_HOT"] = count
if cold:
for amp, count in cold.items():
mdSupplemental[f"N_COLD {amp}"] = count
mdSupplemental[f"LSST CALIB DEFECTS {amp} N_COLD"] = count
self.getMetadata().update(mdSupplemental)

def toFitsRegionTable(self):
Expand Down
18 changes: 17 additions & 1 deletion python/lsst/ip/isr/isrStatistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,7 @@ def copyCalibDistributionStatistics(self, inputExp, **kwargs):
"""
outputStats = {}

# Amp level elements
for amp in inputExp.getDetector():
ampStats = {}

Expand All @@ -568,7 +569,22 @@ def copyCalibDistributionStatistics(self, inputExp, **kwargs):
for pct in self.config.expectedDistributionLevels:
key = f"LSST CALIB {calibType.upper()} {amp.getName()} DISTRIBUTION {pct}-PCT"
ampStats[key] = metadata.get(key, np.nan)
outputStats[amp.getName()] = ampStats

for calibType in ("defects"):
if kwargs.get(calibType, None) is not None:
metadata = kwargs[calibType].getMetadata()
for key in (f"LSST CALIB {calibType.upper()} {amp.getName()} N_HOT",
f"LSST CALIB {calibType.upper()} {amp.getName()} N_COLD"):
ampStats[key] = metadata.get(key, np.nan)
outputStats[amp.getName()] = ampStats

# Detector level elements
for calibType in ("defects"):
if kwargs.get(calibType, None) is not None:
metadata = kwargs[calibType].getMetadata()
for key in (f"LSST CALIB {calibType.upper()} N_BAD_COLUMNS"):
outputStats["detector"][key] = metadata.get(key, np.nan)

return outputStats

def measureBiasShifts(self, inputExp, overscanResults):
Expand Down

0 comments on commit 13e6714

Please sign in to comment.