Factory
factory is an object which has one method to build each object of the library. All these methods name has the same prefix,
get_, and a suffix that is the name of the class. The method needs one or more dictionaries of parameters and return the object. If the perameters of the dictionary refers to data save on disk the factory uses the
calibration manager object to restore the data.
Example of get_ method for the atmo_evolution processing object
;+
; Builds an `atmo_evolution` processing object.
;
; :params:
; params: in, required, type=dictionary or struct
; dictionary or struct of parameters
; source_list: in, required, type=list
; list of `source` objects
;
; :returns:
; a new `atmo_evolution` processing object
;-
function factory::get_atmo_evolution, params, source_list
; checks the parameters and convert it to a dictionary if needed
params = self.ensure_dictionary(params)
; extracts some parameters from the main dictionary
pixel_pup = self._main.pixel_pupil
pixel_pitch = self._main.pixel_pitch
precision = self._main.precision
; removes some parameters from the dictionary (some have defaul values if they are not defined)
L0 = params.remove('L0')
wavelengthInNm = params.remove('wavelengthInNm')
heights = params.remove('heights')
Cn2 = params.remove('Cn2')
pixel_phasescreens = self.extract(params, 'pixel_phasescreens', default=!NULL)
seed = self.extract(params, 'seed', default=1)
; extracts the directory name from the calibration manager
directory = self._cm.root_subdir('phasescreen')
; makes the object
atmo_evolution = obj_new('atmo_evolution', L0, wavelengthInNm, pixel_pitch, heights, Cn2, $
pixel_pup, directory, source_list, $
pixel_phasescreens = pixel_phasescreens, $
precision=precision, seed=seed)
; applies other parameters, not previously extracted/removed, to the new object
self.apply_global_params, atmo_evolution
atmo_evolution.apply_properties, params
; returns the new object
return, atmo_evolution
end
--
GuidoAgapito - 21 Aug 2018