示例#1
0
data_process = DataProcess(fov_image=data,
                           target_pos=[1170., 940.],
                           pos_type='pixel',
                           header=header,
                           rm_bkglight=False,
                           exptime=np.ones_like(data) * exptime,
                           if_plot=False,
                           zp=zp)  #Gain value assuming as 1
data_process.generate_target_materials(radius=65,
                                       create_mask=False,
                                       nsigma=2.8,
                                       if_select_obj=False,
                                       exp_sz=1.2,
                                       npixels=15,
                                       if_plot=True)
data_process.find_PSF(radius=30, user_option=True)
data_process.plot_overview(label='Example', target_label=None)

#Start to produce the class and params for lens fitting.
from galight.fitting_specify import FittingSpecify

# data_process.apertures = []
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()

#Setting the fitting method and run.
from galight.fitting_process import FittingProcess
示例#2
0
    # print(ID, idx)
    RA, Dec = ra_dec_info[idx].split(' ')[:2]
    RA, Dec = np.float(RA), np.float(Dec)
    if ID == 'J2100-1715':
        RA = 315.2279713
        Dec = -17.25608967

    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. 
示例#3
0
 exptime = header0['TEXPTIME']  #The assumed exp time.
 plt_fits(data_sb)
 # Obtain PSF stars:
 # zp = 31.4 - 2.5*np.log10(header['PHOTMJSR'])  #Calculate the correspondingly zp as DN/S #This is wrong! See 3_...
 data_process_ = DataProcess(fov_image=data_sb,
                             target_pos=[1170., 940.],
                             pos_type='pixel',
                             header=header,
                             rm_bkglight=True,
                             exptime=np.ones_like(data_sb) * exptime,
                             if_plot=False,
                             zp=zp)  #Gain value assuming as 1
 # data_process_.generate_target_materials(radius=65, create_mask = False, nsigma=2.8, if_select_obj=False,
 #                                       exp_sz= 1.2, npixels = 15, if_plot=True)
 data_process_.find_PSF(radius=60,
                        user_option=True,
                        psf_edge=150,
                        select_all=True)
 # data_process_.plot_overview(label = 'Example', target_label = None)
 FWHM_list = np.array(data_process_.PSF_FWHM_list)
 POS_list = np.array(data_process_.PSF_pos_list)
 psf_list = np.array(data_process_.PSF_list)
 fwhm_bools = [FWHM_list < 4.3][0]
 psf_list = psf_list[fwhm_bools]
 POS_list = POS_list[fwhm_bools]
 FWHM_list = FWHM_list[fwhm_bools]
 near_bools = []
 for i in range(len(psf_list)):
     try:
         _, segm_map = detect_obj(psf_list[i],
                                  if_plot=False,
                                  segm_map=True,
示例#4
0
from galight.tools.astro_tools import plt_fits
plt_fits(data_sb)
#%%Obtain PSF stars:
from galight.data_process import DataProcess
# zp = 31.4 - 2.5*np.log10(header['PHOTMJSR'])  #Calculate the correspondingly zp as DN/S #This is wrong! See 3_...
data_process_ = DataProcess(fov_image=data_sb,
                            target_pos=[1170., 940.],
                            pos_type='pixel',
                            header=header,
                            rm_bkglight=True,
                            exptime=np.ones_like(data_sb) * exptime,
                            if_plot=False,
                            zp=zp)  #Gain value assuming as 1
# data_process_.generate_target_materials(radius=65, create_mask = False, nsigma=2.8, if_select_obj=False,
#                                       exp_sz= 1.2, npixels = 15, if_plot=True)
data_process_.find_PSF(radius=60, user_option=True, psf_edge=10)
data_process_.plot_overview(label='Example', target_label=None)
#%%

psf_ids = [3, 8]  #use 5 to do mock and use 10 to do fitting.
# psf_ids = [5,9]  #use 5 to do mock and use 10 to do fitting.
psf_list = [
    data_process_.PSF_list[i] / np.sum(data_process_.PSF_list[i])
    for i in psf_ids
]

# from galight.tools.cutout_tools import psf_clean
# psf_list[0] = psf_clean(psf_list[0], if_plot=True)
# plt_fits(psf)
#%%
# data_process_.find_PSF(radius = 60, PSF_pos_list = [[341., 444.], [1925., 1127.]])
示例#5
0
        #Load the PSF data:
        # PSF_files = glob.glob('psf*{0}*.fits'.format(HSCband))
        # PSF = pyfits.getdata(PSF_files[0])
        data_process = DataProcess(fov_image=fov_image,
                                   fov_noise_map=err_data,
                                   target_pos=[QSO_RA, QSO_DEC],
                                   pos_type='wcs',
                                   header=header,
                                   rm_bkglight=True,
                                   if_plot=False,
                                   zp=zp)

        PSF_loc = [35.29689501, -4.685896878]
        data_process.find_PSF(
            radius=20,
            PSF_pos_list=[PSF_loc],
            pos_type='wcs',
        )

        #Generate the fitting materials
        data_process.generate_target_materials(radius=30,
                                               create_mask=False,
                                               nsigma=2.8,
                                               exp_sz=1.5,
                                               npixels=40,
                                               if_plot=False)

        plt_fits(data_process.PSF_list[0])
        # data_process.apertures = [] #Assuming there is no host (i.e., as constant.) #!!!

        # Manually input the PSF: