diff --git a/pyglance/glance/gui_constants.py b/pyglance/glance/gui_constants.py index 26dfa9d1367093a8390f81f894e5ca235a3994dd..e106516bf84a65293fe8458ab548f91f2ce950a8 100644 --- a/pyglance/glance/gui_constants.py +++ b/pyglance/glance/gui_constants.py @@ -81,16 +81,6 @@ GREEN_VAR_NAME = "green" BLUE_VAR_NAME = "blue" ALPHA_VAR_NAME = "alpha" -# colormaps that are available in the GUI -# TODO, this needs to be upkept when the list of colormaps in the figure manager changes -CM_RAINBOW = "Rainbow" -CM_RAINBOW_REV = "Rainbow, Reverse" -CM_RAINBOW_DESAT = "Rainbow, Desaturated" -CM_GRAY = "Grayscale" -CM_GRAY_REV = "Grayscale, Reverse" -CM_SPECTRAL = "Rainbow2" -COLORMAP_NAMES = [CM_RAINBOW, CM_RAINBOW_REV, CM_RAINBOW_DESAT, CM_GRAY, CM_GRAY_REV, CM_SPECTRAL] - NO_DATA_MESSAGE = "Requested data was not available or did not exist." UNKNOWN_DATA_FORM = "An ununsupported plot format was requested. Aborting attempt to plot data." diff --git a/pyglance/glance/gui_figuremanager.py b/pyglance/glance/gui_figuremanager.py index 23f0f6b2dab61a150ed253acf50f8021bce2ecc0..f4114f7d8719e97d5ecb1c35f01d63d421788fd8 100644 --- a/pyglance/glance/gui_figuremanager.py +++ b/pyglance/glance/gui_figuremanager.py @@ -33,16 +33,21 @@ temp_dict = {'blue': [(0.0, 0.58333333333333326, 0.58333333333333326), (0.11, 0. DESAT_MAP = matplotlib.colors.LinearSegmentedColormap('colormap', temp_dict, 1024) # colormaps that are available in the GUI -# if this changes the list of colormap names in the constants module needs to be kept up -temp_spectral = cm.spectral if hasattr(cm, 'spectral') else cm.Spectral # newer matplotlib changed the name of this color map +temp_spectral = cm.spectral if hasattr(cm, 'spectral') else cm.Spectral # newer matplotlib changed the name of this color map +temp_rspectral = cm.spectral_r if hasattr(cm, 'spectral_r') else cm.Spectral_r AVAILABLE_COLORMAPS = { - CM_RAINBOW: cm.jet, - CM_RAINBOW_REV: cm.jet_r, - CM_RAINBOW_DESAT: DESAT_MAP, - CM_GRAY: cm.bone, - CM_GRAY_REV: cm.bone_r, - CM_SPECTRAL: temp_spectral, + "Viridis": cm.viridis, + "Cividis": cm.cividis, + "Plasma": cm.plasma, + "Ocean": cm.ocean, + "Spectral Rainbow": temp_spectral, + "Spectral Rainbow, Reverse": temp_rspectral, + "Grayscale": cm.bone, + "Grayscale, Reverse": cm.bone_r, + } +# note: we expect other modules to reference the COLORMAP_NAMES +COLORMAP_NAMES = list(AVAILABLE_COLORMAPS.keys()) # whether or not the plot can be drawn on a map CAN_BE_MAPPED = { diff --git a/pyglance/glance/gui_model.py b/pyglance/glance/gui_model.py index 7afbc283057dbc362a4e159fa5ee8deeab554aca..8146e606aa6e6c327ebdccb0d135e8f577f9bd6e 100644 --- a/pyglance/glance/gui_model.py +++ b/pyglance/glance/gui_model.py @@ -13,7 +13,8 @@ from os import path import glance.data as dataobjects import glance.io as io -from glance.gui_constants import * +from glance.gui_constants import * +from glance.gui_figuremanager import COLORMAP_NAMES LOG = logging.getLogger(__name__)