summaryrefslogtreecommitdiff
path: root/wcsutil/headerlet.py
diff options
context:
space:
mode:
authordencheva <dencheva@stsci.edu>2011-06-03 13:26:12 -0400
committerdencheva <dencheva@stsci.edu>2011-06-03 13:26:12 -0400
commit34d481a4b7572525320db4fbe3eb29a357dc2b56 (patch)
treee81a436d064def431c56210831d5cbf239a6edcf /wcsutil/headerlet.py
parent7834819cabce695df36b28a25a8561d8104a8a23 (diff)
downloadstwcs_hcf-34d481a4b7572525320db4fbe3eb29a357dc2b56.tar.gz
Addresses #713
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stsci_python/trunk/stwcs@13049 fe389314-cf27-0410-b35b-8c050e845b92
Diffstat (limited to 'wcsutil/headerlet.py')
-rw-r--r--wcsutil/headerlet.py29
1 files changed, 22 insertions, 7 deletions
diff --git a/wcsutil/headerlet.py b/wcsutil/headerlet.py
index a88b20a..f4c4691 100644
--- a/wcsutil/headerlet.py
+++ b/wcsutil/headerlet.py
@@ -254,7 +254,7 @@ def createHeaderlet(fname, hdrname, destim=None, output=None, verbose=False, log
try:
h.append(fhdr['AXISCORR'])
except KeyError:
- module_logger.exception("Required keyword AXISCORR was not found in "
+ module_logger.exception("'D2IMFILE' kw exists but keyword 'AXISCORR' was not found in "
"%s['SCI',%d]" % (fname, e))
raise
@@ -427,9 +427,23 @@ class Headerlet(pyfits.HDUList):
self.d2imerr = 0
self.axiscorr = 1
- def apply(self, dest, createheaderlet=True, hdrname=None):
+ def apply(self, dest, createheaderlet=True, hdrname=None, attach=True):
"""
Apply this headerlet to a file.
+
+ Parameters
+ ----------
+ dest: string
+ Name of file to which to apply the WCS in the headerlet
+ hdrname: string
+ A unique name for the headerlet
+ createheaderlet: boolean
+ A flag which indicates if a headerlet should be created
+ from the old WCS and attached to the science file (default: True)
+ attach: boolean, default: True
+ By default the headerlet being applied will be attached
+ as an extension to the science file. Set 'attach' to False
+ to disable this.
"""
self.hverify()
if self.verify_dest(dest):
@@ -506,11 +520,12 @@ class Headerlet(pyfits.HDUList):
# Append the original headerlet
if createheaderlet and orig_hlt_hdu:
fobj.append(orig_hlt_hdu)
-
- # Finally, append an HDU for this headerlet
- new_hlt = HeaderletHDU.fromheaderlet(self)
- new_hlt.update_ext_version(numhlt + 1)
- fobj.append(new_hlt)
+
+ 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)
if close_dest:
fobj.close()