Skip to content

Commit ca34b4f

Browse files
committed
Add image label to stretch/cuts in interface
1 parent 6d130d7 commit ca34b4f

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

src/astro_image_display_api/interface_definition.py

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def load_image(self, data: Any, image_label: str | None = None) -> None:
6969

7070
# Setting and getting image properties
7171
@abstractmethod
72-
def set_cuts(self, cuts: tuple | BaseInterval) -> None:
72+
def set_cuts(self, cuts: tuple | BaseInterval, image_label: str | None = None) -> None:
7373
"""
7474
Set the cuts for the image.
7575
@@ -79,14 +79,25 @@ def set_cuts(self, cuts: tuple | BaseInterval) -> None:
7979
The cuts to set. If a tuple, it should be of the form
8080
``(min, max)`` and will be interpreted as a
8181
`~astropy.visualization.ManualInterval`.
82+
83+
image_label : str, optional
84+
The label of the image to set the cuts for. If not given and there is
85+
only one image loaded, the cuts for that image are set.
8286
"""
8387
raise NotImplementedError
8488

8589
@abstractmethod
86-
def get_cuts(self) -> BaseInterval:
90+
def get_cuts(self, image_label: str | None = None) -> BaseInterval:
8791
"""
8892
Get the current cuts for the image.
8993
94+
Parameters
95+
----------
96+
image_label : str, optional
97+
The label of the image to get the cuts for. If not given and there is
98+
only one image loaded, the cuts for that image are returned. If there are
99+
multiple images and no label is provided, an error is raised.
100+
90101
Returns
91102
-------
92103
cuts : `~astropy.visualization.BaseInterval`
@@ -95,7 +106,7 @@ def get_cuts(self) -> BaseInterval:
95106
raise NotImplementedError
96107

97108
@abstractmethod
98-
def set_stretch(self, stretch: BaseStretch) -> None:
109+
def set_stretch(self, stretch: BaseStretch, image_label: str | None = None) -> None:
99110
"""
100111
Set the stretch for the image.
101112
@@ -104,14 +115,25 @@ def set_stretch(self, stretch: BaseStretch) -> None:
104115
stretch : Any stretch from `~astropy.visualization`
105116
The stretch to set. This can be any subclass of
106117
`~astropy.visualization.BaseStretch`.
118+
119+
image_label : str, optional
120+
The label of the image to set the cuts for. If not given and there is
121+
only one image loaded, the cuts for that image are set.
107122
"""
108123
raise NotImplementedError
109124

110125
@abstractmethod
111-
def get_stretch(self) -> BaseStretch:
126+
def get_stretch(self, image_label: str | None = None) -> BaseStretch:
112127
"""
113128
Get the current stretch for the image.
114129
130+
Parameters
131+
----------
132+
image_label : str, optional
133+
The label of the image to get the cuts for. If not given and there is
134+
only one image loaded, the cuts for that image are returned. If there are
135+
multiple images and no label is provided, an error is raised.
136+
115137
Returns
116138
-------
117139
stretch : `~astropy.visualization.BaseStretch`

0 commit comments

Comments
 (0)