Skip to content

Commit

Permalink
Use viridis as default cmap for plot_grid
Browse files Browse the repository at this point in the history
  • Loading branch information
larrybradley committed Nov 20, 2024
1 parent daf655a commit 11b7672
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ Bug Fixes
API Changes
^^^^^^^^^^^

- ``photutils.psf``

- The ``'viridis'`` color map is now the default in the
``GriddedPSFModel`` ``plot_grid`` method when ``deltas=True``.
[#1954]


2.0.2 (2024-10-24)
------------------
Expand Down
14 changes: 2 additions & 12 deletions photutils/psf/model_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def _reshape_grid(self, data):
return data.transpose([0, 2, 1, 3]).reshape(nypsfs * ny, nxpsfs * nx)

def plot_grid(self, *, ax=None, vmax_scale=None, peak_norm=False,
deltas=False, cmap=None, dividers=True,
deltas=False, cmap='viridis', dividers=True,
divider_color='darkgray', divider_ls='-', figsize=None):
"""
Plot the grid of ePSF models.
Expand Down Expand Up @@ -68,10 +68,7 @@ def plot_grid(self, *, ax=None, vmax_scale=None, peak_norm=False,
and the average ePSF.
cmap : str or `matplotlib.colors.Colormap`, optional
The colormap to use. The default is `None`, which uses
the 'viridis' colormap for plotting ePSF data and the
'gray_r' colormap for plotting the ePSF difference data
(``deltas=True``).
The colormap to use. The default is 'viridis'.
dividers : bool, optional
Whether to show divider lines between the ePSFs.
Expand Down Expand Up @@ -105,7 +102,6 @@ def plot_grid(self, *, ax=None, vmax_scale=None, peak_norm=False,
the function call to suppress the display of the return value.
"""
import matplotlib.pyplot as plt
from matplotlib import cm

data = self.data.copy()
if deltas:
Expand All @@ -132,9 +128,6 @@ def plot_grid(self, *, ax=None, vmax_scale=None, peak_norm=False,
data /= data.max()

if deltas:
if cmap is None:
cmap = cm.gray_r.copy()

if vmax_scale is None:
vmax_scale = 0.03
vmax = data.max() * vmax_scale
Expand All @@ -144,9 +137,6 @@ def plot_grid(self, *, ax=None, vmax_scale=None, peak_norm=False,
else:
norm = simple_norm(data, 'linear', min_cut=vmin, max_cut=vmax)
else:
if cmap is None:
cmap = cm.viridis.copy()

if vmax_scale is None:
vmax_scale = 1.0
vmax = data.max() * vmax_scale
Expand Down

0 comments on commit 11b7672

Please sign in to comment.