Пример #1
0
 def filter_name(self, dataset, stripID=False, pretty=False, **args):
     if pretty:
         # To match against the lookup table to get the pretty name, we
         # need the component IDs attached
         stripID = False
     
     # Determine the three filter name keyword from the global keyword
     # dictionary
     keyword1 = self.get_descriptor_key("key_filter1")
     keyword2 = self.get_descriptor_key("key_filter2")
     keyword3 = self.get_descriptor_key("key_filter3")
     
     # Get the values of the three filter name keywords from the header of
     # the PHU
     filter1 = dataset.phu_get_key_value(keyword1)
     filter2 = dataset.phu_get_key_value(keyword2)
     filter3 = dataset.phu_get_key_value(keyword3)
     
     if filter1 is None or filter2 is None or filter3 is None:
         # The phu_get_key_value() function returns None if a value cannot
         # be found and stores the exception info. Re-raise the exception.
         # It will be dealt with by the CalculatorInterface.
         if hasattr(dataset, "exception_info"):
             raise dataset.exception_info
     
     if stripID:
         filter1 = gmu.removeComponentID(filter1)
         filter2 = gmu.removeComponentID(filter2)
         filter3 = gmu.removeComponentID(filter3)
     
     # Create list of filter values
     filters = [filter1, filter2, filter3]
     
     if pretty:
         # To match against the lookup table, the filter list must be sorted
         filters.sort()
         filter_name = gmu.filternameFrom(filters)
         if filter_name in self.niriFilternameMap:
             ret_filter_name = str(self.niriFilternameMap[filter_name])
         else:
             ret_filter_name = str(filter_name)
     else:
         ret_filter_name = gmu.filternameFrom(filters)
     
     # Instantiate the return DescriptorValue (DV) object
     ret_dv = DescriptorValue(ret_filter_name, name="filter_name",
                              ad=dataset)
     return ret_dv
Пример #2
0
 def __init__(self):
     self.niriSpecDict = Lookups.get_lookup_table(
         "Gemini/NIRI/NIRISpecDict", "niriSpecDict")
     self.niriFilternameMapConfig = Lookups.get_lookup_table(
         "Gemini/NIRI/NIRIFilterMap", "niriFilternameMapConfig")
     self.nsappwave = Lookups.get_lookup_table(
         "Gemini/IR/nsappwavepp.fits", 1)
     
     filternamemap = {}
     for line in self.niriFilternameMapConfig:
         linefiltername = gmu.filternameFrom([line[1], line[2], line[3]])
         filternamemap.update({linefiltername:line[0]})
     self.niriFilternameMap = filternamemap
     
     GEMINI_DescriptorCalc.__init__(self)