def parallel_init(model_copy): '''parallel_init(model_copy) --> None parallel initilization of a pool of processes. The function takes a pickle safe copy of the model and resets the script module and the compiles the script and creates function to set the variables. ''' global model, par_funcs model = model_copy model._reset_module() model.simulate() (par_funcs, start_guess, par_min, par_max) = model.get_fit_pars()
def connect_model(self, model): '''connect_model(self, model) --> None Connects the model [model] to this object. Retrives the function that sets the variables and stores a reference to the model. ''' # Retrive parameters from the model (par_funcs, start_guess, par_min, par_max) = model.get_fit_pars() # Control parameter setup self.par_min = array(par_min) self.par_max = array(par_max) self.par_funcs = par_funcs self.model = model self.n_dim = len(par_funcs) if not self.setup_ok: self.start_guess = start_guess