Skip to content

Commit 2f5df70

Browse files
Add flat metrics for mean, noise vs mjd and FP plots
1 parent 428eb07 commit 2f5df70

2 files changed

Lines changed: 55 additions & 6 deletions

File tree

pipelines/cpCore.yaml

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,30 @@ tasks:
139139
python: |
140140
from lsst.analysis.tools.atools import *
141141
142+
analyzeFlatCore:
143+
class: lsst.analysis.tools.tasks.VerifyCalibAnalysisTaskByFilter
144+
config:
145+
connections.outputName: cpFlatCore
146+
connections.data: verifyFlatResults
147+
148+
atools.flatMeanPerAmp: CalibStatisticFocalPlanePlot
149+
atools.flatMeanPerAmp.produce.plot.addHistogram: true
150+
atools.flatMeanPerAmp.quantityKey: FLAT_MEAN
151+
atools.flatMeanPerAmp.unit: electron
152+
153+
atools.flatNoisePerAmp: CalibStatisticFocalPlanePlot
154+
atools.flatNoisePerAmp.produce.plot.addHistogram: true
155+
atools.flatNoisePerAmp.quantityKey: FLAT_NOISE
156+
atools.flatNoisePerAmp.unit: electron
157+
158+
python: |
159+
from lsst.analysis.tools.atools import *
160+
142161
analyzeFlatDetCore:
143162
class: lsst.analysis.tools.tasks.VerifyCalibAnalysisTaskByFilter
144163
config:
145164
connections.outputName: cpFlatDetCore
146-
connections.data: verifyFlatResults
165+
connections.data: verifyFlatDetResults
147166

148167
atools.flatTestsByDate: CalibAmpScatterTool
149168
atools.flatTestsByDate.prep.panelKey: amplifier
@@ -154,6 +173,27 @@ tasks:
154173
atools.flatTestsByDate.produce.plot.xAxisLabel: "MJD"
155174
atools.flatTestsByDate.produce.plot.yAxisLabel: "Test Pass Results"
156175

176+
atools.flatMeansByDate: CalibAmpScatterTool
177+
atools.flatMeansByDate.prep.panelKey: amplifier
178+
atools.flatMeansByDate.prep.dataKey: mjd
179+
atools.flatMeansByDate.prep.quantityKey: FLAT_MEAN
180+
atools.flatMeansByDate.produce.plot.xAxisLabel: "MJD"
181+
atools.flatMeansByDate.produce.plot.yAxisLabel: "Flat Mean (electrons)"
182+
183+
atools.flatNoiseByDate: CalibAmpScatterTool
184+
atools.flatNoiseByDate.prep.panelKey: amplifier
185+
atools.flatNoiseByDate.prep.dataKey: mjd
186+
atools.flatNoiseByDate.prep.quantityKey: FLAT_NOISE
187+
atools.flatNoiseByDate.produce.plot.xAxisLabel: "MJD"
188+
atools.flatNoiseByDate.produce.plot.yAxisLabel: "Flat Noise (electrons)"
189+
190+
atools.flatNoiseByMean: CalibAmpScatterTool
191+
atools.flatNoiseByMean.prep.panelKey: amplifier
192+
atools.flatNoiseByMean.prep.dataKey: FLAT_MEAN
193+
atools.flatNoiseByMean.prep.quantityKey: FLAT_NOISE
194+
atools.flatNoiseByMean.produce.plot.xAxisLabel: "Flat Mean (electrons)"
195+
atools.flatNoiseByMean.produce.plot.yAxisLabel: "Flat Noise (electrons)"
196+
157197
python: |
158198
from lsst.analysis.tools.atools import *
159199

python/lsst/analysis/tools/atools/calibQuantityProfile.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
from typing import cast
3535

36+
import numpy
3637
from lsst.pex.config import Field
3738
from lsst.pex.config.configurableActions import ConfigurableActionField
3839

@@ -90,16 +91,24 @@ class SingleValueRepacker(KeyedDataAction):
9091

9192
def __call__(self, data: KeyedData, **kwargs) -> KeyedData:
9293
repackedData = {}
93-
uniquePanelKeys = list(set(data[self.panelKey]))
9494

95-
# Loop over data vector to repack information as it is expected.
95+
if isinstance(data[self.panelKey], numpy.ma.MaskedArray):
96+
good = ~data[self.panelKey].mask
97+
uniquePanelKeys = numpy.unique(data[self.panelKey])
98+
uniquePanelKeys = uniquePanelKeys.data[~uniquePanelKeys.mask].data
99+
else:
100+
good = numpy.ones(len(data[self.panelKey]), dtype=bool)
101+
uniquePanelKeys = list(set(data[self.panelKey]))
102+
103+
# Loop over data vector to repack information as
104+
# it is expected.
96105
for i in range(len(uniquePanelKeys)):
97106
repackedData[f"{uniquePanelKeys[i]}_x"] = []
98107
repackedData[f"{uniquePanelKeys[i]}"] = []
99108

100-
panelVec = cast(Vector, data[self.panelKey])
101-
dataVec = cast(Vector, data[self.dataKey])
102-
quantityVec = cast(Vector, data[self.quantityKey])
109+
panelVec = cast(Vector, data[self.panelKey][good])
110+
dataVec = cast(Vector, data[self.dataKey][good])
111+
quantityVec = cast(Vector, data[self.quantityKey][good])
103112

104113
for i in range(len(panelVec)):
105114
repackedData[f"{panelVec[i]}_x"].append(dataVec[i])

0 commit comments

Comments
 (0)