rm_bkglight=False, if_plot=False, zp=zp) data_process.PSF_list = [PSF] data_process.generate_target_materials(radius=cut_radius, create_mask=False, nsigma=2.8, exp_sz=1.2, npixels=25, if_plot=False) import copy apr0 = copy.deepcopy(data_process.apertures[0]) apr1 = copy.deepcopy(data_process.apertures[0]) apr0.positions = np.array([48., 49.]) apr1.positions = np.array([56., 48.]) data_process.apertures = [apr0, apr1] # if rerun != 's21a': # picklename = 'fit_result/'+'dual_result-band-{0}-s21a.pkl'.format(band) # s21_res = pickle.load(open(picklename,'rb')) # data_process.target_stamp -= s21_res.image_host_list[0] fit_sepc = FittingSpecify(data_process) fit_sepc.prepare_fitting_seq(point_source_num=point_source_num, supersampling_factor=3) fit_sepc.plot_fitting_sets( object_id + '_fitconfig-band-{0}-{1}.png'.format(band, rerun)) fit_sepc.build_fitting_seq() # if rerun != 's19a': # fit_sepc.kwargs_params['point_source_model'] = s21_res.fitting_specify_class.kwargs_params['point_source_model'] fit_run = FittingProcess(fit_sepc, savename=object_id + '_result-band-{0}-{1}'.format(band, rerun),
add_aperture0 = copy.deepcopy(apertures[comp_id]) add_aperture0.a, add_aperture0.b = add_aperture0.a / 2, add_aperture0.b / 2 apertures = apertures[:comp_id] + [add_aperture0] + apertures[comp_id:] #Manually input another component: add_aperture1 = copy.deepcopy(apertures[0]) add_pos = [36, 45] #The position of the component. if isinstance(add_aperture1.positions[0], float): add_aperture1.positions = np.array(add_pos) elif isinstance(add_aperture1.positions[0], np.ndarray): add_aperture1.positions = np.array([add_pos]) add_aperture1.a, add_aperture1.b = 2, 2 #define the a, b value of this component, i.e., Reff = sqrt(a^2 +b^2) apertures = apertures + [add_aperture1 ] #attach the added aperture into the group. data_process.apertures = apertures #Pass apertures to the data from galight.tools.measure_tools import plot_data_apertures plot_data_apertures(data_process.target_stamp, apertures) #%%Start to produce the class and params for lens fitting. from galight.fitting_specify import FittingSpecify fit_sepc = FittingSpecify(data_process) fit_sepc.prepare_fitting_seq( point_source_num=1, fix_n_list=[ [0, 4], [1, 1] ], #fix_Re_list= [[0,0.2], [1,1.14]], #First component fix n = 4 (bluge), second one fix to 1 (disk).
if_plot=False, zp=zp) #Gain value assuming as 1 data_process.generate_target_materials(radius=rad * 0.8, create_mask=False, nsigma=2.8, if_select_obj=False, exp_sz=1.2, npixels=15, if_plot=False) data_process.plot_overview(label=filt + '_' + str(fov_cut_idx) + '_FOV', target_label=name[:7], ifsave=True, filename=filename + '_FOV', if_plot=if_plot) # data_process.find_PSF(radius = 50, user_option = True, psf_edge=10) data_process.apertures = [data_process.apertures[0]] info = {} for psf, name in [[psf_true, 'same_psf'], [psf_model, 'diff_psf']]: # for psf, name in [[psf_model,'diff_psf']]: plot_fit_name = filename + name + '_fit' data_process.PSF_list = [psf] #Start to produce the class and params for lens fitting. fit_sepc = FittingSpecify(data_process) fit_sepc.prepare_fitting_seq( point_source_num=1) #, fix_n_list= [[0,4],[1,1]]) fit_sepc.build_fitting_seq() #Plot the initial settings for fittings. # fit_sepc.plot_fitting_sets() # fit_run = FittingProcess(fit_sepc, savename=plot_fit_name,