def main(): config = parse_args() shutil.copy(config.ffcini, SAVED_INI_FFC_FILE) shutil.copy(config.idmini, SAVED_INI_IDM_FILE) opt = FeatureFinderOptimiser(config) opt1 = IDMapperOptimiser(config) # opt.write_config(opt.working_ini_file) # output = opt.run_program() # res = opt.get_result(output) # print(res) best_opt = 0 best_opt1 = 0 increased = True while increased: increased = False new_opt = opt.run() new_opt1 = opt1.run() if best_opt < new_opt: best_opt = new_opt increased = True if best_opt1 < new_opt1: best_opt1 = new_opt1 increased = True
def get_result(self, output, i): m = re.search(r"FeatureFinderCentroided took (\d*\.?\d*) s \(wall\)", output) if m: t = float(m.group(1)) else: m = re.search(r"FeatureFinderCentroided took (\d\d):(\d\d) m \(wall\)", output) if m: t = float(m.group(1)) * 60 + float(m.group(2)) else: raise Exception("No result") opt = IDMapperOptimiser(self.config) opt.write_config(opt.working_ini_file) args = opt.get_args(i) output = opt.run_program(args, False) return {'value': opt.get_result(output, i), 'time': t}