33import os
44
55from astropy .coordinates import SkyCoord
6- from astropy .nddata import NDData
76from astropy .table import Table
87from astropy .units import Quantity
98from astropy .visualization import BaseInterval , BaseStretch
109
11- from numpy .typing import ArrayLike
1210
1311# Allowed locations for cursor display
1412ALLOWED_CURSOR_LOCATIONS = ('top' , 'bottom' , None )
15- MINIMUM_REQUIRED_COLORMAPS = (
16- 'gray' ,
17- 'viridis' ,
18- 'plasma' ,
19- 'inferno' ,
20- 'magma' ,
21- 'purple-blue' ,
22- 'yellow-green-blue' ,
23- 'yellow-orange-red' ,
24- 'red-purple' ,
25- 'blue-green' ,
26- 'hot' ,
27- 'red-blue' ,
28- 'red-yellow-blue' ,
29- 'purple-orange' ,
30- 'purple-green' ,
31- )
3213
3314__all__ = [
3415 'ImageViewerInterface' ,
@@ -47,9 +28,6 @@ class ImageViewerInterface(Protocol):
4728 # Allowed locations for cursor display
4829 ALLOWED_CURSOR_LOCATIONS : tuple = ALLOWED_CURSOR_LOCATIONS
4930
50- # Required colormaps for the viewer
51- MINIMUM_REQUIRED_COLORMAPS : tuple [str , ...] = MINIMUM_REQUIRED_COLORMAPS
52-
5331 # The methods, grouped loosely by purpose
5432
5533 # Method for loading image data
@@ -157,10 +135,10 @@ def set_colormap(self, map_name: str, image_label: str | None = None) -> None:
157135 Parameters
158136 ----------
159137 map_name : str
160- The name of the colormap to set. This should be a valid
161- colormap name from Matplotlib; not all backends will support
138+ The name of the colormap to set. This should be a
139+ valid colormap name from Matplotlib`_;
140+ not all backends will support
162141 all colormaps, so the viewer should handle errors gracefully.
163- The case of the `map_name` is not important.
164142 image_label : str, optional
165143 The label of the image to set the colormap for. If not given and there is
166144 only one image loaded, the colormap for that image is set. If there are
@@ -171,6 +149,8 @@ def set_colormap(self, map_name: str, image_label: str | None = None) -> None:
171149 ValueError
172150 If the `map_name` is not a valid colormap name or if the `image_label`
173151 is not provided when there are multiple images loaded.
152+
153+ .. _Matplotlib: https://matplotlib.org/stable/gallery/color/colormap_reference.html
174154 """
175155 raise NotImplementedError
176156
@@ -199,19 +179,6 @@ def get_colormap(self, image_label: str | None = None) -> str:
199179 """
200180 raise NotImplementedError
201181
202- @property
203- @abstractmethod
204- def colormap_options (self ) -> list [str ]:
205- """
206- Get the list of available colormaps.
207-
208- Returns
209- -------
210- list of str
211- A list of available colormap names.
212- """
213- raise NotImplementedError
214-
215182 # Saving contents of the view and accessing the view
216183 @abstractmethod
217184 def save (self , filename : str | os .PathLike , overwrite : bool = False ) -> None :
0 commit comments