Example #1
0
    for i in range(len(band_run_list))
]
QSO_im_list, err_map_list, PSF_list = [], [], []
zp_list = []
qso_center_list, frm_c_RA_DEC_list = [], []

#%%
for i in range(len(band_seq)):
    # The pixel scale is all 0.168
    if len(glob.glob(image_folder + filename_list[i])) == 0:
        print(filename_list[i] + " DOES NOT EXIST!!!")
        image_not_exit.write(filename_list[i] + ' DOES NOT EXIST!!!' + '\n')
        QSO_im, err_map, PSF, pix_scale, zp, qso_center, fr_c_RA_DEC = [], [], [], [], [], [], []
        run_list.remove(i)
    else:
        QSO_im, err_map, PSF, pix_scale, zp, qso_center, fr_c_RA_DEC = gen_fit_id(
            image_folder, image_RA, image_DEC, filename_list[i], cut_frame=120)
    QSO_im_list.append(QSO_im)
    err_map_list.append(err_map)
    qso_center_list.append(qso_center)
    frm_c_RA_DEC_list.append(fr_c_RA_DEC)
    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()
        if PSF.shape[0] != PSF.shape[1]:
            raise ValueError("PSF shape is not a square.")
    PSF_list.append(PSF)
    zp_list.append(zp)
Example #2
0
filename_list = [QSO_id+'_HSC-{0}.fits'.format(band_seq[i]) for i in range(5)]
QSO_im_list, err_map_list, QSO_bkg_list, PSF_list=[], [], [], []
zp_list = []
qso_center_list, frm_c_RA_DEC_list = [], []

for i in range(len(band_seq)):
    # The pixel scale is all 0.168
    if len(glob.glob(image_folder+filename_list[i])) == 0:
        image_not_exit = open(filename_image_not_exit,"r+")
        image_not_exit.read()
        print filename_list[i] + " DOES NOT EXIST!!!"
        image_not_exit.write(filename_list[i] + ' DOES NOT EXIST!!!'+ '\n')
        QSO_im, err_map, QSO_bkg, PSF, pix_scale, zp, qso_fr_center, fr_c_RA_DEC = [], [], [], [], [], [], [], []
        run_list.remove(i)
    else:
        QSO_im, err_map, QSO_bkg, PSF, pix_scale, zp, qso_fr_center, fr_c_RA_DEC = gen_fit_id(image_folder, QSO_RA, QSO_DEC, filename_list[i],cut_frame=120, subbkl=sub_bkg)
    QSO_im_list.append(QSO_im)
    err_map_list.append(err_map)
    QSO_bkg_list.append(QSO_bkg)
    qso_center_list.append(qso_fr_center)
    frm_c_RA_DEC_list.append(fr_c_RA_DEC)
    if len(PSF) != 0 and PSF.shape[0] != PSF.shape[1]:
        cut = ((PSF.shape[0] - PSF.shape[1])/2)
        if cut>0:
            PSF = PSF[cut:-cut,:]
        elif cut<0:
            PSF = PSF[:,-cut:cut]
        PSF /= PSF.sum()
        if PSF.shape[0] != PSF.shape[1]:
            raise ValueError("PSF shape is not a square.")
    PSF_list.append(PSF)
Example #3
0
band_run_list = [0]  #run I band first
run_list = copy.deepcopy(band_run_list)
band_seq = ['I']
filename_list = [
    galaxy_ID + '_HSC-{0}.fits'.format(band_seq[i]) for i in range(1)
]
galaxy_im_list, err_map_list, PSF_list = [], [], []
zp_list = []
galaxy_center_list, frm_c_RA_DEC_list = [], []

for i in range(len(band_seq)):
    # The pixel scale is all 0.168
    galaxy_im, err_map, PSF, pix_scale, zp, galaxy_fr_center, fr_c_RA_DEC = gen_fit_id(
        image_folder,
        galaxy_RA,
        galaxy_DEC,
        filename_list[i],
        cut_frame=120,
        pltshow=0,
        subbkl='y')
    galaxy_im_list.append(galaxy_im)
    err_map_list.append(err_map)
    galaxy_center_list.append(galaxy_fr_center)
    frm_c_RA_DEC_list.append(fr_c_RA_DEC)
    if len(PSF) != 0 and PSF.shape[0] != PSF.shape[1]:
        cut = ((PSF.shape[0] - PSF.shape[1]) / 2)
        if cut > 0:
            PSF = PSF[cut:-cut, :]
        elif cut < 0:
            PSF = PSF[:, -cut:cut]
        PSF /= PSF.sum()
        if PSF.shape[0] != PSF.shape[1]:
Example #4
0
#
#import lenstronomy.Plots.output_plots as plot_mcmc_behaviour
fig = plt.figure(figsize=(20, 15))
ax = fig.add_subplot(111)
out_plot.plot_mcmc_behaviour(ax, samples_mcmc, param_mcmc, dist_mcmc)
plt.show()

#%% Plot the image again:
band_seq = ['G', 'R', 'I', 'Z', 'Y']
filename = galaxy_ID + '_HSC-{0}.fits'.format(band)
sub_bkg = True
from flux_profile import galaxy_total_compare
galaxy_im, err_map, galaxy_bkg, PSF, pix_scale, zp, qso_fr_center, fr_c_RA_DEC = gen_fit_id(
    image_folder,
    galaxy_RA,
    galaxy_DEC,
    filename,
    cut_frame=120,
    subbkl=sub_bkg)
ct = (len(galaxy_im) -
      len(image_host[0])) / 2  # If want to cut to 61, QSO_im[ct:-ct,ct:-ct]

if len(image_host) == 1:
    host = image_host[0]
    label = ['data', 'QSO', 'host', 'model', 'normalized residual']
elif len(image_host) > 1:
    host = np.zeros_like(image_host[0])
    for i in range(len(image_host)):
        host += image_host[i]
    label = [
        'data', 'QSO', 'host as {0} components'.format(i + 1), 'model',