summaryrefslogtreecommitdiff
path: root/wcsutil/hstwcs.py
diff options
context:
space:
mode:
Diffstat (limited to 'wcsutil/hstwcs.py')
-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()