diff options
author | dencheva <dencheva@stsci.edu> | 2009-02-12 14:57:59 -0500 |
---|---|---|
committer | dencheva <dencheva@stsci.edu> | 2009-02-12 14:57:59 -0500 |
commit | 29e09d97fbac778ad0d216fef4b21fc189315bf4 (patch) | |
tree | a35d83a729925fdd8fe7fd29021864f395c5d414 /wcsutil/instruments.py | |
parent | 48391819c2284d83a2440b3ba7173a2e4c18354b (diff) | |
download | stwcs_hcf-29e09d97fbac778ad0d216fef4b21fc189315bf4.tar.gz |
Added support for nicmos, stis, wfc3
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/development/trunk/updatewcs@7549 fe389314-cf27-0410-b35b-8c050e845b92
Diffstat (limited to 'wcsutil/instruments.py')
-rw-r--r-- | wcsutil/instruments.py | 132 |
1 files changed, 123 insertions, 9 deletions
diff --git a/wcsutil/instruments.py b/wcsutil/instruments.py index d0ace1c..4491079 100644 --- a/wcsutil/instruments.py +++ b/wcsutil/instruments.py @@ -19,6 +19,7 @@ class InstrWCS(object): There should be a set_kw method for all kw listed in mappings.ins_spec_kw """ + self.set_detector() self.set_filter1() self.set_filter2() self.set_vafactor() @@ -29,7 +30,7 @@ class InstrWCS(object): self.set_binned() self.set_chip() self.set_parity() - self.set_detector() + def set_filter1(self): try: @@ -97,19 +98,23 @@ class ACSWCS(InstrWCS): self.exthdr = hdr InstrWCS.__init__(self,hdr0, hdr) self.set_ins_spec_kw() + + def set_detector(self): + try: + self.detector = self.primhdr['DETECTOR'] + except KeyError: + print 'ERROR: Detector kw not found.\n' + raise def set_parity(self): parity = {'WFC':[[1.0,0.0],[0.0,-1.0]], 'HRC':[[-1.0,0.0],[0.0,1.0]], 'SBC':[[-1.0,0.0],[0.0,1.0]]} - try: - detector = self.primhdr.get('detector', None) - except: - detector = None - if detector not in parity.keys(): + + if self.detector not in parity.keys(): parity = InstrWCS.set_parity(self) else: - self.parity = parity[detector] + self.parity = parity[self.detector] class WFPC2WCS(InstrWCS): @@ -129,7 +134,7 @@ class WFPC2WCS(InstrWCS): def set_filter2(self): self.filter2 = self.primhdr.get('FILTNAM2', None) if self.filter2 == " " or self.filter2 == None: - self.filter2 = 'CLEAR1' + self.filter2 = 'CLEAR2' def set_binned(self): @@ -146,4 +151,113 @@ class WFPC2WCS(InstrWCS): self.parity = [[-1.0,0.],[0.,1.0]] def set_detector(self): - self.detector = self.exthdr.get('DETECTOR', None) + try: + self.detector = self.exthdr['DETECTOR'] + except KeyError: + print 'ERROR: Detector kw not found.\n' + raise + + +class WFC3WCS(InstrWCS): + """ + Create a WFC3 detector specific class + """ + + def __init__(self, hdr0, hdr): + self.primhdr = hdr0 + self.exthdr = hdr + InstrWCS.__init__(self,hdr0, hdr) + self.set_ins_spec_kw() + + def set_detector(self): + try: + self.detector = self.primhdr['DETECTOR'] + except KeyError: + print 'ERROR: Detector kw not found.\n' + raise + + def set_filter1(self): + self.filter1 = self.primhdr.get('FILTER', None) + if self.filter1 == " " or self.filter1 == None: + self.filter1 = 'CLEAR' + + def set_filter2(self): + #Nicmos idc tables do not allow 2 filters. + self.filter2 = 'CLEAR' + + def set_parity(self): + parity = {'UVIS':[[-1.0,0.0],[0.0,1.0]], + 'IR':[[-1.0,0.0],[0.0,1.0]]} + + if self.detector not in parity.keys(): + parity = InstrWCS.set_parity(self) + else: + self.parity = parity[self.detector] + +class NICMOSWCS(InstrWCS): + """ + Create a NICMOS specific class + """ + + def __init__(self, hdr0, hdr): + self.primhdr = hdr0 + self.exthdr = hdr + InstrWCS.__init__(self,hdr0, hdr) + self.set_ins_spec_kw() + + def set_parity(self): + self.parity = [[-1.0,0.],[0.,1.0]] + + def set_filter1(self): + self.filter1 = self.primhdr.get('FILTER', None) + if self.filter1 == " " or self.filter1 == None: + self.filter1 = 'CLEAR' + + def set_filter2(self): + #Nicmos idc tables do not allow 2 filters. + self.filter2 = 'CLEAR' + """ + self.filter2 = self.primhdr.get('FILTER2', None) + if self.filter2 == " " or self.filter2 == None: + self.filter2 = 'CLEAR2' + """ + def set_chip(self): + self.chip = self.detector + + def set_detector(self): + try: + self.detector = self.primhdr['CAMERA'] + except KeyError: + print 'ERROR: Detector kw not found.\n' + raise + +class STISWCS(InstrWCS): + """ + Create a NICMOS specific class + """ + + def __init__(self, hdr0, hdr): + self.primhdr = hdr0 + self.exthdr = hdr + InstrWCS.__init__(self,hdr0, hdr) + self.set_ins_spec_kw() + + def set_parity(self): + self.parity = [[-1.0,0.],[0.,1.0]] + + def set_filter1(self): + self.filter1 = self.exthdr.get('OPT_ELEM', None) + if self.filter1 == " " or self.filter1 == None: + self.filter1 = 'CLEAR1' + + def set_filter2(self): + self.filter2 = self.exthdr.get('FILTER', None) + if self.filter2 == " " or self.filter2 == None: + self.filter2 = 'CLEAR2' + + def set_detector(self): + try: + self.detector = self.primhdr['DETECTOR'] + except KeyError: + print 'ERROR: Detector kw not found.\n' + raise
\ No newline at end of file |