Skip to content

Commit

Permalink
Add rainbow, reversed rainbow, and seismic
Browse files Browse the repository at this point in the history
colormaps for image viewer.
  • Loading branch information
pllim committed Oct 26, 2022
1 parent 1acc87d commit 7d4c5a4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
4 changes: 3 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
New Features
------------

- New rainbow, reversed rainbow, and seismic (blue-red) colormaps for images. [#1785]

Cubeviz
^^^^^^^

Expand Down Expand Up @@ -103,7 +105,7 @@ Specviz2d
- Improved logic for initial guess for position of "Manual" background trace in spectral extraction
plugin. [#1738]

- Now supports loading a specific extension of the 2D spectrum file and
- Now supports loading a specific extension of the 2D spectrum file and
transposing data on load. [#1705]

- Spectral extraction plugin now supports visualizing and exporting the 1D spectrum associated
Expand Down
9 changes: 6 additions & 3 deletions jdaviz/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,14 +258,17 @@ def __init__(self, configuration=None, *args, **kwargs):
# Add a fitted_models dictionary that the helpers (or user) can access
self.fitted_models = {}

# Add inverse colormaps to Glue global state. Also see ColormapRegistry in
# Add new and inverse colormaps to Glue global state. Also see ColormapRegistry in
# https://github.com/glue-viz/glue/blob/main/glue/config.py
new_cms = (['Reversed: Gray', cm.gray_r],
new_cms = (['Rainbow', cm.rainbow],
['Seismic', cm.seismic],
['Reversed: Gray', cm.gray_r],
['Reversed: Viridis', cm.viridis_r],
['Reversed: Plasma', cm.plasma_r],
['Reversed: Inferno', cm.inferno_r],
['Reversed: Magma', cm.magma_r],
['Reversed: Hot', cm.hot_r])
['Reversed: Hot', cm.hot_r],
['Reversed: Rainbow', cm.rainbow_r])
for cur_cm in new_cms:
if cur_cm not in colormaps.members:
colormaps.add(*cur_cm)
Expand Down
3 changes: 2 additions & 1 deletion jdaviz/configs/imviz/tests/test_astrowidgets_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,9 @@ def test_colormap_options(self):
'Gray', 'Viridis', 'Plasma', 'Inferno', 'Magma', 'Purple-Blue',
'Yellow-Green-Blue', 'Yellow-Orange-Red', 'Red-Purple', 'Blue-Green',
'Hot', 'Red-Blue', 'Red-Yellow-Blue', 'Purple-Orange', 'Purple-Green',
'Rainbow', 'Seismic',
'Reversed: Gray', 'Reversed: Viridis', 'Reversed: Plasma', 'Reversed: Inferno',
'Reversed: Magma', 'Reversed: Hot']
'Reversed: Magma', 'Reversed: Hot', 'Reversed: Rainbow']

def test_invalid_colormap(self):
with pytest.raises(ValueError, match='Invalid colormap'):
Expand Down

0 comments on commit 7d4c5a4

Please sign in to comment.