From a63823aa04550a3423f25d9b656a4c80a34cbd6f Mon Sep 17 00:00:00 2001 From: dencheva Date: Wed, 2 Mar 2011 18:28:58 +0000 Subject: 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 --- wcsutil/hstwcs.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'wcsutil/hstwcs.py') 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): -- cgit