astro.instrument.ConfigUpdater
index
/astro-wise/AWEHOME/AWBASE/astro/instrument/ConfigUpdater.py

Abstract base class for ConfigUpdaters per instrument that
update process parameters.
 
For each instrument a ConfigUpdater class may be defined.
 
Each updater defines the class variable "config_dict_list";
a list of dictionaries each of which looks for example like this:
 
{'class': 'BiasFrame',
 'property': 'process_params',
 'instrument': 'WFI',
 'filter': #842',
 'chip': 'ccd50'
 'SIGMA_CLIP' : 3.1}
 
specifying configuration specific for instrument, chip and filter.
 
Usage:
>>> config_updater = create_config_updater(instrument='WFI')
>>> config_updater.update(biasframe_obj, chip='ccd50')

 
Modules
       
operator

 
Classes
       
ConfigUpdater

 
class ConfigUpdater
     Methods defined here:
__init__(self)
get_list_of_instrument_specific_parameters(self, process_target)
Returns a list of all properties that are updated with instrument
specific values.
 
NOTE: if there are properties with the same name that came from a
different
get_nested_dict_of_parameters(self, process_target)
get a nested dict of parameters (dicts) for the process_target
set_user_config(self, process_target, propname, config_obj, user_config={})
user_config is a dictionary of the type e.g.:
{'BiasFrame.process_params.SIGMA_CLIP':8}
update(self, process_target, filter='', chip='', user_config={}, force_singleton=False)
Public method. Updates the given ProcessTarget object with values
appropriate for the specified filter and chip.  The instrument is
implicit because it already caused instantiation of this particular
config updater class.
force_singleton : if True database is searched for an existing object
                  with the same attributes

Data and other attributes defined here:
config_dict_list = []
special_keys = ['class', 'property', 'filter', 'chip']

 
Functions
       
filter_and_clean_dict_list(config_dict_list, key=None, value=None)
config_dict_list is a list of dictionaries. Returns a filtered list
which contains all the dictionaries that contain an item "key" with value
"value". If no matches are found the original list is returned.
 
# or: filtered_list = filter(lambda d: d.has_key(key) and d[key] == val, parameter_dict_list)
filter_dict_list(config_dict_list, key=None, value=None)
get_best_config_dict_from_list(config_dict_list, classname, propname, instrument, filter, chip)
Look for a precise match in the list of dictionaries of parameters. Look
for the most precise parameter set first (i.e. for a single chip and
particlar filter at the same time.). If this match is not found, look for
if chip is _not_ defined, l instrument, filter and chip are defined, look
for alternative:
  updated_list = filter(list, 'instrument='WFI')
  updated_list = filter(updated_list,  filter='#842')
  updated_list = filter(updated_list, chip='ccd50')