"noise_level": noise_level, "show_legend": True, "show_title": True, "show_next_point": False, "show_acq_func": True } ############################################################################# # We run a an optimization loop with standard settings for i in range(30): next_x = opt.ask() f_val = objective(next_x) opt.tell(next_x, f_val) # The same output could be created with opt.run(objective, n_iter=30) _ = plot_gaussian_process(opt.get_result(), **plot_args) ############################################################################# # We see that some minima is found and "exploited" # # Now lets try to set kappa and xi using'to other values and # pass it to the optimizer: acq_func_kwargs = {"xi": 10000, "kappa": 10000} ############################################################################# opt = Optimizer([(-2.0, 2.0)], "GP", n_initial_points=3, acq_optimizer="sampling", acq_func_kwargs=acq_func_kwargs) #############################################################################
print(f'Evaluation #{i}') print(args) print('#######') jobs.append(Job(p.apply_async(objective, args), args)) for job in jobs: if job.result.ready(): optimizer.tell(job.args, job.result.get()) jobs.remove(job) while sum(map(not_ready, jobs)) >= n_procs: time.sleep(0.5) for job in jobs: optimizer.tell(job.args, job.result.get()) except KeyboardInterrupt: pass res = optimizer.get_result() with open(result_filename, 'wb') as f: dill.dump(optimizer, f) threshold, fwhm, sigma_radius, roundlo, roundhi, sharplo, sharphi = res.x res_table = DAOStarFinder(threshold=median + std * threshold, fwhm=fwhm, sigma_radius=sigma_radius, sharplo=sharplo, sharphi=sharphi, roundlo=roundlo, roundhi=roundhi, exclude_border=True)(img) plt.ion()