Skip to content

Commit

Permalink
Convert plot_CModel_sub_PSFmag_meas_sky_galaxies to analysis tools
Browse files Browse the repository at this point in the history
  • Loading branch information
enourbakhsh committed Jul 22, 2022
1 parent 1d6d938 commit a07c67e
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions python/lsst/analysis/tools/analysisPlots/magDiff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# This file is part of analysis_tools.
#
# Developed for the LSST Data Management System.
# This product includes software developed by the LSST Project
# (https://www.lsst.org).
# See the COPYRIGHT file at the top-level directory of this distribution
# for details of code ownership.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
from __future__ import annotations

__all__ = ("CModelSubPsfMagMeasSkyGalaxies",)

from ..actions.plot.skyPlot import SkyPlot
from ..actions.vector import CoaddPlotFlagSelector, GalaxySelector, LoadVector, MagDiff, SnSelector
from ..interfaces import AnalysisPlot


class CModelSubPsfMagMeasSkyGalaxies(AnalysisPlot):
"""Make a plot showing the difference between the cmodel magnitude and the
PSF magnitude. This plot shows the on sky distribution of these values
for galaxies.
"""

def setDefaults(self):
super().setDefaults()

self.prep.selectors.flagSelector = CoaddPlotFlagSelector()
self.prep.selectors.flagSelector.bands = ["g", "r", "i"]

self.prep.selectors.snSelector = SnSelector()
self.prep.selectors.snSelector.bands = ["i"]
self.prep.selectors.snSelector.fluxType = "{band}_psfFlux"
self.prep.selectors.snSelector.threshold = 100

self.prep.selectors.galaxySelector = GalaxySelector()
self.prep.selectors.galaxySelector.columnKey = "{band}_extendedness"

# TODO: Can we make these defaults somewhere?
self.process.buildActions.xGalaxies = LoadVector()
self.process.buildActions.xGalaxies.vectorKey = "coord_ra"
self.process.buildActions.yGalaxies = LoadVector()
self.process.buildActions.yGalaxies.vectorKey = "coord_dec"
self.process.buildActions.galaxyStatMask = SnSelector()
self.process.buildActions.galaxyStatMask.fluxType = "{band}_psfFlux"

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

self.produce = SkyPlot()
self.produce.plotTypes = ["galaxies"]
self.produce.plotName = "CModel_sub_PSF_meas_galaxies_{band}"
self.produce.xAxisLabel = "R.A. (degrees)"
self.produce.yAxisLabel = "Dec. (degrees)"
self.produce.zAxisLabel = "CModel - PSF (mmag) (Meas)"
self.produce.plotOutlines = False

0 comments on commit a07c67e

Please sign in to comment.