Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CCDData translator should allow non celestial data #18

Open
astrofrog opened this issue Jul 15, 2020 · 0 comments
Open

CCDData translator should allow non celestial data #18

astrofrog opened this issue Jul 15, 2020 · 0 comments
Labels
bug Something isn't working

Comments

@astrofrog
Copy link
Member

For example, a 2-d spectrum might be a valid CCDData. Example error:

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-23-1e1b3b186e32> in <module>
      7 japp = JupyterApplication()
      8 
----> 9 japp.data_collection['test'] = spec2d
​
~/anaconda3/envs/jdaviz_dev/lib/python3.8/site-packages/glue/core/data_collection.py in __setitem__(self, key, data)
    382             handler, preferred = data_translator.get_handler_for(data)
    383 
--> 384             data = handler.to_data(data)
    385             data._preferred_translation = preferred
    386 
​
~/anaconda3/envs/jdaviz_dev/lib/python3.8/site-packages/glue_astronomy/translators/ccddata.py in to_data(self, obj)
     17     def to_data(self, obj):
     18         data = Data(coords=obj.wcs)
---> 19         data['data'] = obj.data
     20         data.get_component('data').units = str(obj.unit)
     21         data.meta.update(obj.meta)
​
~/anaconda3/envs/jdaviz_dev/lib/python3.8/site-packages/glue/core/data.py in __setitem__(self, key, value)
   1391         Wrapper for data.add_component()
   1392         """
-> 1393         self.add_component(value, key)
   1394 
   1395     @contract(component_id='cid_like|None', returns=Component)
​
~/anaconda3/envs/jdaviz_dev/lib/python3.8/site-packages/glue/core/data.py in add_component(self, component, label)
    976         if len(self._components) == 0:
    977             # TODO: make sure the following doesn't raise a componentsraised message
--> 978             self._create_pixel_and_world_components(ndim=component.ndim)
    979 
    980         # In some cases, such as when loading a session, we actually disable the
​
~/anaconda3/envs/jdaviz_dev/lib/python3.8/site-packages/glue/core/data.py in _create_pixel_and_world_components(self, ndim)
   1110     def _create_pixel_and_world_components(self, ndim):
   1111         self._update_pixel_components(ndim)
-> 1112         self._update_world_components(ndim)
   1113 
   1114     def _update_pixel_components(self, ndim):
​
~/anaconda3/envs/jdaviz_dev/lib/python3.8/site-packages/glue/core/data.py in _update_world_components(self, ndim)
   1139                     cid = self.add_component(comp, label)
   1140                     self._world_component_ids.append(cid)
-> 1141                 self._set_up_coordinate_component_links(ndim)
   1142 
   1143     def _set_up_coordinate_component_links(self, ndim):
​
~/anaconda3/envs/jdaviz_dev/lib/python3.8/site-packages/glue/core/data.py in _set_up_coordinate_component_links(self, ndim)
   1148         result = []
   1149         for i in range(ndim):
-> 1150             link = CoordinateComponentLink(self._pixel_component_ids,
   1151                                            self._world_component_ids[i],
   1152                                            self.coords, i)
​
~/anaconda3/envs/jdaviz_dev/lib/python3.8/site-packages/glue/core/component_link.py in __init__(self, comp_from, comp_to, coords, index, pixel2world)
    366         self._from_all = comp_from
    367 
--> 368         comp_from = [comp_from[i] for i in self.from_needed]
    369         super(CoordinateComponentLink, self).__init__(
    370             comp_from, comp_to, self.using)
​
~/anaconda3/envs/jdaviz_dev/lib/python3.8/site-packages/glue/core/component_link.py in <listcomp>(.0)
    366         self._from_all = comp_from
    367 
--> 368         comp_from = [comp_from[i] for i in self.from_needed]
    369         super(CoordinateComponentLink, self).__init__(
    370             comp_from, comp_to, self.using)
​
IndexError: list index out of range
@astrofrog astrofrog added the bug Something isn't working label Jul 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant