@@ -59,7 +59,7 @@ def __init__(self, image_data=None,
5959 axis_x = Axis (scale = scale_x , visible = False )
6060 axis_y = Axis (scale = scale_y , orientation = 'vertical' , visible = False )
6161 scales_image = {'x' : scale_x , 'y' : scale_y ,
62- 'image' : ColorScale (max = 1.114 , min = 2902 ,
62+ 'image' : ColorScale (max = 1 , min = 0 ,
6363 scheme = 'Greys' )}
6464
6565 self ._scatter_marks = {}
@@ -351,7 +351,8 @@ class ImageWidget(ipw.VBox):
351351 image_height = trait .Int (help = "Height of the image (not viewer)" ).tag (sync = True )
352352 zoom_level = trait .Float (help = "Current zoom of the view" ).tag (sync = True )
353353 marker = trait .Any (help = "Markers" ).tag (sync = True )
354- cuts = trait .Any (help = "Cut levels" , allow_none = True ).tag (sync = True )
354+ cuts = trait .Any (help = "Cut levels" , allow_none = True ).tag (sync = False )
355+
355356 stretch = trait .Unicode (help = 'Stretch algorithm name' , allow_none = True ).tag (sync = True )
356357
357358 def __init__ (self , * args , image_width = 500 , image_height = 500 ):
@@ -385,9 +386,9 @@ def _interval_and_stretch(self):
385386
386387 return stretched
387388
388- def _send_data (self ):
389+ def _send_data (self , reset_view = True ):
389390 self ._astro_im .set_data (self ._interval_and_stretch (),
390- reset_view = False )
391+ reset_view = reset_view )
391392
392393 def _get_interval (self ):
393394 if self ._interval is None :
@@ -452,6 +453,8 @@ def _observe_cuts(self, change):
452453 self ._interval = apviz .ManualInterval (* cuts )
453454 else :
454455 self ._interval = cuts
456+ if self ._data is not None :
457+ self ._send_data ()
455458
456459 @trait .observe ('zoom_level' )
457460 def _update_zoom_level (self , change ):
@@ -481,11 +484,10 @@ def _update_viewer_zoom_scroll(self, change):
481484 raise NotImplementedError ('😭 sorry, cannot do that yet' )
482485 self ._astro_im .set_scroll_zoom (change ['new' ])
483486
484-
485487 # The methods, grouped loosely by purpose
486488
487489 # Methods for loading data
488- def load_fits (self , file_name_or_HDU ):
490+ def load_fits (self , file_name_or_HDU , reset_view = True ):
489491 if isinstance (file_name_or_HDU , str ):
490492 ccd = CCDData .read (file_name_or_HDU )
491493 elif isinstance (file_name_or_HDU ,
@@ -504,16 +506,20 @@ def load_fits(self, file_name_or_HDU):
504506 self ._ccd = ccd
505507 self ._data = ccd .data
506508 self ._wcs = ccd .wcs
507- self ._send_data ()
509+ self ._send_data (reset_view = reset_view )
508510
509- def load_array (self , array ):
511+ def load_array (self , array , reset_view = True ):
510512 self ._data = array
511- self ._send_data ()
513+ self ._send_data (reset_view = reset_view )
512514
513- def load_nddata (self , data ):
515+ def load_nddata (self , data , reset_view = True ):
514516 self ._ccd = data
515517 self ._data = self ._ccd .data
516- self ._send_data ()
518+ self ._wcs = data .wcs
519+ if self ._wcs is None :
520+ self ._wcs = WCS (self ._ccd .meta )
521+
522+ self ._send_data (reset_view = reset_view )
517523
518524 # Saving contents of the view and accessing the view
519525 def save (self , filename ):
0 commit comments