Skip to content

Commit ab66f01

Browse files
authored
Merge pull request #78 from mwcraig/astrowidgets-fixes
Loading a catalog with the same label replaces old data.
2 parents 5373307 + 3d805b5 commit ab66f01

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/astro_image_display_api/image_viewer_logic.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,14 @@ class ImageViewerLogic:
7474
state to simulate the behavior of a real viewer.
7575
"""
7676

77-
_cuts: BaseInterval | tuple[float, float] = AsymmetricPercentileInterval(
78-
upper_percentile=95
79-
)
80-
_stretch: BaseStretch = LinearStretch
81-
8277
# some internal variable for keeping track of viewer state
8378
_wcs: WCS | None = None
8479
_center: tuple[numbers.Real, numbers.Real] = (0.0, 0.0)
8580

8681
def __post_init__(self):
82+
self._set_up_catalog_image_dicts()
83+
84+
def _set_up_catalog_image_dicts(self):
8785
# This is a dictionary of marker sets. The keys are the names of the
8886
# marker sets, and the values are the tables containing the markers.
8987
self._catalogs = defaultdict(CatalogInfo)
@@ -186,9 +184,9 @@ def set_cuts(
186184
**kwargs, # noqa: ARG002
187185
) -> None:
188186
if isinstance(value, tuple) and len(value) == 2:
189-
self._cuts = ManualInterval(value[0], value[1])
187+
cuts = ManualInterval(value[0], value[1])
190188
elif isinstance(value, BaseInterval):
191-
self._cuts = value
189+
cuts = value
192190
else:
193191
raise TypeError(
194192
"Cuts must be an Astropy.visualization Interval object or a tuple "
@@ -199,7 +197,7 @@ def set_cuts(
199197
raise ValueError(
200198
f"Image label '{image_label}' not found. Please load an image first."
201199
)
202-
self._images[image_label].cuts = self._cuts
200+
self._images[image_label].cuts = cuts
203201

204202
def set_colormap(
205203
self,

0 commit comments

Comments
 (0)