summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhack <hack@stsci.edu>2014-05-23 16:05:51 -0400
committerhack <hack@stsci.edu>2014-05-23 16:05:51 -0400
commit664676db3ae5fb278b8026e5d90834dd6aced4aa (patch)
treeb100b622208771ec29116123c69ea22e6a42e080
parent3e30b1900c4181ca0091bc887c677efd7e7f7df4 (diff)
downloadstwcs_hcf-664676db3ae5fb278b8026e5d90834dd6aced4aa.tar.gz
STWCS v1.2.1: This version fixes a typo in altwcs._restore(), adds TDD_CYA and TDD_CYB as new header keywords for 2014 TDD correction, and updated _restore() to reset those keywords to 0.0 everytime so that if TDDCORR=OMIT, it will be obvious.
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stwcs/trunk@31920 fe389314-cf27-0410-b35b-8c050e845b92
-rw-r--r--lib/stwcs/updatewcs/corrections.py7
-rw-r--r--lib/stwcs/updatewcs/utils.py9
-rw-r--r--lib/stwcs/wcsutil/altwcs.py6
-rw-r--r--setup.cfg2
4 files changed, 17 insertions, 7 deletions
diff --git a/lib/stwcs/updatewcs/corrections.py b/lib/stwcs/updatewcs/corrections.py
index f9e0b38..d6d2954 100644
--- a/lib/stwcs/updatewcs/corrections.py
+++ b/lib/stwcs/updatewcs/corrections.py
@@ -73,7 +73,9 @@ class TDDCorr(object):
cls.apply_tdd2idc2(ext_wcs)
newkw = {'TDDALPHA': None, 'TDDBETA':None, '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],}
+ 'OCY11':ext_wcs.idcmodel.cy[1,1],
+ 'TDD_CYA':ext_wcs.idcmodel.refpix['skew_coeffs']['TDD_CY_ALPHA'],
+ 'TDD_CYB':ext_wcs.idcmodel.refpix['skew_coeffs']['TDD_CY_BETA']}
else:
alpha, beta = cls.compute_alpha_beta(ext_wcs)
@@ -86,7 +88,8 @@ class TDDCorr(object):
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],}
+ 'OCY11':ext_wcs.idcmodel.cy[1,1],
+ 'TDD_CYA':None, 'TDD_CYB':None}
return newkw
updateWCS = classmethod(updateWCS)
diff --git a/lib/stwcs/updatewcs/utils.py b/lib/stwcs/updatewcs/utils.py
index 7bdd6fe..e5f4deb 100644
--- a/lib/stwcs/updatewcs/utils.py
+++ b/lib/stwcs/updatewcs/utils.py
@@ -137,8 +137,10 @@ def build_sipname(fobj, fname=None, sipname=None):
"""
try:
idctab = fobj[0].header['IDCTAB']
+ idcname = extract_rootname(idctab,suffix='_idc')
except KeyError:
idctab = 'N/A'
+ idcname= 'N/A'
if not fname:
try:
fname = fobj.filename()
@@ -147,15 +149,16 @@ def build_sipname(fobj, fname=None, sipname=None):
if not sipname:
try:
sipname = fobj[0].header["SIPNAME"]
+ if idcname == 'N/A' or idcname not in sipname:
+ raise KeyError
except KeyError:
- try:
- idcname = extract_rootname(fobj[0].header["IDCTAB"],suffix='_idc')
+ if idcname != 'N/A':
try:
rootname = fobj[0].header['rootname']
except KeyError:
rootname = fname
sipname = rootname +'_'+ idcname
- except KeyError:
+ else:
if 'A_ORDER' in fobj[1].header or 'B_ORDER' in fobj[1].header:
sipname = 'UNKNOWN'
else:
diff --git a/lib/stwcs/wcsutil/altwcs.py b/lib/stwcs/wcsutil/altwcs.py
index 71588f4..befa2bb 100644
--- a/lib/stwcs/wcsutil/altwcs.py
+++ b/lib/stwcs/wcsutil/altwcs.py
@@ -428,10 +428,14 @@ def _restore(fobj, ukey, fromextnum,
continue
if key == 'O' and 'TDDALPHA' in fobj[toextension].header:
fobj[toextension].header['TDDALPHA'] = 0.0
- fobj[toeztension].header['TDDBETA'] = 0.0
+ fobj[toextension].header['TDDBETA'] = 0.0
if 'ORIENTAT' in fobj[toextension].header:
norient = np.rad2deg(np.arctan2(hwcs['CD1_2'+'%s' %ukey], hwcs['CD2_2'+'%s' %ukey]))
fobj[toextension].header['ORIENTAT'] = norient
+ # Reset 2014 TDD keywords prior to computing new values (if any are computed)
+ for kw in ['TDD_CYA','TDD_CYB']:
+ if kw in fobj[toextension].header:
+ fobj[toextension].header[kw] = 0.0
#header operations
def _check_headerpars(fobj, ext):
diff --git a/setup.cfg b/setup.cfg
index 667ba60..2b9af68 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,6 +1,6 @@
[metadata]
name = stwcs
-version = 1.2.0.dev
+version = 1.2.1.dev
author = Nadia Dencheva, Warren Hack
author-email = help@stsci.edu
summary = Recomputes the WCS of an HST observation and puts all distortion