def evaluate_fitness(self, candidate, args):
     self.update_cell(candidate)
     v_candidate, t_candidate = iclamp(self.cell, **self.simulation_params)
     #self.data_to_fit = [0]  # TODO !!!!
     #self.args['candidate'] = candidate  # TODO
     vars_to_fit = [fitfun(v_candidate, t_candidate, self.simulation_params['i_inj'], self.args)
                    for fitfun in self.fitfuns]
     num_nones = 0
     fitness = 0
     for i in range(len(vars_to_fit)):
         if vars_to_fit[i] is None:
             num_nones += 1
         else:
             fitness += self.fitnessweights[i] * self.errfun(vars_to_fit[i], self.data_to_fit[i])
     if num_nones == len(vars_to_fit):
         return float("inf")
     return fitness
Exemple #2
0
 def simulate(self):
     return iclamp(self.fitter.cell, **self.fitter.simulation_params)
 def simulate_cell(self, candidate):
     self.update_cell(candidate)
     v_candidate, t_candidate = iclamp(self.cell, **self.simulation_params)
     return v_candidate, t_candidate, self.simulation_params['i_inj']