diff options
author | dencheva <dencheva@stsci.edu> | 2008-12-16 11:59:36 -0500 |
---|---|---|
committer | dencheva <dencheva@stsci.edu> | 2008-12-16 11:59:36 -0500 |
commit | 9a4d14dd4842aa052251793681a2870e88aa5e94 (patch) | |
tree | 37aa0b0e3c6b0257f7e0eae57d4e10c7655e801c | |
parent | 138b356640950d751f92570ba58a8ebc2ca6667e (diff) | |
download | stwcs_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
-rw-r--r-- | wcsutil/__init__.py | 10 | ||||
-rw-r--r-- | wcsutil/instruments.py | 16 |
2 files changed, 17 insertions, 9 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 diff --git a/wcsutil/instruments.py b/wcsutil/instruments.py index 092597c..d0ace1c 100644 --- a/wcsutil/instruments.py +++ b/wcsutil/instruments.py @@ -29,7 +29,7 @@ class InstrWCS(object): self.set_binned() self.set_chip() self.set_parity() - self.set_extver() + self.set_detector() def set_filter1(self): try: @@ -79,14 +79,13 @@ class InstrWCS(object): except: self.chip = 1 - def set_extver(self): - try: - self.extver = self.exthdr.get('EXTVER', 1) - except: - self.extver = 1 - def set_parity(self): self.parity = [[1.0,0.0],[0.0,-1.0]] + + def set_detector(self): + # each instrument has a different kw for detector and it can be + # in a different header, so this is to be handled by the instrument classes + pass class ACSWCS(InstrWCS): """ @@ -146,4 +145,5 @@ class WFPC2WCS(InstrWCS): def set_parity(self): self.parity = [[-1.0,0.],[0.,1.0]] - + def set_detector(self): + self.detector = self.exthdr.get('DETECTOR', None) |