Skip to content

Commit

Permalink
Merge pull request #41 from pllim/astropy2-compat
Browse files Browse the repository at this point in the history
Astropy 2.0 compatibility
  • Loading branch information
pllim committed Jul 13, 2017
2 parents 258a58d + 0f10787 commit 9c861b0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
8 changes: 7 additions & 1 deletion commissioning/doscalars.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
import pylab as P
import matplotlib

from pysynphot.compat import ASTROPY_LT_1_3


def getdata(dirpath,fieldname,instr,save=True):
#get the list of files
flist=glob.glob("%s/*.log"%dirpath)
Expand Down Expand Up @@ -71,7 +74,10 @@ def getdata(dirpath,fieldname,instr,save=True):
tbhdu=pyfits.BinTableHDU.from_columns(pyfits.ColDefs([c1,c2,c3,c4,c5]))
outname=os.path.join(os.path.abspath(os.path.dirname(dirpath)),
"%s_%s_table.fits"%(instr,fieldname))
tbhdu.writeto(outname,clobber=True)
if ASTROPY_LT_1_3:
tbhdu.writeto(outname, clobber=True)
else:
tbhdu.writeto(outname, overwrite=True)

#and return the values for immediate use
return namedict,odict,sdict,obsmode,spectrum,val
Expand Down
9 changes: 9 additions & 0 deletions pysynphot/compat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"""Module to handle compatibility with dependencies like Astropy."""
from __future__ import absolute_import, division, print_function

import astropy
from astropy.utils.introspection import minversion

__all__ = ['ASTROPY_LT_1_3']

ASTROPY_LT_1_3 = not minversion(astropy, '1.3')

0 comments on commit 9c861b0

Please sign in to comment.