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}
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 # %% rng = np.random.default_rng(seed=11) model = make_anisocado_model()
figa = plots.plot_xy_deviation(result_table_multi_conv) figb = plots.plot_xy_deviation(result_table_multi_subpixel) # %% lowpass_config.oversampling = 2 lowpass_config.cutout_size = 40 lowpass_config.fitshape = 25 #session_std = Session(lowpass_config, 'scopesim_grid_16_perturb2_mag18_24') #session_known_psf = Session(lowpass_config, 'scopesim_grid_16_perturb2_mag18_24') session_std = Session(lowpass_config, 'gausscluster_N2000_mag22_subpixel') session_known_psf = Session(lowpass_config, 'gausscluster_N2000_mag22_subpixel') session_std.do_it_all() session_known_psf.epsf = make_anisocado_model() session_known_psf.do_astrometry() # %% figa = plots.plot_xy_deviation(session_std.tables.valid_result_table) figb = plots.plot_xy_deviation(session_known_psf.tables.valid_result_table) # %% fig, axs = plt.subplots(1, 2) axs[0].imshow(session_known_psf.epsf.data, norm=LogNorm()) axs[1].imshow(session_std.epsf.data, norm=LogNorm()) # %%