예제 #1
0
                                 header=header,
                                 rm_bkglight=True,
                                 if_plot=False,
                                 zp=zp)

    data_process_0.noise_map = err_data

    data_process_0.generate_target_materials(radius=None,
                                             detect_tool='sep',
                                             create_mask=False,
                                             nsigma=2.8,
                                             exp_sz=1.2,
                                             npixels=15,
                                             if_plot=True)
    data_process_0.PSF_list = [PSF]
    data_process_0.checkout()  #Check if all the materials is known.

    fit_sepc_0 = FittingSpecify(data_process_0)
    fit_sepc_0.prepare_fitting_seq(
        point_source_num=1)  #, fix_n_list= [[0,4]], fix_center_list = [[0,0]])
    fit_sepc_0.plot_fitting_sets()
    fit_sepc_0.build_fitting_seq()
    # Setting the fitting method and run.
    fit_run_0 = FittingProcess(fit_sepc_0,
                               savename=save_name + ID + '_single_Sersic')
    fit_run_0.run(algorithm_list=['PSO', 'PSO'],
                  setting_list=[{
                      'sigma_scale': 1.,
                      'n_particles': 50,
                      'n_iterations': 50
                  }] * 2)
예제 #2
0
    fov_image = fitsFile[1].data # check the back grounp
    data_process = DataProcess(fov_image = fov_image, target_pos = [RA, Dec], pos_type = 'wcs', header = header,
                          rm_bkglight = True, exptime = exp_map, if_plot=False, zp = 25.9463)  #!!! zp use F160W for now
    data_process.generate_target_materials(radius=20, cut_kernel = 'center_bright', create_mask = False, 
                                           # detect_tool = 'sep', if_select_obj= True, nsigma=2.5, thresh = 2.5, exp_sz= 1.2, npixels = 15, 
                                           if_plot=False)
    
    #Lines used to find PSF and set the PSF_loc_dic.
    data_process.find_PSF(radius = 30, user_option = True, if_filter=True, psf_edge =30)
    # data_process.profiles_compare(norm_pix = 5, if_annuli=False, y_log = False,
    #               prf_name_list = (['target'] + ['PSF{0}'.format(i) for i in range(len(data_process.PSF_list))]) )
    # PSF_loc = PSF_loc_dic[str(i)]
    data_process.plot_overview(label = ID, target_label = None)
    # data_process.find_PSF(radius = 30, PSF_pos_list = [PSF_loc])
    data_process.checkout()
    #Start to produce the class and params for lens fitting.
    # data_process.apertures = []
    print(ID, i)
    fit_sepc = FittingSpecify(data_process)
    fit_sepc.prepare_fitting_seq(point_source_num = 1) #, fix_n_list= [[0,4],[1,1]])
    # psf_error_map = np.ones_like(data_process.PSF_list[data_process.psf_id_for_fitting]) *0.01 # It is in the variance unit (std^2).
    # fit_sepc.prepare_fitting_seq(point_source_num = 1, psf_error_map = psf_error_map)
    fit_sepc.build_fitting_seq()
    #Plot the initial settings for fittings. 
    fit_sepc.plot_fitting_sets()

    # fit_run = FittingProcess(fit_sepc, savename = 'pkl_files/'+ ID+'_'+str(i), fitting_level='deep')
    # fit_run.run(algorithm_list = ['PSO'], setting_list=[None])
    #             # setting_list = [{'sigma_scale': 1., 'n_particles': 100, 'n_iterations': 100}, {'n_burn': 100, 'n_run': 100, 'walkerRatio': 10,'sigma_scale': .1}])
    # # fit_run.plot_all()