From dfce74536e2b65362441eb9016ea3c2d90644e13 Mon Sep 17 00:00:00 2001 From: dencheva Date: Wed, 2 Nov 2011 21:59:07 +0000 Subject: 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 --- lib/stwcs/wcsutil/headerlet.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'lib/stwcs/wcsutil/headerlet.py') 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: -- cgit