summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--updatewcs/__init__.py4
-rw-r--r--updatewcs/corrections.py4
-rw-r--r--wcsutil/__init__.py13
3 files changed, 14 insertions, 7 deletions
diff --git a/updatewcs/__init__.py b/updatewcs/__init__.py
index 323b0e6..efa9287 100644
--- a/updatewcs/__init__.py
+++ b/updatewcs/__init__.py
@@ -84,11 +84,11 @@ def makecorr(fname, allowed_corr):
# Perhaps all ext headers should be corrected (to be consistent)
if extn.header.has_key('extname') and extn.header['extname'].lower() == 'sci':
ref_wcs = HSTWCS(primhdr, ref_hdr, fobj=f)
- ref_wcs.readModel(ref_hdr)
+ ref_wcs.readModel(update=True, header=ref_hdr)
hdr = extn.header
ext_wcs = HSTWCS(primhdr, hdr, fobj=f)
utils.write_archive(hdr)
- ext_wcs.readModel(hdr)
+ ext_wcs.readModel(update=True,header=hdr)
for c in allowed_corr:
if c != 'DGEOCorr':
corr_klass = corrections.__getattribute__(c)
diff --git a/updatewcs/corrections.py b/updatewcs/corrections.py
index c76e918..61f73e7 100644
--- a/updatewcs/corrections.py
+++ b/updatewcs/corrections.py
@@ -39,7 +39,9 @@ class TDDCorr(object):
ref_wcs.idcmodel.refpix['TDDALPHA'] = alpha
ref_wcs.idcmodel.refpix['TDDBETA'] = beta
- newkw = {'TDDALPHA': alpha, 'TDDBETA':beta}
+ newkw = {'TDDALPHA': alpha, 'TDDBETA':beta, 'OCX10':ext_wcs.idcmodel.cx[1,0],
+ 'OCX11':ext_wcs.idcmodel.cx[1,1],'OCY10':ext_wcs.idcmodel.cy[1,0],
+ 'OCY11':ext_wcs.idcmodel.cy[1,1],}
return newkw
updateWCS = classmethod(updateWCS)
diff --git a/wcsutil/__init__.py b/wcsutil/__init__.py
index 53133d4..8b06d7a 100644
--- a/wcsutil/__init__.py
+++ b/wcsutil/__init__.py
@@ -180,13 +180,14 @@ class HSTWCS(WCS):
def verifyKw(self):
"""verify that all required kw have meaningful values"""
- def readModel(self, header):
+ def readModel(self, update=False, header=None):
"""
Purpose
=======
Read distortion model from idc table.
Save some of the information as kw needed for interpreting the distortion
-
+ If header is provided and update is true, some IDC model kw
+ will be recorded in the header.
"""
if self.idctab == None or self.date_obs == None:
print 'idctab or date_obs not available\n'
@@ -202,8 +203,12 @@ class HSTWCS(WCS):
filter1=self.filter1, filter2=self.filter2,
offtab=self.offtab, binned=self.binned)
-
- self.updatehdr(header)
+ if update:
+ if header==None:
+ print 'Update header with IDC model kw requested but header was not provided\n.'
+ return
+ else:
+ self.updatehdr(header)
def updatehdr(self, ext_hdr, newkeywords=None):