diff options
author | hack <hack@stsci.edu> | 2011-04-29 11:50:32 -0400 |
---|---|---|
committer | hack <hack@stsci.edu> | 2011-04-29 11:50:32 -0400 |
commit | 60bed196174249ac28b0e2d5428d5a2179d9f95a (patch) | |
tree | 65b9b7ec8b008ddcf450b801b307858d98101897 /updatewcs/__init__.py | |
parent | 6530910dc0f88dcd4daa710b8180d70f4040ccbe (diff) | |
download | stwcs_hcf-60bed196174249ac28b0e2d5428d5a2179d9f95a.tar.gz |
A couple of small updates to STWCS.UPDATEWCS which avoid problems when working with NICMOS and WFPC2 data; specifically, avoiding applying TDD correction to non-ACS data and updating the header with the UPWCSVER keyword when no HISTORY keywords are present. The changes were tested manually against ACS/WFC data (with and without TDD corrections), WFPC2 image, and a NICMOS image.
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stsci_python/trunk/stwcs@12684 fe389314-cf27-0410-b35b-8c050e845b92
Diffstat (limited to 'updatewcs/__init__.py')
-rw-r--r-- | updatewcs/__init__.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/updatewcs/__init__.py b/updatewcs/__init__.py index 10bba90..c98e67f 100644 --- a/updatewcs/__init__.py +++ b/updatewcs/__init__.py @@ -180,7 +180,19 @@ def makecorr(fname, allowed_corr, wkey=" ", wname=" ", clobber=False): for kw in kw2update: f[1].header.update(kw, kw2update[kw]) # Finally record the version of the software which updated the WCS - f[0].header.update(key='UPWCSVER', value=stwcsversion, comment="Version of STWCS used to updated the WCS", before='HISTORY') + if f[0].header.has_key('HISTORY'): + f[0].header.update(key='UPWCSVER', value=stwcsversion, + comment="Version of STWCS used to updated the WCS", before='HISTORY') + elif f[0].header.has_key('ASN_MTYP'): + f[0].header.update(key='UPWCSVER', value=stwcsversion, + comment="Version of STWCS 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.ascard)-1,0,-1): + if f[0].header[i].strip() != '': break + + f[0].header.update(key='UPWCSVER', value=stwcsversion, + comment="Version of STWCS used to updated the WCS",after=i) f.close() def getKeyName(hdr, wkey, wname, idcname): |