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

FITS frontend crashes when parsing units #1552

Closed
ngoldbaum opened this issue Sep 7, 2017 · 1 comment
Closed

FITS frontend crashes when parsing units #1552

ngoldbaum opened this issue Sep 7, 2017 · 1 comment
Assignees

Comments

@ngoldbaum
Copy link
Member

Bug report

Bug summary

This was reported by Tazkera Haque on the mailing list.

Code for reproduction

import yt
# http://use.yt/upload/50e098ee
ds = yt.load('signal_wfilt_sn.fits')
ds.index

Actual outcome

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
~/Documents/yt-git-fixes/yt/mods.py in <module>()
----> 1 ds.index

~/Documents/yt-git-fixes/yt/data_objects/static_output.py in index(self)
    502                 raise RuntimeError("You should not instantiate Dataset.")
    503             self._instantiated_index = self._index_class(
--> 504                 self, dataset_type=self.dataset_type)
    505             # Now we do things that we need an instantiated index for
    506             # ...first off, we create our field_info now.

~/Documents/yt-git-fixes/yt/frontends/fits/data_structures.py in __init__(self, ds, dataset_type)
     91         self._handle = ds._handle
     92         self.float_type = np.float64
---> 93         GridIndex.__init__(self,ds,dataset_type)
     94
     95     def _initialize_data_storage(self):

~/Documents/yt-git-fixes/yt/geometry/geometry_handler.py in __init__(self, ds, dataset_type)
     56         # potentially quite expensive, and should be done with the indexing.
     57         mylog.debug("Detecting fields.")
---> 58         self._detect_output_fields()
     59
     60     def _initialize_state_variables(self):

~/Documents/yt-git-fixes/yt/frontends/fits/data_structures.py in _detect_output_fields(self)
    172                     continue
    173                 if self._ensure_same_dims(hdu):
--> 174                     units = self._determine_image_units(hdu.header, known_units)
    175                     try:
    176                         # Grab field name from btype

~/Documents/yt-git-fixes/yt/frontends/fits/data_structures.py in _determine_image_units(self, header, known_units)
    117                     n += 1
    118             if n != len(units): field_units = "dimensionless"
--> 119             if field_units[0] == "/":
    120                 field_units = "1%s" % field_units
    121             return field_units

IndexError: string index out of range

Expected outcome

No crash

Version Information

  • Operating System: Mac
  • Python Version: 3.5
  • yt version: latest master branch
  • Other Libraries (if applicable):
@ngoldbaum
Copy link
Member Author

Fixed by #1553

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants