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

fitsio dependacy must be < 1.00 #33

Open
jacobic opened this issue May 22, 2019 · 1 comment
Open

fitsio dependacy must be < 1.00 #33

jacobic opened this issue May 22, 2019 · 1 comment

Comments

@jacobic
Copy link

jacobic commented May 22, 2019

Hi guys

Thanks for all your hard work with this package!

I just wanted to let you know about a small hiccup that I encountered when running redmapper with the latest version of fitsio. There are many instances within the source code which call the decode method on byte strings loaded with fitsio e.g. reading the master galaxy table within redmapper/configuration.py.

However this causes errors of the following type of error:

  File "/u/jacobic/hyperpipes/src/scripts/redmapper_calibrate.py", line 18, in <module>
    calib = redmapper.calibration.RedmapperCalibrator(args.configfile)
  File "/u/jacobic/.local/anaconda3/envs/redmapper/lib/python3.7/site-packages/redmapper-0.2.5-py3.7-linux-x86_64.egg/redmapper/calibration/calibrate.py", line 46, in __init__
    self.config = Configuration(conf)
  File "/u/jacobic/.local/anaconda3/envs/redmapper/lib/python3.7/site-packages/redmapper-0.2.5-py3.7-linux-x86_64.egg/redmapper/configuration.py", line 426, in __init__
    gal_stats = self._galfile_stats()
  File "/u/jacobic/.local/anaconda3/envs/redmapper/lib/python3.7/site-packages/redmapper-0.2.5-py3.7-linux-x86_64.egg/redmapper/configuration.py", line 649, in _galfile_stats
    mode = master['MODE'][0].rstrip().decode()
AttributeError: 'str' object has no attribute 'decode'

The reason for this is explained here (see penultimate section):

python 3 strings:

As of version 1.0.0, fitsio now supports Python 3 strings natively. This support means that for Python 3, native strings are read from and written correctly to FITS files. All byte string columns are treated as ASCII-encoded unicode strings as well. For FITS files written with a previous version of fitsio, the data in Python 3 will now come back as a string and not a byte string. Note that this support is not the same as full unicode support. Internally, fitsio only supports the ASCII character set.

Downgrading from v1.03 to v0.9.12 resolves the issue. Would it be possible to add this information to the requirements section of the README? or ideally remove the calls to decode and state the minimum version of fitsio should be 1.00.

Thanks in advance,
Jacob

@erykoff
Copy link
Owner

erykoff commented May 22, 2019

Ah, good point, I had been meaning to test the code with the latest fitsio but hadn't yet (oops). I'll either fix this or add the requirement in the next week or so. Thanks for letting me know!

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