From 7bf60a5729ebf39854e8c38674ce31848aa39749 Mon Sep 17 00:00:00 2001 From: hack Date: Thu, 24 Oct 2013 16:09:28 +0000 Subject: Fixed a bug introduced in r26987 to the headerlet module that caused headerlet.apply_as_primary to fail when the headerlet was created directly using the Headerlet class and an HDUList as input. git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stwcs/trunk@26990 fe389314-cf27-0410-b35b-8c050e845b92 --- lib/stwcs/wcsutil/headerlet.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'lib/stwcs/wcsutil') diff --git a/lib/stwcs/wcsutil/headerlet.py b/lib/stwcs/wcsutil/headerlet.py index 935b280..0cad22a 100644 --- a/lib/stwcs/wcsutil/headerlet.py +++ b/lib/stwcs/wcsutil/headerlet.py @@ -1098,8 +1098,9 @@ def create_headerlet(filename, sciext='SCI', hdrname=None, destim=None, if close_file: fobj.close() - return Headerlet(hdul, logging=logging, logmode='a') - + hlet = Headerlet(hdul, logging=logging, logmode='a') + hlet.init_attrs() + return hlet @with_logging def apply_headerlet_as_primary(filename, hdrlet, attach=True, archive=True, @@ -1228,10 +1229,9 @@ def delete_headerlet(filename, hdrname=None, hdrext=None, distname=None, Parameters ---------- - filename: string or HDUList - Filename can be specified as a single filename or HDUList, a comma-separated - list of filenames, a wild-card filename (e.g., 'j6q*flt.fits') or - '@-file'. + filename: string, HDUList or list of strings + Filename can be specified as a single filename or HDUList, or + a list of filenames Each input filename (str) will be expanded as necessary to interpret any environmental variables included in the filename. hdrname: string or None @@ -1245,9 +1245,10 @@ def delete_headerlet(filename, hdrname=None, hdrext=None, distname=None, enable file logging logmode: 'a' or 'w' """ - fnames = parseinput.parseinput(filename)[0] + if not isinstance(filename, list): + filename = [filename] - for f in fnames: + for f in filename: print "Deleting Headerlet from ",f _delete_single_headerlet(f, hdrname=hdrname, hdrext=hdrext, distname=distname, logging=logging, logmode='a') -- cgit