Skip to content

Commit

Permalink
Add a psf - cmodel scatter plot and move the sky plot to the extended…
Browse files Browse the repository at this point in the history
… pipeline
  • Loading branch information
sr525 committed Jan 25, 2024
1 parent 70bd774 commit 3a78b8f
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pipelines/coaddQualityCore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ tasks:
atools.yPerpCModel: YPerpCModel
atools.skyObjectSky: SkyObjectSkyPlot
atools.skyObjectFlux: SkyObjectHistPlot
atools.psfCModelSky: PsfCModelSkyPlot
atools.psfCModelScatter: PsfCModelScatterPlot
python: |
from lsst.analysis.tools.atools import *
from lsst.analysis.tools.contexts import *
Expand Down
1 change: 1 addition & 0 deletions pipelines/coaddQualityExtended.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ tasks:
connections.outputName: objectTableExtended
# set plots to run
atools.ap12PsfSky: Ap12PsfSkyPlot
atools.psfCModelSky: PsfCModelSkyPlot
atools.shapeSizeDetRadiusVsCmodelMag: SizeMagnitudePlot
atools.shapeSizeDetRadiusVsCmodelMag.size_type: "determinantRadius"
atools.shapeSizeDetRadiusVsCmodelMag.mag_x: "cmodel_err"
Expand Down
57 changes: 47 additions & 10 deletions python/lsst/analysis/tools/atools/photometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
from __future__ import annotations

__all__ = ("Ap12PsfSkyPlot", "PsfCModelSkyPlot", "PsfApRatio")
__all__ = ("Ap12PsfSkyPlot", "PsfCModelSkyPlot", "PsfCModelScatterPlot", "PsfApRatio")

from ..actions.plot.histPlot import HistPanel, HistPlot
from ..actions.plot.scatterplotWithTwoHists import ScatterPlotStatsAction, ScatterPlotWithTwoHists
from ..actions.plot.skyPlot import SkyPlot
from ..actions.scalar.scalarActions import MeanAction, MedianAction, SigmaMadAction
from ..actions.vector import (
CoaddPlotFlagSelector,
ConvertFluxToMag,
DivideVector,
ExtinctionCorrectedMagDiff,
LoadVector,
Expand Down Expand Up @@ -117,15 +119,6 @@ def setDefaults(self):
self.process.buildActions.zStars.col1 = "{band}_psfFlux"
self.process.buildActions.zStars.col2 = "{band}_cModelFlux"

self.process.calculateActions.median = MedianAction()
self.process.calculateActions.median.vectorKey = "zStars"

self.process.calculateActions.mean = MeanAction()
self.process.calculateActions.mean.vectorKey = "zStars"

self.process.calculateActions.sigmaMad = SigmaMadAction()
self.process.calculateActions.sigmaMad.vectorKey = "zStars"

self.produce.plot = SkyPlot()
self.produce.plot.plotTypes = ["stars"]
self.produce.plot.plotName = "{band}_psf-cModel"
Expand All @@ -134,6 +127,50 @@ def setDefaults(self):
self.produce.plot.zAxisLabel = "PSF - cModel [mmag]"
self.produce.plot.plotOutlines = False


class PsfCModelScatterPlot(AnalysisTool):
"""Creates a scatterPlot showing the difference between
PSF and CModel mags"""

def setDefaults(self):
super().setDefaults()
self.prep.selectors.flagSelector = CoaddPlotFlagSelector()
self.prep.selectors.flagSelector.bands = []

self.prep.selectors.snSelector = SnSelector()
self.prep.selectors.snSelector.fluxType = "{band}_psfFlux"
self.prep.selectors.snSelector.threshold = 300

self.prep.selectors.starSelector = StarSelector()
self.prep.selectors.starSelector.vectorKey = "{band}_extendedness"

self.process.buildActions.xStars = ConvertFluxToMag()
self.process.buildActions.xStars.vectorKey = "{band}_psfFlux"
self.process.buildActions.yStars = MagDiff()
self.process.buildActions.yStars.col1 = "{band}_psfFlux"
self.process.buildActions.yStars.col2 = "{band}_cModelFlux"
self.process.buildActions.patch = LoadVector(vectorKey="patch")

self.process.calculateActions.stars = ScatterPlotStatsAction(vectorKey="yStars")
self.process.calculateActions.stars.lowSNSelector.fluxType = "{band}_psfFlux"
self.process.calculateActions.stars.highSNSelector.fluxType = "{band}_psfFlux"
self.process.calculateActions.stars.fluxType = "{band}_psfFlux"

self.process.calculateActions.median = MedianAction()
self.process.calculateActions.median.vectorKey = "yStars"

self.process.calculateActions.mean = MeanAction()
self.process.calculateActions.mean.vectorKey = "yStars"

self.process.calculateActions.sigmaMad = SigmaMadAction()
self.process.calculateActions.sigmaMad.vectorKey = "yStars"

self.produce.plot = ScatterPlotWithTwoHists()
self.produce.plot.plotTypes = ["stars"]
self.produce.plot.xAxisLabel = "PSF Magnitude (Mag)"
self.produce.plot.yAxisLabel = "PSF - cModel [mmag]"
self.produce.plot.magLabel = "PSF Magnitude (mag)"

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

self.produce.metric.newNames = {
Expand Down

0 comments on commit 3a78b8f

Please sign in to comment.