Skip to content
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

DM-42741: Make focalPlaneGeometryPlot look a bit better #203

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 20 additions & 7 deletions python/lsst/analysis/tools/actions/plot/focalPlanePlot.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

from ...interfaces import KeyedData, KeyedDataSchema, PlotAction, Scalar, Vector
from ...math import nanMax, nanMedian, nanMin, nanSigmaMad
from .plotUtils import addPlotInfo, sortAllArrays
from .plotUtils import addPlotInfo, mkColormap, sortAllArrays


class FocalPlanePlot(PlotAction):
Expand Down Expand Up @@ -382,6 +382,10 @@ def makePlot(
fig : `matplotlib.figure.Figure`
The resulting figure.
"""

cmap = mkColormap(["midnightBlue", "lightcyan", "darkgreen"])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are there 3 options here, and could we add "tableau-colorblind10"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The three work together to make the colormap, I do want to move all the plots over to a coloublind friendly set of palates, if these ones aren't already, but I would prefer to change all the plots at once.

cmap.set_bad(color="none")

if plotInfo is None:
plotInfo = {}

Expand Down Expand Up @@ -530,14 +534,23 @@ def makePlot(
bbox = dict(facecolor="paleturquoise", alpha=0.5, edgecolor="none")
ax.text(0.8, 0.91, statsText, transform=fig.transFigure, fontsize=8, bbox=bbox)

patchCollection = PatchCollection(patches, alpha=0.4, edgecolor="black")
patchCollection.set_array(values)
# Defaults to med + 4 sigma Mad to match
# the camera team plots
if self.plotMin is not None:
currentLimits = patchCollection.get_clim()
patchCollection.set_clim(self.plotMin, currentLimits[1])
vmin = self.plotMin
else:
vmin = statMed - 4.0 * statMad
if self.plotMax is not None:
currentLimits = patchCollection.get_clim()
patchCollection.set_clim(currentLimits[0], self.plotMax)
vmax = self.plotMax
else:
vmax = statMed + 4.0 * statMad

valuesPlot = np.clip(values, vmin, vmax)

patchCollection = PatchCollection(
patches, edgecolor="white", cmap=cmap, linewidth=0.5, linestyle=(0, (0.5, 3))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be too much to make these options (e.g., edgecolor, linewidth...) configurable too, or is it not worth it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer not to make all of these things configurable. I would like the plots produced to be uniform and not clutter up the code with too many config options.

)
patchCollection.set_array(valuesPlot)
ax.add_collection(patchCollection)

divider = make_axes_locatable(ax)
Expand Down