diff options
author | embray <embray@stsci.edu> | 2011-04-06 10:20:52 -0400 |
---|---|---|
committer | embray <embray@stsci.edu> | 2011-04-06 10:20:52 -0400 |
commit | da2184b6d431d1aa18fa081e7685701a90c13a3b (patch) | |
tree | 2960725ada3453ffe19161f454110cc0e4f58e6e /wcsutil/hstwcs.py | |
parent | 616fc9ebf3632fb885e139f343ccf8fc1017a21b (diff) | |
download | stwcs_hcf-da2184b6d431d1aa18fa081e7685701a90c13a3b.tar.gz |
Updated `update_wcscorr()` to be more flexible and general-purpose. It can
now apply WCS keywords to the WCSCORR table even from extensions in a different
file from the one containing the WCSCORR table. This might break any existing
code using either it, or `archive_wcs_file()`.`
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stsci_python/trunk/stwcs@12397 fe389314-cf27-0410-b35b-8c050e845b92
Diffstat (limited to 'wcsutil/hstwcs.py')
-rw-r--r-- | wcsutil/hstwcs.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/wcsutil/hstwcs.py b/wcsutil/hstwcs.py index d16e174..26dad5d 100644 --- a/wcsutil/hstwcs.py +++ b/wcsutil/hstwcs.py @@ -50,22 +50,24 @@ class HSTWCS(WCS): self.minerr = minerr self.wcskey = wcskey - if fobj != None: - filename, hdr0, ehdr, phdu = getinput.parseSingleInput(f=fobj, ext=ext) + if fobj is not None: + filename, hdr0, ehdr, phdu = getinput.parseSingleInput(f=fobj, + ext=ext) self.filename = filename instrument_name = hdr0.get('INSTRUME', 'DEFAULT') if instrument_name in ['IRAF/ARTDATA','',' ','N/A']: self.instrument = 'DEFAULT' else: self.instrument = instrument_name - WCS.__init__(self, ehdr, fobj=phdu, minerr=self.minerr, key=self.wcskey) + WCS.__init__(self, ehdr, fobj=phdu, minerr=self.minerr, + key=self.wcskey) # 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.readIDCCoeffs(ehdr) - extname = ehdr.get('EXTNAME', "") + extname = ehdr.get('EXTNAME', '') extnum = ehdr.get('EXTVER', None) self.extname = (extname, extnum) else: @@ -262,7 +264,7 @@ class HSTWCS(WCS): if idc2hdr: for card in self._idc2hdr(): - h.update(card.key,value=card.value,comment=card.comment) + h.update(card.key,value=card.value,comment=card.comment) try: del h.ascard['RESTFRQ'] del h.ascard['RESTWAV'] @@ -273,7 +275,7 @@ class HSTWCS(WCS): h.update(card.key,value=card.value,comment=card.comment) for card in self._sip2hdr('b'): h.update(card.key,value=card.value,comment=card.comment) - + try: ap = self.sip.ap except AssertionError: |