summaryrefslogtreecommitdiff
path: root/lib/stwcs/wcsutil/hstwcs.py
diff options
context:
space:
mode:
authordencheva <dencheva@stsci.edu>2015-05-29 11:07:47 -0400
committerdencheva <dencheva@stsci.edu>2015-05-29 11:07:47 -0400
commit8effc9a9897ffc5767d022fadb74d68dbf00c378 (patch)
tree4621cbccee8416b01a751d99bad6a7b41aaf7dfe /lib/stwcs/wcsutil/hstwcs.py
parent5d85267c6eb4f6cacaa10e1c0439ad8b5778adaa (diff)
downloadstwcs_hcf-8effc9a9897ffc5767d022fadb74d68dbf00c378.tar.gz
Add RADESYS to headers. Fixed cleanWCS which was trying to delete WCS keywords from the primary header and raising an error. Resolves #1173.
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stwcs/trunk@40546 fe389314-cf27-0410-b35b-8c050e845b92
Diffstat (limited to 'lib/stwcs/wcsutil/hstwcs.py')
-rw-r--r--lib/stwcs/wcsutil/hstwcs.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/stwcs/wcsutil/hstwcs.py b/lib/stwcs/wcsutil/hstwcs.py
index a71c33a..bda6561 100644
--- a/lib/stwcs/wcsutil/hstwcs.py
+++ b/lib/stwcs/wcsutil/hstwcs.py
@@ -142,6 +142,10 @@ class HSTWCS(WCS):
self.instrument = 'DEFAULT'
else:
self.instrument = instrument_name
+ # Set the correct reference frame
+ refframe = determine_refframe(hdr0)
+ ehdr['RADESYS'] = refframe
+
WCS.__init__(self, ehdr, fobj=phdu, minerr=self.minerr,
key=self.wcskey)
if self.instrument == 'DEFAULT':
@@ -960,3 +964,25 @@ adaptive=False, detect_divergence=False, quiet=False)
print('NAXIS : %d %d' % (self.naxis1, self.naxis2))
print('Plate Scale : %r' % self.pscale)
print('ORIENTAT : %r' % self.orientat)
+
+
+def determine_refframe(phdr):
+ """
+ Determine the reference frame in standard FITS WCS terms.
+
+ Parameters
+ ----------
+ phdr : `astropy.io.fits.Header`
+ Primary Header of an HST observation
+
+ In HST images the reference frame is recorded in the primary extension as REFFRAME.
+ Values are "GSC1" which means FK5 or ICRS (for GSC2 observations).
+ """
+ try:
+ refframe = phdr['REFFRAME']
+ except KeyError:
+ refframe = " "
+ if refframe == "GSC1":
+ refframe = "FK5"
+ return refframe
+