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-42201: Add flat metrics for mean, noise vs mjd and FP plots #308

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
42 changes: 41 additions & 1 deletion pipelines/cpCore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,30 @@ tasks:
python: |
from lsst.analysis.tools.atools import *

analyzeFlatCore:
class: lsst.analysis.tools.tasks.VerifyCalibAnalysisTaskByFilter
config:
connections.outputName: cpFlatCore
connections.data: verifyFlatResults

atools.flatMeanPerAmp: CalibStatisticFocalPlanePlot
atools.flatMeanPerAmp.produce.plot.addHistogram: true
atools.flatMeanPerAmp.quantityKey: FLAT_MEAN
atools.flatMeanPerAmp.unit: electron

atools.flatNoisePerAmp: CalibStatisticFocalPlanePlot
atools.flatNoisePerAmp.produce.plot.addHistogram: true
atools.flatNoisePerAmp.quantityKey: FLAT_NOISE
atools.flatNoisePerAmp.unit: electron

python: |
from lsst.analysis.tools.atools import *

analyzeFlatDetCore:
class: lsst.analysis.tools.tasks.VerifyCalibAnalysisTaskByFilter
config:
connections.outputName: cpFlatDetCore
connections.data: verifyFlatResults
connections.data: verifyFlatDetResults

atools.flatTestsByDate: CalibAmpScatterTool
atools.flatTestsByDate.prep.panelKey: amplifier
Expand All @@ -154,6 +173,27 @@ tasks:
atools.flatTestsByDate.produce.plot.xAxisLabel: "MJD"
atools.flatTestsByDate.produce.plot.yAxisLabel: "Test Pass Results"

atools.flatMeansByDate: CalibAmpScatterTool
atools.flatMeansByDate.prep.panelKey: amplifier
atools.flatMeansByDate.prep.dataKey: mjd
atools.flatMeansByDate.prep.quantityKey: FLAT_MEAN
atools.flatMeansByDate.produce.plot.xAxisLabel: "MJD"
atools.flatMeansByDate.produce.plot.yAxisLabel: "Flat Mean (electrons)"

atools.flatNoiseByDate: CalibAmpScatterTool
atools.flatNoiseByDate.prep.panelKey: amplifier
atools.flatNoiseByDate.prep.dataKey: mjd
atools.flatNoiseByDate.prep.quantityKey: FLAT_NOISE
atools.flatNoiseByDate.produce.plot.xAxisLabel: "MJD"
atools.flatNoiseByDate.produce.plot.yAxisLabel: "Flat Noise (electrons)"

atools.flatNoiseByMean: CalibAmpScatterTool
atools.flatNoiseByMean.prep.panelKey: amplifier
atools.flatNoiseByMean.prep.dataKey: FLAT_MEAN
atools.flatNoiseByMean.prep.quantityKey: FLAT_NOISE
atools.flatNoiseByMean.produce.plot.xAxisLabel: "Flat Mean (electrons)"
atools.flatNoiseByMean.produce.plot.yAxisLabel: "Flat Noise (electrons)"

python: |
from lsst.analysis.tools.atools import *

Expand Down
19 changes: 14 additions & 5 deletions python/lsst/analysis/tools/atools/calibQuantityProfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

from typing import cast

import numpy
from lsst.pex.config import Field
from lsst.pex.config.configurableActions import ConfigurableActionField

Expand Down Expand Up @@ -90,16 +91,24 @@ class SingleValueRepacker(KeyedDataAction):

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

# Loop over data vector to repack information as it is expected.
if isinstance(data[self.panelKey], numpy.ma.MaskedArray):
good = ~data[self.panelKey].mask
uniquePanelKeys = numpy.unique(data[self.panelKey])
uniquePanelKeys = uniquePanelKeys.data[~uniquePanelKeys.mask].data
else:
good = numpy.ones(len(data[self.panelKey]), dtype=bool)
uniquePanelKeys = list(set(data[self.panelKey]))

# Loop over data vector to repack information as
# it is expected.
for i in range(len(uniquePanelKeys)):
repackedData[f"{uniquePanelKeys[i]}_x"] = []
repackedData[f"{uniquePanelKeys[i]}"] = []

panelVec = cast(Vector, data[self.panelKey])
dataVec = cast(Vector, data[self.dataKey])
quantityVec = cast(Vector, data[self.quantityKey])
panelVec = cast(Vector, data[self.panelKey][good])
dataVec = cast(Vector, data[self.dataKey][good])
quantityVec = cast(Vector, data[self.quantityKey][good])

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