diff options
author | dencheva <dencheva@stsci.edu> | 2009-03-16 11:02:46 -0400 |
---|---|---|
committer | dencheva <dencheva@stsci.edu> | 2009-03-16 11:02:46 -0400 |
commit | 5e93d4410f7887026497292256b85b27336da486 (patch) | |
tree | cefa5fd13b00e31332b87fa9618cc5c1a93ae04f | |
parent | 1f850c0be43570129d71eed6d4ff3a2a9e1d5e02 (diff) | |
download | stwcs_hcf-5e93d4410f7887026497292256b85b27336da486.tar.gz |
If input is not a pyfits.HDUList object close it, otherwise it's the user's responsibility to close it.
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/development/trunk/updatewcs@7762 fe389314-cf27-0410-b35b-8c050e845b92
-rw-r--r-- | wcsutil/__init__.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/wcsutil/__init__.py b/wcsutil/__init__.py index fb38c30..2da3ac0 100644 --- a/wcsutil/__init__.py +++ b/wcsutil/__init__.py @@ -53,7 +53,11 @@ class HSTWCS(WCS): self.filename = filename self.setHDR0kw(hdr0, ehdr) WCS.__init__(self, ehdr, fobj=phdu) - + # If input was a pyfits HDUList object, it's the user's + # responsibility to close it, otherwise, it's closed here. + if not isinstance(fobj, pyfits.HDUList): + phdu.close() + self.setInstrSpecKw(hdr0, ehdr) self.setPscale() self.setOrient() @@ -68,6 +72,7 @@ class HSTWCS(WCS): self.detector = detector self.setInstrSpecKw() + def parseInput(self, f=None, ext=None): if isinstance(f, str): # create an HSTWCS object from a filename |