diff options
author | hack <hack@stsci.edu> | 2013-10-24 12:09:28 -0400 |
---|---|---|
committer | hack <hack@stsci.edu> | 2013-10-24 12:09:28 -0400 |
commit | 7bf60a5729ebf39854e8c38674ce31848aa39749 (patch) | |
tree | 4dbd34b165c18791e0624a896abcf050c72e00ff /lib | |
parent | d2fa46d680ca75500e77bff3593cf20c911dfe01 (diff) | |
download | stwcs_hcf-7bf60a5729ebf39854e8c38674ce31848aa39749.tar.gz |
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
Diffstat (limited to 'lib')
-rw-r--r-- | lib/stwcs/wcsutil/headerlet.py | 17 |
1 files changed, 9 insertions, 8 deletions
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') |