summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordencheva <dencheva@stsci.edu>2011-02-28 13:07:22 -0500
committerdencheva <dencheva@stsci.edu>2011-02-28 13:07:22 -0500
commitb20ff6909a696b14a0cc22f0af43722d21e440bb (patch)
tree8dcdb8117090bdd9d052ec1c7f1c93c704635145
parentcf0ce4626fea7173aa4997b5fedc74aefc7ed90e (diff)
downloadstwcs_hcf-b20ff6909a696b14a0cc22f0af43722d21e440bb.tar.gz
Add some IDC model parameters to header. Use header.ascard instead of cardList()
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stsci_python/trunk/stwcs@12056 fe389314-cf27-0410-b35b-8c050e845b92
-rw-r--r--wcsutil/hstwcs.py24
1 files changed, 15 insertions, 9 deletions
diff --git a/wcsutil/hstwcs.py b/wcsutil/hstwcs.py
index 9bf944f..5fe2690 100644
--- a/wcsutil/hstwcs.py
+++ b/wcsutil/hstwcs.py
@@ -257,13 +257,14 @@ class HSTWCS(WCS):
h = self.to_header()
if self.wcs.has_cd():
h = altwcs.pc2cd(h, key=self.wcskey)
-
+
+ h.ascard.extend(self._idc2hdr())
+
if sip2hdr and self.sip:
- hwcs = h.ascardlist()
cards = self._sip2hdr('a')
- hwcs.extend(cards)
+ h.ascard.extend(cards)
cards = self._sip2hdr('b')
- hwcs.extend(cards)
+ h.ascard.extend(cards)
try:
ap = self.sip.ap
@@ -276,13 +277,10 @@ class HSTWCS(WCS):
if ap:
cards = self._sip2hdr('ap')
- hwcs.extend(cards)
+ h.ascard.extend(cards)
if bp:
cards = self._sip2hdr('bp')
- hwcs.extend(cards)
-
- h = pyfits.Header(hwcs)
-
+ h.ascard.extend(cards)
return h
@@ -304,6 +302,14 @@ class HSTWCS(WCS):
cards.append(card)
return cards
+ def _idc2hdr(self):
+ # save some of the idc coefficients
+ coeffs = ['ocx10', 'ocx11', 'ocy10', 'ocy11', 'idcscale']
+ cards = pyfits.CardList()
+ for c in coeffs:
+ cards.append(pyfits.Card(key=c, value=self.__getattribute__(c)))
+ return cards
+
def pc2cd(self):
self.wcs.cd = self.wcs.pc.copy()