From 5e93d4410f7887026497292256b85b27336da486 Mon Sep 17 00:00:00 2001 From: dencheva Date: Mon, 16 Mar 2009 15:02:46 +0000 Subject: 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 --- wcsutil/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'wcsutil/__init__.py') 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 -- cgit