Skip to content

DM-40197: Update sky plots to show the patch outlines as the default #139

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
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