Skip to content

Commit

Permalink
Works around failures in scatterPlot
Browse files Browse the repository at this point in the history
This patch works around some failures in scatterPlot.py until a
the underlying issues can be resolved.
  • Loading branch information
natelust committed Apr 4, 2022
1 parent b66497a commit 78d987f
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions python/lsst/analysis/drp/scatterPlot.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,11 @@ def run(self, catPlot, dataId, runName, skymap, tableName, bands, plotName):
sumStats = {} if skymap is None else generateSummaryStats(
plotDf, self.config.axisLabels["y"], skymap, plotInfo)
# Make the plot
fig = self.scatterPlotWithTwoHists(plotDf, plotInfo, sumStats)
try:
fig = self.scatterPlotWithTwoHists(plotDf, plotInfo, sumStats)
except Exception:
# This is a workaround until scatterPlotWithTwoHists works properly
fig = plt.figure(dpi=300)

return pipeBase.Struct(scatterPlot=fig)

Expand Down Expand Up @@ -385,12 +389,14 @@ def scatterPlotWithTwoHists(self, catPlot, plotInfo, sumStats, yLims=False, xLim
sourceTypeMapper["galaxies"]),
(xsStars.values, ysStars.values, "midnightblue", newBlues,
sourceTypeMapper["stars"])]
if np.any(catPlot["sourceType"] == sourceTypeMapper["unknowns"]):
elif np.any(catPlot["sourceType"] == sourceTypeMapper["unknowns"]):
unknowns = (catPlot["sourceType"] == sourceTypeMapper["unknowns"])
toPlotList = [(catPlot.loc[unknowns, xCol].values, catPlot.loc[unknowns, yCol].values,
"green", sourceTypeMapper["unknowns"])]
if np.any(catPlot["sourceType"] == sourceTypeMapper["all"]):
toPlotList = [(catPlot[xCol].values, catPlot[yCol].values, "purple", sourceTypeMapper["all"])]
"green", None, sourceTypeMapper["unknowns"])]
elif np.any(catPlot["sourceType"] == sourceTypeMapper["all"]):
toPlotList = [(catPlot[xCol].values, catPlot[yCol].values, "purple", None, sourceTypeMapper["all"])]
else:
toPlotList = []

for (j, (xs, ys, color, cmap, sourceType)) in enumerate(toPlotList):
if len(xs) < 2:
Expand Down

0 comments on commit 78d987f

Please sign in to comment.