Exemple #1
0
 # for the plot propose:
 _ = transfer_to_result(data=QSO_img,
                        pix_sz=pix_scale,
                        source_result=source_result,
                        ps_result=ps_result,
                        image_ps=image_ps,
                        image_host=image_host,
                        error_map=error_map,
                        zp=zp_list[k],
                        fixcenter=fixcenter,
                        ID=image_ID + band_seq[k],
                        QSO_msk=None,
                        tag=tag,
                        plot_compare=plot_compare)
 #
 result = transfer_obj_to_result(source_result[0], image_host[0], zp)
 result['redu_Chisq'] = reduced_chisq
 fitsFile = pyfits.open(image_folder + filename_list[k])
 file_header = copy.deepcopy(fitsFile[1].header)
 file_header['CRPIX1'] = file_header['CRPIX1'] - qso_center_list[k][
     0] + len(QSO_img) / 2
 file_header['CRPIX2'] = file_header['CRPIX2'] - qso_center_list[k][
     1] + len(QSO_img) / 2
 fit_result.write("#QSO_img intensity in the band {1}: {0} \n".format(
     round(np.sum(QSO_img), 2), band_seq[k]))
 fit_result.write("#fit result of the QSO by in band {0}: \n".format(
     band_seq[k]))
 objs_img = np.zeros_like(image_host[0])
 if len(source_result) > 1:
     for i in range(1, len(image_host)):
         objs_img += image_host[i]
Exemple #2
0
    ])
    thdu_fluxlist.writeto('./zoutput/' + ID + '_flux_list_sersicdiskbar.fits',
                          overwrite=True)

    filename = './zoutput/{0}_fit_result.txt'.format(name_save)
    if_file = glob.glob(filename)
    if if_file == []:
        fit_result = open(filename, 'w')
    elif if_file is not []:
        fit_result = open(filename, "r+")
        fit_result.read()
    fit_result.write("Result for target " + ID + ":\n")
    ps_result_0 = ps_result[0]
    ps_result_0['PSF_mag'] = -2.5 * np.log10(ps_result_0['point_amp']) + zp
    fit_result.write("point source result:\n")
    fit_result.write("    " + repr(ps_result) + "\n")
    for i in range(len(source_result)):
        fit_result.write("obj {0} result:\n".format(i))
        result = transfer_obj_to_result(source_result=source_result[i],
                                        image_host=image_host[i],
                                        zp=zp)
        fit_result.write("    " + repr(result) + "\n")
    fit_result.write('======================\n')
    fit_result.close()

    print("Total Magnitude Result:")
    print("AGN magnitude:", -2.5 * np.log10(image_ps[0].sum()) + zp)
    print("Bulge magnitude:", -2.5 * np.log10(image_host[0].sum()) + zp)
    print("Disk magnitude:", -2.5 * np.log10(image_host[1].sum()) + zp)
    print("Bar magnitude:", -2.5 * np.log10(image_host[2].sum()) + zp)