I am trying to use Glupyter to load a FITS image and link it to a catalog table as well. I'm getting an error when trying to imshow
the image data. I've tried passing in the image data as well as the full HDUList object and I get the same error.
tmp = '/Users/bcherinka/Work/notebooks/dss_red_66.582618_-67.806508.fits'
dss = fits.open(tmp)
sciim = app.add_data(dss=dss[0].data)[0]
imview = app.imshow(data=sciim)
---------------------------------------------------------------------------
TraitError Traceback (most recent call last)
<ipython-input-7-27ab10311ede> in <module>
2 dss = fits.open(tmp)
3 sciim = app.add_data(dss=dss[0].data)[0]
----> 4 imview = app.imshow(data=sciim)
~/Work/git/stsci/glue-jupyter/glue_jupyter/app.py in imshow(self, x, y, data, widget)
240 if len(data.pixel_component_ids) < 2:
241 raise ValueError('There are less than 2 pixel components (not an image?)')
--> 242 view = self.new_data_viewer(viewer_cls, data=data)
243 if x is not None:
244 x = data.id[x]
~/Work/git/stsci/glue-jupyter/glue_jupyter/app.py in new_data_viewer(self, viewer_class, data, state)
136 if data is not None:
137 if isinstance(data, BaseData):
--> 138 result = c.add_data(data)
139 elif isinstance(data, Subset):
140 result = c.add_subset(data)
~/Work/git/stsci/glue-jupyter/glue_jupyter/view.py in add_data(self, data, color, alpha, **layer_state)
77 layer_state = dict(layer_state)
78 _update_not_none(layer_state, color=color, alpha=alpha)
---> 79 layer.update()
80 layer.state.update_from_dict(layer_state)
81
~/Work/git/stsci/glue-jupyter/glue_jupyter/bqplot/image.py in update(self)
132 # print(np.nanmin(data), np.nanmax(data))
133 # png_data = _scalar_to_png_data(data)
--> 134 self.scale_image.min = self.state.v_min
135 self.scale_image.max = self.state.v_max
136 self.image_mark.image = data
~/anaconda3/lib/python3.7/site-packages/traitlets/traitlets.py in __set__(self, obj, value)
583 raise TraitError('The "%s" trait is read-only.' % self.name)
584 else:
--> 585 self.set(obj, value)
586
587 def _validate(self, obj, value):
~/anaconda3/lib/python3.7/site-packages/traitlets/traitlets.py in set(self, obj, value)
557
558 def set(self, obj, value):
--> 559 new_value = self._validate(obj, value)
560 try:
561 old_value = obj._trait_values[self.name]
~/anaconda3/lib/python3.7/site-packages/traitlets/traitlets.py in _validate(self, obj, value)
589 return value
590 if hasattr(self, 'validate'):
--> 591 value = self.validate(obj, value)
592 if obj._cross_validation_lock is False:
593 value = self._cross_validate(obj, value)
~/anaconda3/lib/python3.7/site-packages/traitlets/traitlets.py in validate(self, obj, value)
1974 value = float(value)
1975 if not isinstance(value, float):
-> 1976 self.error(obj, value)
1977 return _validate_bounds(self, obj, value)
1978
~/anaconda3/lib/python3.7/site-packages/traitlets/traitlets.py in error(self, obj, value)
623 e = "The '%s' trait must be %s, but a value of %r was specified." \
624 % (self.name, self.info(), repr_type(value))
--> 625 raise TraitError(e)
626
627 def get_metadata(self, key, default=None):
TraitError: The 'min' trait of a ColorScale instance must be a float, but a value of 2216 <class 'numpy.int64'> was specified.
import matplotlib.pyplot as plt
plt.imshow(dss[0].data, origin='lower')