Skip to content

Commit

Permalink
Add astrom refcat target diff SkyPlot
Browse files Browse the repository at this point in the history
  • Loading branch information
cmsaunders committed Jan 5, 2023
1 parent e5310d7 commit 2a2ed5e
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 13 deletions.
66 changes: 65 additions & 1 deletion python/lsst/analysis/tools/analysisPlots/analysisPlots.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
"YPerpPSFPlot",
"YPerpCModelPlot",
"TargetRefCatDeltaRAScatterPlot",
"TargetRefCatDeltaRAScatterPlot",
"TargetRefCatDeltaDecScatterPlot",
"TargetRefCatDeltaRASkyPlot",
"TargetRefCatDeltaDecSkyPlot",
"SourcesPlot",
"RhoStatisticsPlot",
)
Expand Down Expand Up @@ -331,6 +333,68 @@ def setDefaults(self):
super().setDefaults(coordinate="Dec")


class TargetRefCatDeltaSkyPlot(AnalysisPlot):
"""Base class for plotting the RA/Dec distribution of stars, with the
difference between the RA or Dec of the target and reference catalog as
the color.
"""

parameterizedBand = Field[bool](
doc="Does this AnalysisTool support band as a name parameter", default=True
)

def coaddContext(self) -> None:
self.prep = CoaddPrep()

self.process.buildActions.starStatMask = SnSelector()
self.process.buildActions.starStatMask.fluxType = "{band}_psfFlux"

def visitContext(self) -> None:
self.parameterizedBand = False
self.prep = VisitPrep()

self.process.buildActions.starStatMask = SnSelector()
self.process.buildActions.starStatMask.fluxType = "psfFlux"

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

coordStr = coordinate.lower()
self.process.buildActions.zStars = AstromDiff(
col1=f"coord_{coordStr}_target", col2=f"coord_{coordStr}_ref"
)
self.process.buildActions.xStars = LoadVector()
self.process.buildActions.xStars.vectorKey = "coord_ra_target"
self.process.buildActions.yStars = LoadVector()
self.process.buildActions.yStars.vectorKey = "coord_dec_target"

self.produce = SkyPlot()
self.produce.plotTypes = ["stars"]
self.produce.plotName = f"astromDiffSky_{coordinate}"
self.produce.xAxisLabel = "R.A. (degrees)"
self.produce.yAxisLabel = "Dec. (degrees)"
self.produce.zAxisLabel = f"${coordinate}_{{target}} - {coordinate}_{{ref}}$ (marcsec)"
self.produce.plotOutlines = False


class TargetRefCatDeltaRASkyPlot(TargetRefCatDeltaSkyPlot):
"""Plot the difference in milliseconds between the RA of a target catalog
and a reference catalog as a function of RA and Dec.
"""

def setDefaults(self):
super().setDefaults(coordinate="RA")


class TargetRefCatDeltaDecSkyPlot(TargetRefCatDeltaSkyPlot):
"""Plot the difference in milliseconds between the Dec of a target catalog
and a reference catalog as a function of RA and Dec.
"""

def setDefaults(self):
super().setDefaults(coordinate="Dec")


class FluxRatioPlot(AnalysisPlot, BasePsfApRatio):
"""Plot a histogram of the PSF and AP flux ratios of sources."""

Expand Down
27 changes: 20 additions & 7 deletions python/lsst/analysis/tools/tasks/refCatObjectAnalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@

from lsst.pipe.base import connectionTypes as ct

from ..analysisPlots.analysisPlots import TargetRefCatDeltaDecScatterPlot, TargetRefCatDeltaRAScatterPlot
from ..analysisPlots.analysisPlots import (
TargetRefCatDeltaDecScatterPlot,
TargetRefCatDeltaDecSkyPlot,
TargetRefCatDeltaRAScatterPlot,
TargetRefCatDeltaRASkyPlot,
)
from ..contexts import CoaddContext
from .base import AnalysisBaseConfig, AnalysisBaseConnections, AnalysisPipelineTask

Expand All @@ -46,13 +51,21 @@ def setDefaults(self):
super().setDefaults()

# set plots to run
self.plots.astromDiffRA = TargetRefCatDeltaRAScatterPlot()
self.plots.astromDiffRA.parameterizedBand = True
self.plots.astromDiffRA.applyContext(CoaddContext)
self.plots.astromDiffRAScatterPlot = TargetRefCatDeltaRAScatterPlot()
self.plots.astromDiffRAScatterPlot.parameterizedBand = True
self.plots.astromDiffRAScatterPlot.applyContext(CoaddContext)

self.plots.astromDiffDec = TargetRefCatDeltaDecScatterPlot()
self.plots.astromDiffDec.parameterizedBand = True
self.plots.astromDiffDec.applyContext(CoaddContext)
self.plots.astromDiffDecScatterPlot = TargetRefCatDeltaDecScatterPlot()
self.plots.astromDiffDecScatterPlot.parameterizedBand = True
self.plots.astromDiffDecScatterPlot.applyContext(CoaddContext)

self.plots.astromDiffRASkyPlot = TargetRefCatDeltaRASkyPlot()
self.plots.astromDiffRASkyPlot.parameterizedBand = True
self.plots.astromDiffRASkyPlot.applyContext(CoaddContext)

self.plots.astromDiffDecSkyPlot = TargetRefCatDeltaDecSkyPlot()
self.plots.astromDiffDecSkyPlot.parameterizedBand = True
self.plots.astromDiffDecSkyPlot.applyContext(CoaddContext)

# set metrics to run - none so far

Expand Down
21 changes: 16 additions & 5 deletions python/lsst/analysis/tools/tasks/refCatSourceAnalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@

from lsst.pipe.base import connectionTypes as ct

from ..analysisPlots.analysisPlots import TargetRefCatDeltaDecScatterPlot, TargetRefCatDeltaRAScatterPlot
from ..analysisPlots.analysisPlots import (
TargetRefCatDeltaDecScatterPlot,
TargetRefCatDeltaDecSkyPlot,
TargetRefCatDeltaRAScatterPlot,
TargetRefCatDeltaRASkyPlot,
)
from ..contexts import VisitContext
from .base import AnalysisBaseConfig, AnalysisBaseConnections, AnalysisPipelineTask

Expand All @@ -46,11 +51,17 @@ def setDefaults(self):
super().setDefaults()

# set plots to run
self.plots.astromDiffRA = TargetRefCatDeltaRAScatterPlot()
self.plots.astromDiffRA.applyContext(VisitContext)
self.plots.astromDiffRAScatterPlot = TargetRefCatDeltaRAScatterPlot()
self.plots.astromDiffRAScatterPlot.applyContext(VisitContext)

self.plots.astromDiffDec = TargetRefCatDeltaDecScatterPlot()
self.plots.astromDiffDec.applyContext(VisitContext)
self.plots.astromDiffDecScatterPlot = TargetRefCatDeltaDecScatterPlot()
self.plots.astromDiffDecScatterPlot.applyContext(VisitContext)

self.plots.astromDiffRASkyPlot = TargetRefCatDeltaRASkyPlot()
self.plots.astromDiffRASkyPlot.applyContext(VisitContext)

self.plots.astromDiffDecSkyPlot = TargetRefCatDeltaDecSkyPlot()
self.plots.astromDiffDecSkyPlot.applyContext(VisitContext)

# set metrics to run - none so far

Expand Down

0 comments on commit 2a2ed5e

Please sign in to comment.