Skip to content

Commit

Permalink
Update sky plots to show the patch outlines as the default
Browse files Browse the repository at this point in the history
  • Loading branch information
sr525 committed Jul 26, 2023
1 parent 5022aff commit 799e9c1
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 4 deletions.
11 changes: 8 additions & 3 deletions python/lsst/analysis/tools/actions/plot/skyPlot.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@
import matplotlib.pyplot as plt
import numpy as np
from lsst.pex.config import Field, ListField
from lsst.skymap import BaseSkyMap
from matplotlib.figure import Figure
from matplotlib.patches import Rectangle

from ...interfaces import KeyedData, KeyedDataSchema, PlotAction, Scalar, Vector
from ...statistics import nansigmaMad
from .plotUtils import addPlotInfo, mkColormap, plotProjectionWithBinning, sortAllArrays
from .plotUtils import addPlotInfo, generateSummaryStats, mkColormap, plotProjectionWithBinning, sortAllArrays


class SkyPlot(PlotAction):
Expand Down Expand Up @@ -92,6 +93,9 @@ def getInputSchema(self, **kwargs) -> KeyedDataSchema:
base.append(("z", Vector))
base.append(("statMask", Vector))

if self.plotOutlines:
base.append(("patch", Vector))

return base

def __call__(self, data: KeyedData, **kwargs) -> Mapping[str, Figure] | Figure:
Expand Down Expand Up @@ -136,6 +140,7 @@ def statsAndText(self, arr, mask=None):
def makePlot(
self,
data: KeyedData,
skymap: BaseSkyMap,
plotInfo: Optional[Mapping[str, str]] = None,
sumStats: Optional[Mapping] = None,
**kwargs,
Expand Down Expand Up @@ -204,8 +209,8 @@ def makePlot(
fig = plt.figure(dpi=300)
ax = fig.add_subplot(111)

if sumStats is None:
sumStats = {}
if self.plotOutlines:
sumStats = generateSummaryStats(data, skymap, plotInfo)

if plotInfo is None:
plotInfo = {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def setDefaults(self):
self.process.buildActions.residual.buildAction.buildAction = RAcosDec()
self.process.buildActions.x = LoadVector(vectorKey="coord_ra")
self.process.buildActions.y = LoadVector(vectorKey="coord_dec")
self.process.buildActions.patch = LoadVector(vectorKey="patch")

self.produce = SkyPlot()

Expand Down
2 changes: 2 additions & 0 deletions python/lsst/analysis/tools/atools/astrometryWithReference.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ def setDefaults(self, coordinate):
self.process.buildActions.xStars.vectorKey = "coord_ra_target"
self.process.buildActions.yStars = LoadVector()
self.process.buildActions.yStars.vectorKey = "coord_dec_target"
self.process.buildActions.patch = LoadVector()
self.process.buildActions.patch.vectorKey = "patch"

self.produce = SkyPlot()
self.produce.plotTypes = ["stars"]
Expand Down
2 changes: 2 additions & 0 deletions python/lsst/analysis/tools/atools/magDiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ def setDefaults(self):
self.process.buildActions.xGalaxies.vectorKey = "coord_ra"
self.process.buildActions.yGalaxies = LoadVector()
self.process.buildActions.yGalaxies.vectorKey = "coord_dec"
self.process.buildActions.patch = LoadVector()
self.process.buildActions.patch.vectorKey = "patch"
self.process.buildActions.galaxyStatMask = SnSelector()
self.process.buildActions.galaxyStatMask.fluxType = "{band}_psfFlux"

Expand Down
3 changes: 3 additions & 0 deletions python/lsst/analysis/tools/atools/photometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ def setDefaults(self):
self.process.buildActions.xStars.vectorKey = "coord_ra"
self.process.buildActions.yStars = LoadVector()
self.process.buildActions.yStars.vectorKey = "coord_dec"
self.process.buildActions.patch = LoadVector()
self.process.buildActions.patch.vectorKey = "patch"

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

Expand Down
1 change: 1 addition & 0 deletions python/lsst/analysis/tools/atools/simpleDiaPlot.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def setDefaults(self):
self.process.buildActions.ras.vectorKey = "ra"
self.process.buildActions.decs = LoadVector()
self.process.buildActions.decs.vectorKey = "decl"

# TODO: update column name to 'dec' once column names are standardized,
# i.e., RFC-863

Expand Down
4 changes: 3 additions & 1 deletion python/lsst/analysis/tools/atools/skyObject.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,16 @@ def setDefaults(self):
self.process.buildActions.statMask = SnSelector()
self.process.buildActions.statMask.threshold = -1e12
self.process.buildActions.statMask.fluxType = "{band}_psfFlux"
self.process.buildActions.patch = LoadVector()
self.process.buildActions.patch.vectorKey = "patch"

self.produce.plot = SkyPlot()
self.produce.plot.plotTypes = ["any"]
self.produce.plot.plotName = "skyObject_{band}"
self.produce.plot.xAxisLabel = "R.A. (degrees)"
self.produce.plot.yAxisLabel = "Dec. (degrees)"
self.produce.plot.zAxisLabel = "Sky Object ap09Flux (nJy)"
self.produce.plot.plotOutlines = False
self.produce.plot.plotOutlines = True
self.produce.plot.fixAroundZero = True


Expand Down

0 comments on commit 799e9c1

Please sign in to comment.