Exemple #1
0
        xk_recon = result_loop['xk_recon']
        yk_recon = result_loop['yk_recon']
        alpha_k_recon = result_loop['alpha_k_recon']
        K_est = result_loop['K_est']
        fitting_error_all.append(result_loop['fitting_error'])
        planar_plot_diracs_J2000(
            x_plt_grid=x_plt,
            y_plt_grid=y_plt,
            RA_focus_rad=sky_ra,
            DEC_focus_rad=sky_dec,
            x_ref=x_ks,
            y_ref=y_ks,
            amplitude_ref=alpha_ks,
            x_recon=xk_recon,
            y_recon=yk_recon,
            amplitude_recon=alpha_k_recon,
            cmap=parameter_set['cmap'],
            background_img=img_clean,
            marker_scale=parameter_set['marker_scale'],
            save_fig=save_fig,
            file_name=file_name + '_Kest_{}'.format(K_est),
            label_ref_sol='ground truth',
            label_recon='reconstruction',
            file_format=fig_format,
            dpi=parameter_set['dpi'],
            close_fig=True,
            title_str=r'$K_{{\rm est}}={0}$'.format(K_est))

    fitting_error_all = np.array(fitting_error_all)
    # plot the objective function values against different K_est
    fig = plt.figure(figsize=(4, 2.5), dpi=90)
    ax = plt.axes([0.19, 0.185, 0.72, 0.72])
    img_dirty = clean_data['img_dirty']
    src_model_clean = clean_data['src_model']
    x_plt_CLEAN = clean_data['x_plt_CLEAN_rad']
    y_plt_CLEAN = clean_data['y_plt_CLEAN_rad']

    file_name = fig_dir + \
                'visual_comparison_2src_dynamic_range{dynamic_range}'.format(
                    dynamic_range=parameter_set['dynamic_range']
                )
    # back ground image: dirty image
    planar_plot_diracs_J2000(
        x_plt_grid=x_plt_CLEAN, y_plt_grid=y_plt_CLEAN,
        RA_focus_rad=sky_ra, DEC_focus_rad=sky_dec,
        background_img=img_dirty,
        cmap=parameter_set['cmap'],
        marker_scale=parameter_set['marker_scale'],
        marker_alpha=0.7, save_fig=save_fig,
        file_name=file_name + '_bg_img_dirty',
        label_ref_sol='ground truth', label_recon='reconstruction',
        file_format=fig_format, dpi=parameter_set['dpi'], close_fig=False,
        title_str='dirty image'
    )
    # back ground image: CLEAN image
    planar_plot_diracs_J2000(
        x_plt_grid=x_plt_CLEAN, y_plt_grid=y_plt_CLEAN,
        RA_focus_rad=sky_ra, DEC_focus_rad=sky_dec,
        background_img=img_clean,
        cmap=parameter_set['cmap'],
        marker_scale=parameter_set['marker_scale'],
        marker_alpha=0.7, save_fig=save_fig,
        file_name=file_name + '_bg_img_clean',
        label_ref_sol='ground truth', label_recon='reconstruction',
Exemple #3
0
    x_plt_CLEAN = clean_data['x_plt_CLEAN_rad']
    y_plt_CLEAN = clean_data['y_plt_CLEAN_rad']

    file_name = fig_dir + 'visual_comparison_2src_sep'
    # back ground image: dirty image
    planar_plot_diracs_J2000(x_plt_grid=x_plt_CLEAN,
                             y_plt_grid=y_plt_CLEAN,
                             RA_focus_rad=sky_ra,
                             DEC_focus_rad=sky_dec,
                             x_ref=x_ks,
                             y_ref=y_ks,
                             amplitude_ref=alpha_ks,
                             x_recon=xk_recon,
                             y_recon=yk_recon,
                             amplitude_recon=alpha_k_recon,
                             cmap=parameter_set['cmap'],
                             background_img=img_dirty,
                             marker_scale=parameter_set['marker_scale'],
                             save_fig=save_fig,
                             file_name=file_name + '_bg_img_dirty_updateG',
                             label_ref_sol='ground truth',
                             label_recon='reconstruction',
                             file_format=fig_format,
                             dpi=parameter_set['dpi'],
                             close_fig=False,
                             has_title=False)
    # back ground image: CLEAN image
    planar_plot_diracs_J2000(x_plt_grid=x_plt_CLEAN,
                             y_plt_grid=y_plt_CLEAN,
                             RA_focus_rad=sky_ra,
                             DEC_focus_rad=sky_dec,
        yk_recon = intermidiate_result['yk_recon']

    if script_purpose != 'plotting':
        for stages in range(stage0, max_stage):
            # estimated number of Diracs for the PARTIAL reconstruction
            K_est_stage = K_est_stage_lst[stages]

            if stages == 0:
                file_name = (fig_dir + 'planar_K_{0}_numSta_{1}_locations_stage{2}'
                             ).format(repr(K_est), repr(num_station), stages)
                for bg_img in bg_img_lst:
                    planar_plot_diracs_J2000(
                        x_plt, y_plt,
                        RA_focus_rad=sky_ra, DEC_focus_rad=sky_dec,
                        background_img=background_img[bg_img],
                        cmap=parameter_set['cmap'],
                        marker_scale=parameter_set['marker_scale'],
                        save_fig=save_fig,
                        file_name=file_name + '_bg_img_' + bg_img.lower(),
                        file_format='png', dpi=parameter_set['dpi'], close_fig=True,
                        title_str=bg_img + ' image')

                xk_recon, yk_recon, alpha_k_recon = \
                    planar_recon_2d_dirac_joint_beamforming(
                        visi_noisy, r_antenna_x, r_antenna_y,
                        2 * np.pi * freq_subbands_hz, light_speed, K=K_est_stage,
                        tau_x=tau_x, tau_y=tau_y, M=M, N=N, tau_inter_x=tau_inter_x,
                        tau_inter_y=tau_inter_y, max_ini=max_ini, num_rotation=1,
                        G_iter=parameter_set['G_iter'],
                        plane_norm_vec=plane_norm_vec, verbose=True,
                        backend=backend, theano_build_G_func=theano_build_G_func,
                        theano_build_amp_func=theano_build_amp_func