Skip to content

Commit

Permalink
fix metadata parsing issues with fitsio
Browse files Browse the repository at this point in the history
  • Loading branch information
apetri committed Mar 28, 2016
1 parent e8aa3d1 commit 0c69757
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion lenstools/catalog/shear.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,21 @@ def read(cls,filename,*args,**kwargs):

if fitsio is not None:
with fitsio.FITS(filename,"r") as hdulist:
return cls(hdulist[1].read())

data = cls(hdulist[1].read())
header = hdulist[1].read_header()

try:
data.meta["NGAL"] = header["NGAL"]
except ValueError:
pass

try:
data.meta["AUNIT"] = header["AUNIT"].replace(" ","")
except ValueError:
pass

return data

return super(Catalog,cls).read(filename,*args,**kwargs)

Expand Down

0 comments on commit 0c69757

Please sign in to comment.