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-43338: Add a debugPSF pipeline and associated plots #276

Merged
merged 5 commits into from
Aug 13, 2024
Merged
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
6 changes: 3 additions & 3 deletions pipelines/coaddQualityCore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ tasks:
class: lsst.analysis.tools.tasks.ObjectTableTractAnalysisTask
config:
connections.outputName: objectTableCore
atools.shapeSizeFractionalDiff: ShapeSizeFractionalDiff
atools.e1Diff: E1Diff
atools.e2Diff: E2Diff
atools.shapeSizeFractionalDiff: ShapeSizeFractionalDiffScatter # shapes.py
atools.e1Diff: E1DiffScatter # shapes.py
atools.e2Diff: E2DiffScatter # shapes.py
atools.skyFluxStatisticMetric: SkyFluxStatisticMetric
atools.skyFluxStatisticMetric.applyContext: CoaddContext
atools.parentDeblenderMetrics: ParentDeblenderMetrics
Expand Down
33 changes: 33 additions & 0 deletions pipelines/debugPSF.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
description: |
Tier2 atools and metrics to assess coadd quality
tasks:
debugCoaddPSF:
class: lsst.analysis.tools.tasks.ObjectTableTractAnalysisTask
config:
connections.outputName: debugCoaddPsf
# set plots to run
atools.ap12PsfSky: Ap12PsfSkyPlot # photometry.py
atools.psfCModelSky: PsfCModelSkyPlot # photometry.py
# These are in shapes.py
atools.e1DiffSky: E1DiffSky # shapes.py
atools.e2DiffSky: E2DiffSky # shapes.py
atools.shapeSizeFractionalDiffSky: ShapeSizeFractionalDiffSky # shapes.py
python: |
from lsst.analysis.tools.atools import *
from lsst.analysis.tools.contexts import *
debugVisitPSF:
class: lsst.analysis.tools.tasks.SourceTableVisitAnalysisTask
config:
connections.outputName: debugVisitPsf
atools.e1DiffScatter: E1DiffScatterVisit # shapes.py
atools.e2DiffScatter: E2DiffScatterVisit # shapes.py
atools.shapeSizeFractionalDiffScatter: ShapeSizeFractionalDiffScatterVisit # shapes.py
atools.e1DiffSky: E1DiffSkyVisit # shapes.py
atools.e2DiffSky: E2DiffSkyVisit # shapes.py
atools.shapeSizeFractionalDiffSky: ShapeSizeFractionalDiffSkyVisit # shapes.py
atools.e1FocalPlane: E1FocalPlane # shapes.py
atools.e2FocalPlane: E2FocalPlane # shapes.py
atools.shapeSizeFractionalDiffFocalPlane: ShapeSizeFractionalDiffFocalPlane # shapes.py
python: |
from lsst.analysis.tools.atools import *
from lsst.analysis.tools.contexts import *
5 changes: 5 additions & 0 deletions python/lsst/analysis/tools/actions/plot/focalPlanePlot.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,11 @@ def makePlot(
if plotInfo is None:
plotInfo = {}

# This is a little hacky but is the easiest way to solve
# the bands being printed on the plot correctly.
if "band" in plotInfo.keys():
plotInfo["bands"] = [plotInfo["band"]]

if len(data["x"]) == 0:
noDataFig = Figure()
noDataFig.text(0.3, 0.5, "No data to plot after selectors applied")
Expand Down
5 changes: 5 additions & 0 deletions python/lsst/analysis/tools/actions/plot/plotUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,9 +661,14 @@ def plotProjectionWithBinning(

xBinEdges = np.linspace(xMin, xMax, xNumBins + 1)
yBinEdges = np.linspace(yMin, yMax, yNumBins + 1)
finiteMask = np.isfinite(zs)
xs = xs[finiteMask]
ys = ys[finiteMask]
zs = zs[finiteMask]
binnedStats, xEdges, yEdges, binNums = binned_statistic_2d(
xs, ys, zs, statistic="median", bins=(xBinEdges, yBinEdges)
)

if len(xs) >= nPointBinThresh:
s = min(10, max(0.5, nPointBinThresh / 10 / (len(xs) ** 0.5)))
lw = (s**0.5) / 10
Expand Down
12 changes: 6 additions & 6 deletions python/lsst/analysis/tools/atools/photometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def setDefaults(self):
self.process.buildActions.yStars.vectorKey = "coord_dec"
self.process.buildActions.starStatMask = SnSelector()
self.process.buildActions.starStatMask.fluxType = "{band}_psfFlux"
self.process.buildActions.patch = LoadVector(vectorKey="patch")

self.process.buildActions.zStars = ExtinctionCorrectedMagDiff()
self.process.buildActions.zStars.magDiff.col1 = "{band}_ap12Flux"
Expand All @@ -81,7 +82,6 @@ def setDefaults(self):
self.produce.plot.xAxisLabel = "R.A. (degrees)"
self.produce.plot.yAxisLabel = "Dec. (degrees)"
self.produce.plot.zAxisLabel = "Ap 12 - PSF [mag]"
self.produce.plot.plotOutlines = False

self.produce.metric.units = {"median": "mmag", "sigmaMad": "mmag", "mean": "mmag"}

Expand Down Expand Up @@ -114,18 +114,18 @@ def setDefaults(self):
self.process.buildActions.starStatMask = SnSelector()
self.process.buildActions.starStatMask.fluxType = "{band}_psfFlux"
self.process.buildActions.starStatMask.threshold = 300
self.process.buildActions.patch = LoadVector(vectorKey="patch")

self.process.buildActions.zStars = MagDiff()
self.process.buildActions.zStars.col1 = "{band}_psfFlux"
self.process.buildActions.zStars.col2 = "{band}_cModelFlux"
self.process.buildActions.zStars.col1 = "{band}_cModelFlux"
self.process.buildActions.zStars.col2 = "{band}_psfFlux"

self.produce.plot = SkyPlot()
self.produce.plot.plotTypes = ["stars"]
self.produce.plot.plotName = "{band}_psf-cModel"
self.produce.plot.plotName = "cModel-{band}_psf"
self.produce.plot.xAxisLabel = "R.A. (degrees)"
self.produce.plot.yAxisLabel = "Dec. (degrees)"
self.produce.plot.zAxisLabel = "PSF - cModel [mmag]"
self.produce.plot.plotOutlines = False
self.produce.plot.zAxisLabel = "cModel - PSF [mmag]"


class PsfCModelScatterPlot(AnalysisTool):
Expand Down
Loading
Loading