def benchmark_parameter_constraints(posbound, fluxbound, groupsize, seed=0): def recipe(): return scopesim_groups(N1d=1, border=300, group_size=groupsize, group_radius=12, jitter=13, magnitude=lambda N: np.random.normal(21, 2, N), custom_subpixel_psf=epsf, seed=seed) cfg.bounds = { 'x_0': (posbound, posbound), 'y_0': (posbound, posbound), 'flux_0': (fluxbound, fluxbound) } img, tab = read_or_generate_image(f'1x{groupsize}_groups_seed{seed}', cfg, recipe) session = Session(cfg, image=img, input_table=tab) session.fitter = TRFLSQFitter() session.epsf = epsf session.determine_psf_parameters() n_calls, time = timeit.Timer(lambda: session.do_astrometry()).autorange() return {'runtime': time / n_calls}
border=70, group_size=1, group_radius=1, jitter=15, magnitude=lambda N: [20.5] * N, custom_subpixel_psf=epsf, seed=10) cfg.fithshape = 199 cfg.bounds = {'x_0': (0.3, 0.3), 'y_0': (0.3, 0.3), 'flux_0': (10000, 10000)} cfg.niters = 1 img, tab = read_or_generate_image(f'169x1_group', cfg, recipe) trialsession = Session(cfg, image=img, input_table=tab) trialsession.fitter = TRFLSQFitter() trialsession.epsf = epsf trialsession.determine_psf_parameters() trialsession.do_astrometry() # %% plot_image_with_source_and_measured(img, tab, trialsession.tables.result_table) pass # %% plot_xy_deviation(trialsession.tables.result_table) pass # %% [markdown] # # visualizing the grouper