diff options
author | dencheva <dencheva@stsci.edu> | 2011-03-02 13:28:58 -0500 |
---|---|---|
committer | dencheva <dencheva@stsci.edu> | 2011-03-02 13:28:58 -0500 |
commit | a63823aa04550a3423f25d9b656a4c80a34cbd6f (patch) | |
tree | 27daf85eab48cb838da1f62b7a991ac2413acf37 /wcsutil/hstwcs.py | |
parent | 932d650c0f1044861b1c1eea68304728386ca233 (diff) | |
download | stwcs_hcf-a63823aa04550a3423f25d9b656a4c80a34cbd6f.tar.gz |
More changes to go with r12056
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stsci_python/trunk/stwcs@12069 fe389314-cf27-0410-b35b-8c050e845b92
Diffstat (limited to 'wcsutil/hstwcs.py')
-rw-r--r-- | wcsutil/hstwcs.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/wcsutil/hstwcs.py b/wcsutil/hstwcs.py index 20db803..8e7a71f 100644 --- a/wcsutil/hstwcs.py +++ b/wcsutil/hstwcs.py @@ -242,7 +242,7 @@ class HSTWCS(WCS): else: self._updatehdr(header) - def wcs2header(self, sip2hdr=False): + def wcs2header(self, sip2hdr=False, idc2hdr=True): """ Create a pyfits.Header object from WCS keywords. @@ -258,7 +258,8 @@ class HSTWCS(WCS): if self.wcs.has_cd(): h = altwcs.pc2cd(h, key=self.wcskey) - h.ascard.extend(self._idc2hdr()) + if idc2hdr: + h.ascard.extend(self._idc2hdr()) try: del h.ascard['RESTFRQ'] @@ -312,7 +313,11 @@ class HSTWCS(WCS): coeffs = ['ocx10', 'ocx11', 'ocy10', 'ocy11', 'idcscale'] cards = pyfits.CardList() for c in coeffs: - cards.append(pyfits.Card(key=c, value=self.__getattribute__(c))) + try: + val = self.__getattribute__(c) + except AttributeError: + continue + cards.append(pyfits.Card(key=c, value=val)) return cards def pc2cd(self): |