summaryrefslogtreecommitdiff
path: root/wcsutil/__init__.py
diff options
context:
space:
mode:
authordencheva <dencheva@stsci.edu>2008-12-16 11:59:36 -0500
committerdencheva <dencheva@stsci.edu>2008-12-16 11:59:36 -0500
commit9a4d14dd4842aa052251793681a2870e88aa5e94 (patch)
tree37aa0b0e3c6b0257f7e0eae57d4e10c7655e801c /wcsutil/__init__.py
parent138b356640950d751f92570ba58a8ebc2ca6667e (diff)
downloadstwcs_hcf-9a4d14dd4842aa052251793681a2870e88aa5e94.tar.gz
Added logic to handle the 'DETECTOR' kw
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/development/trunk/hstwcs@7382 fe389314-cf27-0410-b35b-8c050e845b92
Diffstat (limited to 'wcsutil/__init__.py')
-rw-r--r--wcsutil/__init__.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/wcsutil/__init__.py b/wcsutil/__init__.py
index 40a3649..c43f86e 100644
--- a/wcsutil/__init__.py
+++ b/wcsutil/__init__.py
@@ -117,7 +117,15 @@ class HSTWCS(WCS):
inst_kl = instruments.__dict__[inst_kl]
insobj = inst_kl(prim_hdr, ext_hdr)
for key in self.inst_kw:
- self.__setattr__(key, insobj.__getattribute__(key))
+ try:
+ self.__setattr__(key, insobj.__getattribute__(key))
+ except AttributeError:
+ # Some of the instrument's attributes are recorded in the primary header and
+ # were already set, (e.g. 'DETECTOR'), the code below is a check for that case.
+ if not self.__getattribute__(key):
+ print '%s object has no attribute %s' % (insobj.__class__.__name__, key)
+ else:
+ raise
else:
raise KeyError, "Unsupported instrument - %s" %self.instrument