summaryrefslogtreecommitdiff
path: root/lib/stwcs/updatewcs
diff options
context:
space:
mode:
authordencheva <dencheva@stsci.edu>2014-04-30 17:00:15 -0400
committerdencheva <dencheva@stsci.edu>2014-04-30 17:00:15 -0400
commite2041048d7b03b0a8d9557863a1cfb32592fab1a (patch)
tree622250362c2bd8fb626f07b758576b2941edaf4e /lib/stwcs/updatewcs
parent80b187da718b44907ed490e00d149e11b8085253 (diff)
downloadstwcs_hcf-e2041048d7b03b0a8d9557863a1cfb32592fab1a.tar.gz
deal with pyfits/wcs deprecation wrnings
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stwcs/trunk@31259 fe389314-cf27-0410-b35b-8c050e845b92
Diffstat (limited to 'lib/stwcs/updatewcs')
-rw-r--r--lib/stwcs/updatewcs/__init__.py30
-rw-r--r--lib/stwcs/updatewcs/det2im.py2
-rw-r--r--lib/stwcs/updatewcs/npol.py2
3 files changed, 19 insertions, 15 deletions
diff --git a/lib/stwcs/updatewcs/__init__.py b/lib/stwcs/updatewcs/__init__.py
index 4930082..d8acb17 100644
--- a/lib/stwcs/updatewcs/__init__.py
+++ b/lib/stwcs/updatewcs/__init__.py
@@ -124,7 +124,7 @@ def makecorr(fname, allowed_corr):
if 'DET2IMCorr' in allowed_corr:
kw2update = det2im.DET2IMCorr.updateWCS(f)
for kw in kw2update:
- f[1].header.update(kw, kw2update[kw])
+ f[1].header[kw] = kw2update[kw]
for i in range(len(f))[1:]:
extn = f[i]
@@ -146,14 +146,14 @@ def makecorr(fname, allowed_corr):
corr_klass = corrections.__getattribute__(c)
kw2update = corr_klass.updateWCS(ext_wcs, ref_wcs)
for kw in kw2update:
- hdr.update(kw, kw2update[kw])
+ hdr[kw] = kw2update[kw]
# give the primary WCS a WCSNAME value
idcname = f[0].header.get('IDCTAB', " ")
if idcname.strip() and 'idc.fits' in idcname:
wname = ''.join(['IDC_',
utils.extract_rootname(idcname,suffix='_idc')])
else: wname = " "
- hdr.update('WCSNAME', wname)
+ hdr['WCSNAME'] = wname
elif extname in ['err', 'dq', 'sdq', 'samp', 'time']:
cextver = extn.header['extver']
@@ -168,18 +168,22 @@ def makecorr(fname, allowed_corr):
if 'NPOLCorr' in allowed_corr:
kw2update = npol.NPOLCorr.updateWCS(f)
for kw in kw2update:
- f[1].header.update(kw, kw2update[kw])
+ f[1].header[kw] = kw2update[kw]
# Finally record the version of the software which updated the WCS
if 'HISTORY' in f[0].header:
- f[0].header.update(key='UPWCSVER', value=stwcs.__version__,
- comment="Version of STWCS used to updated the WCS", before='HISTORY')
- f[0].header.update(key='PYWCSVER', value=astropy.__version__,
- comment="Version of PYWCS used to updated the WCS", before='HISTORY')
+ f[0].header.set('UPWCSVER', value=stwcs.__version__,
+ comment="Version of STWCS used to updated the WCS",
+ before='HISTORY')
+ f[0].header.set('PYWCSVER', value=astropy.__version__,
+ comment="Version of PYWCS used to updated the WCS",
+ before='HISTORY')
elif 'ASN_MTYP' in f[0].header:
- f[0].header.update(key='UPWCSVER', value=stwcs.__version__,
- comment="Version of STWCS used to updated the WCS", after='ASN_MTYP')
- f[0].header.update(key='PYWCSVER', value=pywcs.__version__,
- comment="Version of PYWCS used to updated the WCS", after='ASN_MTYP')
+ f[0].header.set('UPWCSVER', value=stwcs.__version__,
+ comment="Version of STWCS used to updated the WCS",
+ after='ASN_MTYP')
+ f[0].header.set('PYWCSVER', value=pywcs.__version__,
+ comment="Version of PYWCS used to updated the WCS",
+ after='ASN_MTYP')
else:
# Find index of last non-blank card, and insert this new keyword after that card
for i in range(len(f[0].header) - 1, 0, -1):
@@ -212,7 +216,7 @@ def copyWCS(w, ehdr):
wcsutil.pc2cd(hwcs)
for k in hwcs.keys():
key = k[:7]
- ehdr.update(key=key, value=hwcs[k])
+ ehdr[key] = hwcs[k]
def getNrefchip(fobj):
"""
diff --git a/lib/stwcs/updatewcs/det2im.py b/lib/stwcs/updatewcs/det2im.py
index de98e1d..a783c88 100644
--- a/lib/stwcs/updatewcs/det2im.py
+++ b/lib/stwcs/updatewcs/det2im.py
@@ -149,7 +149,7 @@ class DET2IMCorr(object):
before_key = None
for key in keys:
- hdr.update(key=key, value=values[key], comment=comments[key], before=before_key)
+ hdr.set(key, value=values[key], comment=comments[key], before=before_key)
addSciExtKw = classmethod(addSciExtKw)
diff --git a/lib/stwcs/updatewcs/npol.py b/lib/stwcs/updatewcs/npol.py
index 9346439..0427b61 100644
--- a/lib/stwcs/updatewcs/npol.py
+++ b/lib/stwcs/updatewcs/npol.py
@@ -159,7 +159,7 @@ class NPOLCorr(object):
before_key = None
for key in keys:
- hdr.update(key=key, value=values[key], comment=comments[key], before=before_key)
+ hdr.set(key, value=values[key], comment=comments[key], before=before_key)
addSciExtKw = classmethod(addSciExtKw)