def _calc_fom(model, vec, par_funcs): ''' Function to calcuate the figure of merit for parameter vector vec. ''' # Set the paraemter values map(lambda func, value:func(value), par_funcs, vec) return model.evaluate_fit_func()
def parallel_calc_fom(vec): '''parallel_calc_fom(vec) --> fom (float) function that is used to calculate the fom in a parallel process. It is a copy of calc_fom in the DiffEv class ''' global model, par_funcs #print 'Trying to set parameters' # set the parameter values in the model map(lambda func, value:func(value), par_funcs, vec) #print 'Trying to evaluate' # evaluate the model and calculate the fom fom = model.evaluate_fit_func() return fom