Exemplo n.º 1
0
    ]

    data_process_list, zp_list = [], []
    for i in range(len(band_seq)):
        # The pixel scale is all 0.168
        fitsFile = pyfits.open(image_folder + filename_list[i])
        fov_image = fitsFile[1].data
        header = fitsFile[
            1].header  # if target position is add in WCS, the header should have the wcs information, i.e. header['EXPTIME']
        err_data = fitsFile[3].data**0.5
        file_header0 = fitsFile[0].header
        zp = 27.0
        data_process_i = DataProcess(fov_image=fov_image,
                                     fov_noise_map=err_data,
                                     target_pos=[image_RA, image_DEC],
                                     pos_type='wcs',
                                     header=header,
                                     rm_bkglight=True,
                                     if_plot=False,
                                     zp=zp)
        data_process_i.noise_map = err_data
        try:
            data_process_i.generate_target_materials(
                radius=None,
                radius_list=[15, 20, 25, 30, 35, 40],
                create_mask=False,
                nsigma=1.2,
                exp_sz=1.2,
                npixels=9,
                if_plot=False)
        except:
            data_process_i.generate_target_materials(radius=40,
Exemplo n.º 2
0
            QSO_im, err_map, PSF, _, _, qso_center, fr_c_RA_DEC = [], [], [], [], [], [], []
            run_list.remove(i)
            data_process_list.append(None)
            zp_list.append(None)
        else:
            fitsFile = pyfits.open(image_folder + filename_list[i])
            fov_image = fitsFile[1].data
            header = fitsFile[
                1].header  # if target position is add in WCS, the header should have the wcs information, i.e. header['EXPTIME']
            err_data = fitsFile[3].data**0.5
            file_header0 = fitsFile[0].header
            zp = 27.0
            data_process_i = DataProcess(fov_image=fov_image,
                                         fov_noise_map=err_data,
                                         target_pos=[image_RA, image_DEC],
                                         pos_type='wcs',
                                         header=header,
                                         rm_bkglight=False,
                                         if_plot=False,
                                         zp=zp)
            data_process_i.noise_map = err_data
            data_process_list.append(data_process_i)

    try:
        fit_size = len(
            pyfits.getdata(
                glob.glob(files[0] + 'data-BHBH(host image)_I-band.fits')[0]))
    except:
        fit_size = 61
    radius = int((fit_size - 1) / 2)
    for j in run_list:
        data_process_list[j].generate_target_materials(radius=radius,
Exemplo n.º 3
0
        phi1, q1 = param_util.ellipticity2phi_q(kwargs_lens_light[1]['e1'],
                                                kwargs_lens_light[1]['e2'])
        cond_0 = (kwargs_lens_light[0]['R_sersic'] >
                  kwargs_lens_light[1]['R_sersic'] * 0.9)
        cond_1 = (kwargs_lens_light[0]['R_sersic'] <
                  kwargs_lens_light[1]['R_sersic'] * 0.15)
        cond_2 = (q0 < q1)
        if cond_0 or cond_1 or cond_2:
            logL -= 10**15
        return logL

    data_process_0 = DataProcess(
        fov_image=sim_image_noise,
        fov_noise_map=rms,
        target_pos=[len(sim_image_noise) / 2,
                    len(sim_image_noise) / 2],
        pos_type='pixel',
        header=None,
        rm_bkglight=False,
        if_plot=False,
        zp=zp)
    data_process_0.deltaPix = deltaPix
    data_process_0.generate_target_materials(radius=None,
                                             create_mask=False,
                                             nsigma=2.8,
                                             exp_sz=1.2,
                                             npixels=15,
                                             if_plot=False)

    data_process_0.PSF_list = [psf_data]
    data_process_0.checkout()  #Check if all the materials is known.
    #%%Start to produce the class and params for lens fitting.
Exemplo n.º 4
0
        elif 'FSRQ' in ids_file[0]:
            pos_file = '../../data/Fermi_fsrq.txt'
        f = open(pos_file, "r")
        pos_info = f.read()
        pos_info = pos_info.split('\n')  # Split in to \n
        line = [j for j in range(len(pos_info)) if ids[i] in pos_info[j]][0]
        test_id, QSO_RA, QSO_DEC = pos_info[line].split(' ')
        QSO_RA = float(QSO_RA)
        QSO_DEC = float(QSO_DEC)
        if test_id != ids[i]:
            raise ValueError(
                "When load pos for the target, line for ID not right")
        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)

        data_process.noise_map = err_data
        try:
            data_process.generate_target_materials(radius=None,
                                                   create_mask=False,
                                                   nsigma=1.5,
                                                   exp_sz=1.2,
                                                   npixels=15,
                                                   if_plot=False)
        except:
            continue
        data_process.PSF_list = [PSF]
Exemplo n.º 5
0
 zp =  27.0
 PSF = pyfits.getdata('./Reines/{0}_HSC-I_psf.fits'.format(ID))
 if len(PSF) != 0 and PSF.shape[0] != PSF.shape[1]:
     cut = int((PSF.shape[0] - PSF.shape[1])/2)
     if cut>0:
         PSF = PSF[cut:-cut,:]
     elif cut<0:
         PSF = PSF[:,-cut:cut]
     PSF /= PSF.sum()
 
 #%%Start to use decomprofile
 from decomprofile.data_process import DataProcess
 QSO_RA = RA
 QSO_DEC = Dec
 data_process = DataProcess(fov_image = fov_image, fov_noise_map = err_data, target_pos = [QSO_RA, QSO_DEC],
                             pos_type = 'wcs', header = header, target_ID = ID,
                           rm_bkglight = False, if_plot=True, zp = zp)
 
 data_process.noise_map = err_data
 
 data_process.generate_target_materials(radius=None, create_mask = False, nsigma=3,
                                        radius_list = [120, 140, 160,180],
                                       exp_sz= 1.2, npixels = 55, if_plot=True,
                                       save_plot = True)
 
 data_process.PSF_list = [PSF]
 
 # data_process.checkout() #Check if all the materials is known.
 
 # #Start to produce the class and params for lens fitting.
 # from decomprofile.fitting_specify import FittingSpeficy