From 9a4d14dd4842aa052251793681a2870e88aa5e94 Mon Sep 17 00:00:00 2001 From: dencheva Date: Tue, 16 Dec 2008 16:59:36 +0000 Subject: 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 --- wcsutil/__init__.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'wcsutil/__init__.py') 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 -- cgit