summaryrefslogtreecommitdiff
path: root/lib/stwcs/wcsutil/headerlet.py
diff options
context:
space:
mode:
authordencheva <dencheva@stsci.edu>2011-11-02 17:59:07 -0400
committerdencheva <dencheva@stsci.edu>2011-11-02 17:59:07 -0400
commitdfce74536e2b65362441eb9016ea3c2d90644e13 (patch)
treea98e0c9e6f62292cb576d670c000523c4a2a3ebe /lib/stwcs/wcsutil/headerlet.py
parent4210c859424d4216d86b12326c9ee2b77cc89627 (diff)
downloadstwcs_hcf-dfce74536e2b65362441eb9016ea3c2d90644e13.tar.gz
Do not attach headerlet if it is already attached
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stsci_python/trunk/stwcs@13941 fe389314-cf27-0410-b35b-8c050e845b92
Diffstat (limited to 'lib/stwcs/wcsutil/headerlet.py')
-rw-r--r--lib/stwcs/wcsutil/headerlet.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/stwcs/wcsutil/headerlet.py b/lib/stwcs/wcsutil/headerlet.py
index 349168b..4725a29 100644
--- a/lib/stwcs/wcsutil/headerlet.py
+++ b/lib/stwcs/wcsutil/headerlet.py
@@ -1777,7 +1777,6 @@ class Headerlet(pyfits.HDUList):
hdrname = fobj[0].header['ROOTNAME'] + '_orig'
wcsname = None
wcskey = ' '
- print 'hdrname in primary', hdrname
# Check the HDRNAME for all current headerlet extensions
# to see whether this PRIMARY WCS has already been appended
wcsextn = self[1].header['SCIEXT']
@@ -1785,6 +1784,7 @@ class Headerlet(pyfits.HDUList):
wcsextn = int(wcsextn)
except ValueError:
wcsextn = fu.parseExtn(wcsextn)
+
if hdrname not in hdrlet_extnames:
# - if WCS has not been saved, write out WCS as headerlet extension
# Create a headerlet for the original Primary WCS data in the file,
@@ -1914,10 +1914,7 @@ class Headerlet(pyfits.HDUList):
fobj.append(ahdu)
if attach:
# Finally, append an HDU for this headerlet
- new_hlt = HeaderletHDU.fromheaderlet(self)
- new_hlt.update_ext_version(numhlt + 1)
- fobj.append(new_hlt)
-
+ self.attach_to_file(fobj)
if close_dest:
fobj.close()
else: