def mass_distance_bin_compare(): fig = plt.figure(figsize=(6.4, 4.8)) gs = gridspec.GridSpec(1, 1) axs0 = plt.subplot(gs[0]) max_mass = 5e13 #axs1.hlines(2e12,0,110,linestyle="solid") axs0.hlines(5e11, 75, 110, linestyle="solid") axs0.hlines(2e11, 45, 75, linestyle="solid") axs0.hlines(1e11, 0, 45, linestyle="solid") #q1 = np.log10(5e11)-np.average(E1_T11-key_delta_Bin1)-0.5*np.std(E1_T11-key_delta_Bin1) #q2 = np.log10(2e11)-np.average(E2_T11-key_delta_Bin2)-0.5*np.std(E2_T11-key_delta_Bin2) #q3 = np.log10(1e11)-np.average(E3_T11-key_delta_Bin3)-0.5*np.std(E3_T11-key_delta_Bin3) #q1 = np.log10(5e11)-np.average(E1_Z09-key_delta_Bin1)-0*np.std(E1_Z09-key_delta_Bin1) #q2 = np.log10(2e11)-np.average(E2_Z09-key_delta_Bin2)-0*np.std(E2_Z09-key_delta_Bin2) #q3 = np.log10(1e11)-np.average(E3_Z09-key_delta_Bin3)-0*np.std(E3_Z09-key_delta_Bin3) #q1 = np.log10(5e11)-0.45*np.average(E1_RC15-key_delta_Bin1)-0*np.std(E1_Z09-key_delta_Bin1) #q2 = np.log10(2e11)-0.45*np.average(E2_RC15-key_delta_Bin2)-0*np.std(E2_Z09-key_delta_Bin2) #q3 = np.log10(1e11)-0.45*np.average(E3_RC15-key_delta_Bin3)-0*np.std(E3_Z09-key_delta_Bin3) #q1 = np.log10(5e11)-np.average(E1_T11-key_delta_Bin1) #q2 = np.log10(2e11)-np.average(E2_T11-key_delta_Bin2) #q3 = np.log10(1e11)-np.average(E3_T11-key_delta_Bin3) #q1 = np.log10(5e11)-max_E1_ERC15 #q2 = np.log10(2e11)-max_E2_ERC15 #q3 = np.log10(1e11)-max_E3_ERC15 #q1 = np.log10(5e11)-max_E1_EZ09 #q2 = np.log10(2e11)-max_E2_EZ09 #q3 = np.log10(1e11)-max_E3_EZ09 q1 = np.log10(5e11) - max_E1_ET11 q2 = np.log10(2e11) - max_E2_ET11 q3 = np.log10(1e11) - max_E3_ET11 print("q1 , q2, q3", q1, q2, q3) axs0.hlines(10**q1, 75, 110, linestyle="solid") axs0.hlines(10**q2, 45, 75, linestyle="solid") axs0.hlines(10**q3, 0, 45, linestyle="solid") axs0.vlines(110, 5e11, max_mass, linestyle="solid") axs0.vlines(75, 2e11, max_mass, linestyle="solid") axs0.vlines(45, 1e11, max_mass, linestyle="solid") x_edge1, y_edge1 = [75, 75, 110, 110], [5e11, max_mass, max_mass, 5e11] x_edge2, y_edge2 = [45, 45, 75, 75], [2e11, max_mass, max_mass, 2e11] x_edge3, y_edge3 = [0, 0, 45, 45], [1e11, max_mass, max_mass, 1e11] axs0.plot(DD1, E, 'x', color='#a51a74', alpha=0.8, label='New Distance IP13') axs0.plot(DD1, E_T11, 'x', color='g', alpha=0.8, label='T11') #axs1.plot(DD1,E_Z09,'x',color='b', alpha=0.8, label='Z09') #axs1.plot(DD1,E_RC15,'x',color='k', alpha=0.8, label='RC15') axs0.plot(corr_dist1, corr_E1, 'ro', label='Bin1 samples', ms=12, alpha=0.8) axs0.plot(corr_dist2, corr_E2, 'bo', label='Bin2 samples', ms=12, alpha=0.8) axs0.plot(corr_dist3, corr_E3, 'ko', label='Bin3 samples', ms=12, alpha=0.8) axs0.plot(corr_dist1, 10**E1_T11, 'rs', label='Bin1 samples', ms=12, alpha=0.8) axs0.plot(corr_dist2, 10**E2_T11, 'bs', label='Bin2 samples', ms=12, alpha=0.8) axs0.plot(corr_dist3, 10**E3_T11, 'ks', label='Bin3 samples', ms=12, alpha=0.8) #axs0.plot(corr_dist1,10**E1_Z09,'rs',label='Bin1 samples', ms=12,alpha=0.8) #axs0.plot(corr_dist2,10**E2_Z09,'bs',label='Bin2 samples', ms=12,alpha=0.8) #axs0.plot(corr_dist3,10**E3_Z09,'ks',label='Bin3 samples', ms=12,alpha=0.8) #axs0.plot(corr_dist1,10**E1_RC15,'rs',label='Bin1 samples', ms=12,alpha=0.8) #axs0.plot(corr_dist2,10**E2_RC15,'bs',label='Bin2 samples', ms=12,alpha=0.8) #axs0.plot(corr_dist3,10**E3_RC15,'ks',label='Bin3 samples', ms=12,alpha=0.8) axs0.plot(dc, SPlot.SelectionCut(initial_mass, dc).parent_sample_cut(), linestyle="solid", color="blue", linewidth=2) axs0.vlines(115, 4.17e11, 1e15, linestyle="solid", color="blue", linewidth=2) axs0.fill(x_edge1, y_edge1, alpha=0.3, color='green') axs0.fill(x_edge2, y_edge2, alpha=0.2, color='green') axs0.fill(x_edge3, y_edge3, alpha=0.1, color='green') axs0.set_ylim(top=5e12, bottom=1e9) axs0.set_xlim(left=0, right=120) axs0.set_ylabel(r"$ M_*/ \rm M_\odot(IP13)$", fontsize=16) axs0.set_xlabel(r"$ \rm Distance/Mpc$", fontsize=16) axs0.set_yscale('log') axs0.set_ylim(top=5e13, bottom=1e10) axs0.set_xlim(left=0, right=120) axs0.legend(loc=4, fontsize=10) plt.tight_layout() plt.show()
vel_err_index=7, scale_index=8, dir_name_index=0, dir_dist_index=3, dir_dist_err_index=4, dir_method_index=5, dir_method_flag_index=7) name1 = D["Gal_name"] DD1 = D["Dist"] DD1_err = D["Dist_err"] scale1 = D["Scale"] mag_g, mag_i = broad_cut[:, 10], broad_cut[:, 9] ML_select_T11 = SPlot.MLRelationIband(mag_g, mag_i).Taylor11_MassRatio ML_select_Z09 = SPlot.MLRelationIband(mag_g, mag_i).Zibetti09_MassRatio ML_select_RC15 = SPlot.MLRelationIband(mag_g, mag_i).Roediger15BC03_MassRatio ML_select_IP13 = SPlot.MLRelationIband(mag_g, mag_i).Into13_MassRatio M = SPlot.MassCalculation(mag_i, DD1, 4.53, mag_g, mag_i) E = M.cal_Mass(ML_select_IP13) E_T11 = M.cal_Mass(ML_select_T11) E_Z09 = M.cal_Mass(ML_select_Z09) E_RC15 = M.cal_Mass(ML_select_RC15) # same calculation but seperated by bin ML_select1_T11 = SPlot.MLRelationIband(g1, i1).Taylor11_MassRatio ML_select1_Z09 = SPlot.MLRelationIband(g1, i1).Zibetti09_MassRatio ML_select1_RC15 = SPlot.MLRelationIband(g1, i1).Roediger15BC03_MassRatio
def mass_distance_2plots(): fig = plt.figure(figsize=(6.4, 9.6)) gs = gridspec.GridSpec(2, 1) axs1 = plt.subplot(gs[1]) axs0 = plt.subplot(gs[0]) max_mass = 5e13 #axs1.hlines(2e12,0,110,linestyle="solid") axs1.hlines(5e11, 75, 110, linestyle="solid") axs1.hlines(2e11, 45, 75, linestyle="solid") axs1.hlines(1e11, 0, 45, linestyle="solid") axs1.vlines(110, 5e11, max_mass, linestyle="solid") axs1.vlines(75, 2e11, max_mass, linestyle="solid") axs1.vlines(45, 1e11, max_mass, linestyle="solid") x_edge1, y_edge1 = [75, 75, 110, 110], [5e11, max_mass, max_mass, 5e11] x_edge2, y_edge2 = [45, 45, 75, 75], [2e11, max_mass, max_mass, 2e11] x_edge3, y_edge3 = [0, 0, 45, 45], [1e11, max_mass, max_mass, 1e11] axs0.plot(dc, initial_mass, 'x', color='grey', alpha=0.8, label='All') axs0.plot(dc, SPlot.SelectionCut(initial_mass, dc).parent_sample_cut(), linestyle="solid", color="blue", linewidth=2) axs0.vlines(115, 4.17e11, 1e15, linestyle="solid", color="blue", linewidth=2) #axs0.plot(dc,E,'x',color='green', alpha=0.4, label='New Distance') axs0.plot(dc_b, initial_mass_b, 'x', color='green', alpha=0.8, label='Broad Selection') axs1.plot(DD1, E, 'x', color='#a51a74', alpha=0.8, label='New Distance IP13') axs1.plot(DD1, E_T11, 'x', color='g', alpha=0.8, label='T11') #axs1.plot(DD1,E_Z09,'x',color='b', alpha=0.8, label='Z09') #axs1.plot(DD1,E_RC15,'x',color='k', alpha=0.8, label='RC15') #axs1.plot(corr_dist1,corr_E1,'ro',label='Bin1 samples', ms=12,alpha=0.8) #axs1.plot(corr_dist2,corr_E2,'bo',label='Bin2 samples', ms=12,alpha=0.8) #axs1.plot(corr_dist3,corr_E3,'ko',label='Bin3 samples', ms=12,alpha=0.8) axs1.plot(d1, 10**E1_d, 'ro', label='Bin1 samples', ms=12, alpha=0.8) axs1.plot(d2, 10**E2_d, 'bo', label='Bin2 samples', ms=12, alpha=0.8) axs1.plot(d3, 10**E3_d, 'ko', label='Bin3 samples', ms=12, alpha=0.8) #axs1.plot(corr_dist1,10**E1_T11,'rs',label='Bin1 samples', ms=12,alpha=0.8) #axs1.plot(corr_dist2,10**E2_T11,'bs',label='Bin2 samples', ms=12,alpha=0.8) #axs1.plot(corr_dist3,10**E3_T11,'ks',label='Bin3 samples', ms=12,alpha=0.8) axs1.plot(dc, SPlot.SelectionCut(initial_mass, dc).parent_sample_cut(), linestyle="solid", color="blue", linewidth=2) axs1.vlines(115, 4.17e11, 1e15, linestyle="solid", color="blue", linewidth=2) axs1.fill(x_edge1, y_edge1, alpha=0.3, color='green') axs1.fill(x_edge2, y_edge2, alpha=0.2, color='green') axs1.fill(x_edge3, y_edge3, alpha=0.1, color='green') axs0.set_ylim(top=5e12, bottom=1e9) axs0.set_xlim(left=0, right=120) axs0.set_ylabel(r"$ M_*/\rm M_\odot(IP13)$", fontsize=16) axs0.set_xlabel(r"$ \rm Distance/Mpc$", fontsize=16) axs0.set_yscale('log') axs1.set_ylabel(r"$ M_*/ \rm M_\odot(IP13)$", fontsize=16) axs1.set_xlabel(r"$ \rm Distance/Mpc$", fontsize=16) axs1.set_yscale('log') axs1.set_ylim(top=2e12, bottom=1e10) axs1.set_xlim(left=0, right=120) axs0.legend(loc=4, fontsize=10) axs1.legend(loc=4, fontsize=10) plt.tight_layout() plt.show()
["Bulge", "CoreBulge"], 1) #get Re Re_3 = SRead.grab_parameter("F_Gal_bundle_equvi_Bin3V_cpt", ["Bulge", "CoreBulge"], 1) #get Re ars = (4.84814e-6) * 1e3 # 1arcsec = (4.84814e-6) rad ars:arcsec to rad scale scale1 = D1 * ars scale2 = D2 * ars scale3 = D3 * ars Re_1_kpc = Re_1 * scale1 Re_2_kpc = Re_2 * scale2 Re_3_kpc = Re_3 * scale3 # Calculate mass ML_select1_IP13 = SPlot.MLRelationIband(mag_g1, mag_i1).Into13_MassRatio ML_select1_R15BC = SPlot.MLRelationIband(mag_g1, mag_i1).Roediger15BC03_MassRatio ML_select1_Z09 = SPlot.MLRelationIband(mag_g1, mag_i1).Zibetti09_MassRatio ML_select1_T11 = SPlot.MLRelationIband(mag_g1, mag_i1).Taylor11_MassRatio M1 = SPlot.MassCalculation(sph_mag1, D1, 4.53, mag_g1, mag_i1) E1_IP13 = M1.cal_Mass(ML_select1_IP13) E1_R15BC = M1.cal_Mass(ML_select1_R15BC) E1_Z09 = M1.cal_Mass(ML_select1_Z09) E1_T11 = M1.cal_Mass(ML_select1_T11) ML_select2_IP13 = SPlot.MLRelationIband(mag_g2, mag_i2).Into13_MassRatio ML_select2_R15BC = SPlot.MLRelationIband(mag_g2, mag_i2).Roediger15BC03_MassRatio
mag_i2 = np.array(SRead.extract_match(name2, vdis_file2[:, 0], vdis_file[:, 9])) mag_g3 = np.array( SRead.extract_match(name3, vdis_file2[:, 0], vdis_file[:, 10])) mag_i3 = np.array(SRead.extract_match(name3, vdis_file2[:, 0], vdis_file[:, 9])) mag_g4 = np.array( SRead.extract_match(name4, vdis_file2[:, 0], vdis_file[:, 10])) mag_i4 = np.array(SRead.extract_match(name4, vdis_file2[:, 0], vdis_file[:, 9])) ############# new distance, new i-band magnitude ML_select2 = SPlot.MLRelationIband(mag_g2, mag_i2).Into13_MassRatio M2 = SPlot.MassCalculation(total_mag2, DD2, 4.53, mag_g2, mag_i2) E2 = M2.cal_Mass(ML_select2) ML_select3 = SPlot.MLRelationIband(mag_g3, mag_i3).Into13_MassRatio M3 = SPlot.MassCalculation(total_mag3, DD3, 4.53, mag_g3, mag_i3) E3 = M3.cal_Mass(ML_select3) ML_select4 = SPlot.MLRelationIband(mag_g4, mag_i4).Into13_MassRatio M4 = SPlot.MassCalculation(total_mag4, DD4, 4.53, mag_g4, mag_i4) E4 = M4.cal_Mass(ML_select4) ############# old distance, old i-band magnitude M2_o1 = SPlot.MassCalculation(mag_i2, DD2, 4.53, mag_g2, mag_i2) E2_o1 = M2_o1.cal_Mass(ML_select2)
D = SRead.grab_dist( "/home/dexter/result/stat/completeness/dir_dist_list_broad3_2.txt", "/home/dexter/result/stat/completeness/diagonal_selection_bag3_2.dat", name_index = 4, vel_index = 6, vel_err_index = 7, scale_index = 8, dir_name_index = 0, dir_dist_index = 3, dir_dist_err_index =4, dir_method_index = 5, dir_method_flag_index = 7) name1 = D["Gal_name"] DD1 = D["Dist"] DD1_err = D["Dist_err"] scale1 = D["Scale"] mag_g, mag_i = np.nan_to_num(broad_cut[:,10],neginf=0),np.nan_to_num(broad_cut[:,9],neginf=0) ML_select_T11= SPlot.MLRelationIband(mag_g,mag_i).Taylor11_MassRatio ML_select_Z09= SPlot.MLRelationIband(mag_g,mag_i).Zibetti09_MassRatio ML_select_RC15= SPlot.MLRelationIband(mag_g,mag_i).Roediger15BC03_MassRatio ML_select_IP13= SPlot.MLRelationIband(mag_g,mag_i).Into13_MassRatio M = SPlot.MassCalculation(mag_i, DD1, 4.53,mag_g,mag_i) E_IP13 = M.cal_Mass(ML_select_IP13) E_T11 = M.cal_Mass(ML_select_T11) E_Z09 = M.cal_Mass(ML_select_Z09) E_RC15 = M.cal_Mass(ML_select_RC15) from scipy.optimize import curve_fit
CCC4 = np.genfromtxt("Ctable_Into_bin4_final.txt", dtype='float') R_e_4 = SRead.grab_parameter("Gal_bundle_equvi_bin4_cpt", ["Bulge", "CoreBulge"], 1) #get Re mag4 = SRead.grab_mag("Gal_bundle_equvi_bin4_cpt", ["Bulge", "CoreBulge"]) AbsMag_g_bin4 = CCC4[:, 6] AbsMag_i_bin4 = CCC4[:, 8] #Mass_bulge_Into2 = cal_Mass(mag2,DD2,ML_relation_Iband(AbsMag_g_bin2,AbsMag_i_bin2).Into13_MassRatio,M_sun) Re_kpc4 = R_e_4 * scale4 Mag4 = mag4 - 25 - 5 * np.log10(DD4) Lum4 = 10**((Mag4 - (4.53)) / (-2.5)) ################################ ML_select2 = SPlot.MLRelationIband(AbsMag_g_bin2, AbsMag_i_bin2).Into13_MassRatio M2 = SPlot.MassCalculation(mag2, DD2, M_sun, AbsMag_g_bin2, AbsMag_i_bin2) E2 = M2.cal_Mass(ML_select2) ML_select3 = SPlot.MLRelationIband(AbsMag_g_bin3, AbsMag_i_bin3).Into13_MassRatio M3 = SPlot.MassCalculation(mag3, DD3, M_sun, AbsMag_g_bin3, AbsMag_i_bin3) E3 = M3.cal_Mass(ML_select3) ML_select4 = SPlot.MLRelationIband(AbsMag_g_bin4, AbsMag_i_bin4).Into13_MassRatio M4 = SPlot.MassCalculation(mag4, DD4, M_sun, AbsMag_g_bin4, AbsMag_i_bin4) E4 = M4.cal_Mass(ML_select4) SPlot.ShowcaseIndi.Mass_Re_plot(E2, Re_kpc2, name2, "ro", "test", 1.0) SPlot.ShowcaseIndi.Mass_Re_plot(E3, Re_kpc3, name3, "bo", "test", 1.0)
D, D_lerr, D_uerr = D0_all_table[:, 29], D0_all_table[:, 30], D0_all_table[:, 31] morph = D0_all_table_n[:, -4] elle = geom_file[:, 7] #extended disk ellipicity # Read the data from the galaxy BD bundle for dust correction later sph_mag_i_BD = SRead.grab_mag(bundle_BD_name, ["Bulge"]) disc_mag_i_BD = SRead.grab_mag(bundle_BD_name, ["Disk"]) Abs_sph_mag_i_BD = sph_mag_i_BD - 25 - 5 * np.log10(D) Abs_disc_mag_i_BD = disc_mag_i_BD - 25 - 5 * np.log10(D) # Calculate the absoulte magnitude and the stellar mass ML_select_T11 = SPlot.MLRelationIband(mag_g_kcorr, mag_i_kcorr).Taylor11_MassRatio ML_select_RC15 = SPlot.MLRelationIband(mag_g_kcorr, mag_i_kcorr).Roediger15BC03_MassRatio ML_select_Z09 = SPlot.MLRelationIband(mag_g_kcorr, mag_i_kcorr).Zibetti09_MassRatio ML_select_IP13 = SPlot.MLRelationIband(mag_g_kcorr, mag_i_kcorr).Into13_MassRatio M = SPlot.MassCalculation(sph_mag, D, 4.53, mag_g_kcorr, mag_i_kcorr) Abs_sph_mag = M.cal_abs_mag() # Calculate the dust corrected version of abs mag for ALL sample # E and S0 does not require that but I calculate them nonethesless Abs_sph_mag_dustCorr = M.dust_correction_Driver08(Abs_sph_mag, elle) # Calculate the dust corrected version of i-band galaxy total mag for ALL sample
vel_err_index=7, scale_index=8, dir_name_index=0, dir_dist_index=3, dir_dist_err_index=4, dir_method_index=5, dir_method_flag_index=7) name1 = D["Gal_name"] DD1 = D["Dist"] DD1_err = D["Dist_err"] scale1 = D["Scale"] mag_g, mag_i = broad_cut[:, 10], broad_cut[:, 9] ML_select = SPlot.MLRelationIband(mag_g, mag_i).Into13_MassRatio M = SPlot.MassCalculation(mag_i, DD1, 4.53, mag_g, mag_i) E = M.cal_Mass(ML_select) import statistics import matplotlib.gridspec as gridspec fig = plt.figure() gs = gridspec.GridSpec(2, 1) axs1 = plt.subplot(gs[1]) axs0 = plt.subplot(gs[0]) #SPlot.ShowcaseIndi.show_name(DD1,E,name_b)
BL = SSort.vdis_match("./galaxy_bundle/Gal_bundle_equvi_cpt_LTG", "../result/velocity_disp/vel_disp_list_all_mag.txt", ["../result/distance/dir_dist_list.txt","../result/distance/dist_list.txt"], "./galaxy_bundle/Gal_vdis_dict_equvi_LTG") BE = SSort.vdis_match("./galaxy_bundle/Gal_bundle_equvi_cpt_ETG", "../result/velocity_disp/vel_disp_list_all_mag.txt", ["../result/distance/dir_dist_list.txt","../result/distance/dist_list.txt"], "./galaxy_bundle/Gal_vdis_dict_equvi_ETG") #%% #calculate the stellar mass, base on two different M/L realtion ML_select_1 = SPlot.MLRelationIband(A["mag_g"],A["mag_i"]).Into13_MassRatio M_1 = SPlot.MassCalculation(A["sph_mag"], A["Dist"], M_sun,A["mag_g"],A["mag_i"]) mass_1 = M_1.cal_Mass(ML_select_1) T_M_1 = SPlot.MassCalculation(A["total_mag"], A["Dist"], M_sun,A["mag_g"],A["mag_i"]) T_mass_1 = T_M_1.cal_Mass(ML_select_1) ML_select_2 = SPlot.MLRelationIband(A["mag_g"],A["mag_i"]).Taylor11_MassRatio M_2 = SPlot.MassCalculation(A["sph_mag"], A["Dist"], M_sun,A["mag_g"],A["mag_i"]) mass_2 = M_2.cal_Mass(ML_select_2) T_M_2 = SPlot.MassCalculation(A["total_mag"], A["Dist"], M_sun,A["mag_g"],A["mag_i"]) T_mass_2 = T_M_2.cal_Mass(ML_select_2) ##
mag2 = SRead.grab_mag("Gal_bundle_equvi_bin2_cpt", ["Bulge","CoreBulge"]) mag2_total = SRead.grab_parameter("Gal_bundle_equvi_bin2_cpt", ["Total_mag"],0) Re_kpc2 = R_e_2 * scale2 Mag2 = mag2 - 25 -5*np.log10(DD2) # with new distance system, NED, hyperleda Lum2 = 10**((Mag2-(4.53))/(-2.5)) #BD for bin2 name2BD = SRead.grab_parameter("Gal_bundle_BD_equvi_bin2_cpt", ["Bulge","CoreBulge"], 1) R_e_2_BD = SRead.grab_parameter("Gal_bundle_BD_equvi_bin2_cpt", ["Bulge","CoreBulge"], 1) #get Re mag2_BD = SRead.grab_mag("Gal_bundle_BD_equvi_bin2_cpt", ["Bulge","CoreBulge"]) Re_kpc2_BD = R_e_2_BD * scale2 Mag2_BD = mag2_BD - 25 -5*np.log10(DD2) Lum2_BD = 10**((Mag2_BD-(4.53))/(-2.5)) ML_select2 = SPlot.MLRelationIband(AbsMag_g_bin2,AbsMag_i_bin2).Into13_MassRatio M2 = SPlot.MassCalculation(mag2, DD2, M_sun,AbsMag_g_bin2,AbsMag_i_bin2) M2_total_old = SPlot.MassCalculation(mag2_total, dc2, M_sun,AbsMag_g_bin2,AbsMag_i_bin2) E2 = M2.cal_Mass(ML_select2) E2_total_old = M2_total_old.cal_Mass(ML_select2) M2_BD = SPlot.MassCalculation(mag2_BD, DD2, M_sun,AbsMag_g_bin2,AbsMag_i_bin2) E2_BD = M2_BD.cal_Mass(ML_select2)
Re_2_kpc) Re_3_kpc_lerr, Re_3_kpc_uerr = abs(Re_3 * scale3_lerr - Re_3_kpc), abs(Re_3 * scale3_uerr - Re_3_kpc) Re_1_kpc_err = [Re_1_kpc_lerr, Re_1_kpc_uerr] Re_2_kpc_err = [Re_2_kpc_lerr, Re_2_kpc_uerr] Re_3_kpc_err = [Re_3_kpc_lerr, Re_3_kpc_uerr] Sersic2D_50rad_1_kpc = Sersic2D_50rad_1 * scale1 Sersic2D_50rad_2_kpc = Sersic2D_50rad_2 * scale2 Sersic2D_50rad_3_kpc = Sersic2D_50rad_3 * scale3 ############# calculating spheroid mass ######## ML_select1_IP13 = SPlot.MLRelationIband(mag_g1, mag_i1).Into13_MassRatio ML_select1_R15BC = SPlot.MLRelationIband(mag_g1, mag_i1).Roediger15BC03_MassRatio ML_select1_Z09 = SPlot.MLRelationIband(mag_g1, mag_i1).Zibetti09_MassRatio ML_select1_T11 = SPlot.MLRelationIband(mag_g1, mag_i1).Taylor11_MassRatio M1 = SPlot.MassCalculation(sph_mag1, D1, 4.53, mag_g1, mag_i1) E1_IP13 = M1.cal_Mass(ML_select1_IP13) E1_R15BC = M1.cal_Mass(ML_select1_R15BC) E1_Z09 = M1.cal_Mass(ML_select1_Z09) E1_T11 = M1.cal_Mass(ML_select1_T11) ML_select2_IP13 = SPlot.MLRelationIband(mag_g2, mag_i2).Into13_MassRatio ML_select2_R15BC = SPlot.MLRelationIband(mag_g2, mag_i2).Roediger15BC03_MassRatio
def plot_sizemass_trans_3plots(xo_0=None, yo_0=None, xn_0=None, yn_0=None, name0=None, xo_1=None, yo_1=None, xn_1=None, yn_1=None, name1=None, xo_2=None, yo_2=None, xn_2=None, yn_2=None, name2=None, xo_3=None, yo_3=None, xn_3=None, yn_3=None, name3=None, xo_4=None, yo_4=None, xn_4=None, yn_4=None, name4=None, xo_5=None, yo_5=None, xn_5=None, yn_5=None, name5=None, xo_6=None, yo_6=None, xn_6=None, yn_6=None, name6=None, xo_7=None, yo_7=None, xn_7=None, yn_7=None, name7=None, xo_8=None, yo_8=None, xn_8=None, yn_8=None, name8=None): fig = plt.figure() gs = gridspec.GridSpec(ncols=3, nrows=3, hspace=0, wspace=0.0) axt0 = plt.subplot(gs[0]) plot_sizemass_trans(axt0, xo_0, yo_0, xn_0, yn_0) SPlot.SelectionCut(mass0, Dist0).plot_cut_specific("Barro", "", alpha0=0, AX=axt0) SPlot.SelectionCut(mass0, Dist0).plot_cut_specific("vdWel", "", alpha0=0, AX=axt0) SPlot.SelectionCut(mass0, Dist0).plot_cut_specific("vDokkum", "", alpha0=0, AX=axt0) #add_arrow(axt0,xo_0,yo_0,xn_0,yn_0) #SPlot.ShowcaseIndi.show_name(xo_0,yo_0, name0, A=axt0,size=16) axt0.text(text_location[0], text_location[1], r"$\rm Bin 1$", fontsize=22, color="#a5200b") axt0.text(text_location[0], text_location[1] - delta_text, r"$\rm E -> E$", fontsize=22, color="k") axt0.set_xlim(left=xlim_mo[0], right=xlim_mo[1]) axt0.set_ylim(bottom=ylim_mo[0], top=ylim_mo[1]) axt0.set_xscale('log') axt0.set_yscale('log') axt0.set_ylabel(r"$\rm R_{e}$ (kpc)", fontsize=16) axt0.set_xlabel(r"$\rm M_{*} / M_{\odot}$", fontsize=16) #axt0.legend(loc=4) #axt0.grid(True) axt1 = plt.subplot(gs[1], sharey=axt0) plot_sizemass_trans(axt1, xo_1, yo_1, xn_1, yn_1) SPlot.SelectionCut(mass0, Dist0).plot_cut_specific("Barro", None, alpha0=0, AX=axt1) SPlot.SelectionCut(mass0, Dist0).plot_cut_specific("vdWel", None, alpha0=0, AX=axt1) SPlot.SelectionCut(mass0, Dist0).plot_cut_specific("vDokkum", None, alpha0=0, AX=axt1) #add_arrow(axt1,xo_1,yo_1,xn_1,yn_1) #SPlot.ShowcaseIndi.show_name(xo_1,yo_1, name1, A=axt1,size=16) axt1.text(text_location[0], text_location[1], r"$\rm Bin 1$", fontsize=22, color="#a5200b") axt1.text(text_location[0], text_location[1] - delta_text, r"$\rm S0 -> E$", fontsize=22, color="k") axt1.set_xlim(left=xlim_mo[0], right=xlim_mo[1]) axt1.set_ylim(bottom=ylim_mo[0], top=ylim_mo[1]) axt1.set_xscale('log') axt1.set_yscale('log') axt1.set_xlabel(r"$\rm M_{*} / M_{\odot}$", fontsize=16) #axt1.legend(loc=4) #axt1.grid(True) plt.setp(axt1.get_yticklabels(), visible=False) axt2 = plt.subplot(gs[2], sharey=axt0) plot_sizemass_trans(axt2, xo_2, yo_2, xn_2, yn_2) SPlot.SelectionCut(mass0, Dist0).plot_cut_specific("Barro", None, alpha0=0, AX=axt2) SPlot.SelectionCut(mass0, Dist0).plot_cut_specific("vdWel", None, alpha0=0, AX=axt2) SPlot.SelectionCut(mass0, Dist0).plot_cut_specific("vDokkum", None, alpha0=0, AX=axt2) #add_arrow(axt2,xo_2,yo_2,xn_2,yn_2) #SPlot.ShowcaseIndi.show_name(xo_2,yo_2, name2, A=axt2,size=16) axt2.text(text_location[0], text_location[1], r"$\rm Bin 1$", fontsize=22, color="#a5200b") axt2.text(text_location[0], text_location[1] - delta_text, r"$\rm S -> E$", fontsize=22, color="k") axt2.set_xlim(left=xlim_mo[0], right=xlim_mo[1]) axt2.set_ylim(bottom=ylim_mo[0], top=ylim_mo[1]) axt2.set_xscale('log') axt2.set_yscale('log') axt2.set_xlabel(r"$\rm M_{*} / M_{\odot}$", fontsize=16) #axt2.legend(loc=4) #axt2.grid(True) plt.setp(axt2.get_yticklabels(), visible=False) axt3 = plt.subplot(gs[3]) plot_sizemass_trans(axt3, xo_3, yo_3, xn_3, yn_3) SPlot.SelectionCut(mass0, Dist0).plot_cut_specific("Barro", None, alpha0=0, AX=axt3) SPlot.SelectionCut(mass0, Dist0).plot_cut_specific("vdWel", None, alpha0=0, AX=axt3) SPlot.SelectionCut(mass0, Dist0).plot_cut_specific("vDokkum", None, alpha0=0, AX=axt3) #add_arrow(axt3,xo_3,yo_3,xn_3,yn_3) #SPlot.ShowcaseIndi.show_name(xo_3,yo_3, name3, A=axt3,size=16) axt3.text(text_location[0], text_location[1], r"$\rm Bin 2$", fontsize=22, color="#0b5786") axt3.text(text_location[0], text_location[1] - delta_text, r"$\rm E -> E$", fontsize=22, color="k") axt3.set_xlim(left=xlim_mo[0], right=xlim_mo[1]) axt3.set_ylim(bottom=ylim_mo[0], top=ylim_mo[1]) axt3.set_xscale('log') axt3.set_yscale('log') axt3.set_ylabel(r"$\rm R_{e}$ (kpc)", fontsize=16) #axt3.legend(loc=4) #axt3.grid(True) plt.setp(axt3.get_xticklabels(), visible=False) axt4 = plt.subplot(gs[4]) plot_sizemass_trans(axt4, xo_4, yo_4, xn_4, yn_4) SPlot.SelectionCut(mass0, Dist0).plot_cut_specific("Barro", None, alpha0=0, AX=axt4) SPlot.SelectionCut(mass0, Dist0).plot_cut_specific("vdWel", None, alpha0=0, AX=axt4) SPlot.SelectionCut(mass0, Dist0).plot_cut_specific("vDokkum", None, alpha0=0, AX=axt4) #add_arrow(axt4,xo_4,yo_4,xn_4,yn_4) #SPlot.ShowcaseIndi.show_name(xo_4,yo_4, name4, A=axt4,size=16) axt4.text(text_location[0], text_location[1], r"$\rm Bin 2$", fontsize=22, color="#0b5786") axt4.text(text_location[0], text_location[1] - delta_text, r"$\rm S0 -> E$", fontsize=22, color="k") axt4.set_xlim(left=xlim_mo[0], right=xlim_mo[1]) axt4.set_ylim(bottom=ylim_mo[0], top=ylim_mo[1]) axt4.set_xscale('log') axt4.set_yscale('log') #axt4.legend(loc=4) #axt4.grid(True) plt.setp(axt4.get_yticklabels(), visible=False) axt5 = plt.subplot(gs[5]) plot_sizemass_trans(axt5, xo_5, yo_5, xn_5, yn_5) SPlot.SelectionCut(mass0, Dist0).plot_cut_specific("Barro", None, alpha0=0, AX=axt5) SPlot.SelectionCut(mass0, Dist0).plot_cut_specific("vdWel", None, alpha0=0, AX=axt5) SPlot.SelectionCut(mass0, Dist0).plot_cut_specific("vDokkum", None, alpha0=0, AX=axt5) #add_arrow(axt5,xo_5,yo_5,xn_5,yn_5) #SPlot.ShowcaseIndi.show_name(xo_5,yo_5, name5, A=axt5,size=16) axt5.text(text_location[0], text_location[1], r"$\rm Bin 2$", fontsize=22, color="#0b5786") axt5.text(text_location[0], text_location[1] - delta_text, r"$\rm S -> E$", fontsize=22, color="k") axt5.set_xlim(left=xlim_mo[0], right=xlim_mo[1]) axt5.set_ylim(bottom=ylim_mo[0], top=ylim_mo[1]) axt5.set_xscale('log') axt5.set_yscale('log') #axt5.legend(loc=4) #axt5.grid(True) plt.setp(axt5.get_yticklabels(), visible=False) axt6 = plt.subplot(gs[6]) plot_sizemass_trans(axt6, xo_6, yo_6, xn_6, yn_6, label_new="Spheroids") SPlot.SelectionCut(mass0, Dist0).plot_cut_specific("Barro", "Barro et al. 2013", alpha0=0, AX=axt6) SPlot.SelectionCut(mass0, Dist0).plot_cut_specific("vdWel", "van der Wel et al. 2014", alpha0=0, AX=axt6) SPlot.SelectionCut(mass0, Dist0).plot_cut_specific("vDokkum", "van Dokkum et al. 2015", alpha0=0, AX=axt6) #add_arrow(axt6,xo_6,yo_6,xn_6,yn_6) #SPlot.ShowcaseIndi.show_name(xo_6,yo_6, name6, A=axt6,size=16) axt6.text(text_location[0], text_location[1], r"$\rm Bin 3$", fontsize=22, color="#2a3236") axt6.text(text_location[0], text_location[1] - delta_text, r"$\rm E -> E$", fontsize=22, color="k") axt6.set_xlim(left=xlim_mo[0], right=xlim_mo[1]) axt6.set_ylim(bottom=ylim_mo[0], top=ylim_mo[1]) axt6.set_xscale('log') axt6.set_yscale('log') axt6.legend(loc=3) #axt6.grid(True) axt6.set_ylabel(r"$\rm R_{e}$ (kpc)", fontsize=16) axt6.set_xlabel(r"$\rm M_{*} / M_{\odot}$", fontsize=16) axt7 = plt.subplot(gs[7]) plot_sizemass_trans(axt7, xo_7, yo_7, xn_7, yn_7) SPlot.SelectionCut(mass0, Dist0).plot_cut_specific("Barro", None, alpha0=0, AX=axt7) SPlot.SelectionCut(mass0, Dist0).plot_cut_specific("vdWel", None, alpha0=0, AX=axt7) SPlot.SelectionCut(mass0, Dist0).plot_cut_specific("vDokkum", None, alpha0=0, AX=axt7) #add_morph_marker(axt2,E3_R15BC,Re_3_kpc) #add_arrow(axt7,xo_7,yo_7,xn_7,yn_7) #SPlot.ShowcaseIndi.show_name(xo_7,yo_7, name7, A=axt7,size=16) axt7.text(text_location[0], text_location[1], r"$\rm Bin 3$", fontsize=22, color="#2a3236") axt7.text(text_location[0], text_location[1] - delta_text, r"$\rm S0 -> E$", fontsize=22, color="k") axt7.set_xlim(left=xlim_mo[0], right=xlim_mo[1]) axt7.set_ylim(bottom=ylim_mo[0], top=ylim_mo[1]) axt7.set_xscale('log') axt7.set_yscale('log') axt7.set_xlabel(r"$\rm M_{*} / M_{\odot}$", fontsize=16) #axt7.legend(loc=4) #axt7.grid(True) plt.setp(axt7.get_yticklabels(), visible=False) axt8 = plt.subplot(gs[8]) plot_sizemass_trans(axt8, xo_8, yo_8, xn_8, yn_8) SPlot.SelectionCut(mass0, Dist0).plot_cut_specific("Barro", None, alpha0=0, AX=axt8) SPlot.SelectionCut(mass0, Dist0).plot_cut_specific("vdWel", None, alpha0=0, AX=axt8) SPlot.SelectionCut(mass0, Dist0).plot_cut_specific("vDokkum", None, alpha0=0, AX=axt8) #add_morph_marker(axt2,E3_R15BC,Re_3_kpc) #add_arrow(axt8,xo_8,yo_8,xn_8,yn_8) #SPlot.ShowcaseIndi.show_name(xo_8,yo_8, name8, A=axt8,size=18) axt8.text(text_location[0], text_location[1], r"$\rm Bin 3$", fontsize=22, color="#2a3236") axt8.text(text_location[0], text_location[1] - delta_text, r"$\rm S -> E$", fontsize=22, color="k") axt8.set_xlim(left=xlim_mo[0], right=xlim_mo[1]) axt8.set_ylim(bottom=ylim_mo[0], top=ylim_mo[1]) axt8.set_xscale('log') axt8.set_yscale('log') axt8.set_xlabel(r"$\rm M_{*} / M_{\odot}$", fontsize=16) #axt8.legend(loc=4) #axt8.grid(True) plt.setp(axt8.get_yticklabels(), visible=False) plt.show()
dtype='str') K_table2_n = SRead.read_table( "/home/dexter/result/stat/completeness/diagonal_selection_bag3_Bin2V_Kcorr.dat", dtype='str') K_table3_n = SRead.read_table( "/home/dexter/result/stat/completeness/diagonal_selection_bag3_Bin3V_Kcorr.dat", dtype='str') K_name1, K_name2, K_name3 = K_table1_n[:, 4], K_table2_n[:, 4], K_table3_n[:, 4] mag_g1_kcorr, mag_i1_kcorr = K_table1[:, 19], K_table1[:, 18] mag_g2_kcorr, mag_i2_kcorr = K_table2[:, 19], K_table2[:, 18] mag_g3_kcorr, mag_i3_kcorr = K_table3[:, 19], K_table3[:, 18] ML_select1_IP13_K = SPlot.MLRelationIband(mag_g1_kcorr, mag_i1_kcorr).Into13_MassRatio ML_select1_R15BC_K = SPlot.MLRelationIband( mag_g1_kcorr, mag_i1_kcorr).Roediger15BC03_MassRatio ML_select1_Z09_K = SPlot.MLRelationIband(mag_g1_kcorr, mag_i1_kcorr).Zibetti09_MassRatio ML_select1_T11_K = SPlot.MLRelationIband(mag_g1_kcorr, mag_i1_kcorr).Taylor11_MassRatio M1_K = SPlot.MassCalculation(sph_mag1, D1, 4.53, mag_g1_kcorr, mag_i1_kcorr) E1_IP13_K = M1_K.cal_Mass(ML_select1_IP13_K) E1_R15BC_K = M1_K.cal_Mass(ML_select1_R15BC_K) E1_Z09_K = M1_K.cal_Mass(ML_select1_Z09_K) E1_T11_K = M1_K.cal_Mass(ML_select1_T11_K) ML_select2_IP13_K = SPlot.MLRelationIband(mag_g2_kcorr,
Re_kpc = R_e * scale R_e_BD = SRead.grab_parameter("Gal_bundle_BD_equvi_cpt", ["Bulge", "CoreBulge"], 1) #get Re Re_kpc_BD = R_e_BD * scale mag = SRead.grab_mag("Gal_bundle_equvi_cpt", ["Bulge", "CoreBulge"]) mag_BD = SRead.grab_mag("Gal_bundle_BD_equvi_cpt", ["Bulge", "CoreBulge"]) #mag2_total = SRead.grab_parameter("Gal_bundle_equvi_bin2_cpt", ["Total_mag"],0) A = SRead.read_list("Gal_vdis_dict_equvi") mag_g, mag_i = A["mag_g"], A["mag_i"] ML_select = SPlot.MLRelationIband(mag_g, mag_i).Into13_MassRatio M = SPlot.MassCalculation(mag, DD, 4.53, mag_g, mag_i) E = M.cal_Mass(ML_select) M_BD = SPlot.MassCalculation(mag_BD, DD, 4.53, mag_g, mag_i) E_BD = M_BD.cal_Mass(ML_select) #SPlot.ShowcaseCompare2.plot_scat_arrow(E_BD,Re_kpc_BD,[],'bo',"B+D", E,Re_kpc,[],'ro',"Multi") #plt.show() SPlot.ShowcaseCompare2.plot_seperation_generic(Re_kpc_BD, Re_kpc, 1, para_name="", colour1="blue", colour2="orange",
Re_3_kpc_err = [Re_3_kpc_lerr, Re_3_kpc_uerr] ################################ #Calculate mass with K-correction K_table3 = SRead.read_table( "/home/dexter/result/stat/completeness/diagonal_selection_bag3_Bin3V_Kcorr.dat" ) K_table3_n = SRead.read_table( "/home/dexter/result/stat/completeness/diagonal_selection_bag3_Bin3V_Kcorr.dat", dtype='str') K_name3 = K_table3_n[:, 4] mag_g3_kcorr, mag_i3_kcorr = K_table3[:, 19], K_table3[:, 18] ML_select3_IP13_K = SPlot.MLRelationIband(mag_g3_kcorr, mag_i3_kcorr).Into13_MassRatio ML_select3_R15BC_K = SPlot.MLRelationIband( mag_g3_kcorr, mag_i3_kcorr).Roediger15BC03_MassRatio ML_select3_Z09_K = SPlot.MLRelationIband(mag_g3_kcorr, mag_i3_kcorr).Zibetti09_MassRatio ML_select3_T11_K = SPlot.MLRelationIband(mag_g3_kcorr, mag_i3_kcorr).Taylor11_MassRatio M3_K = SPlot.MassCalculation(sph_mag3, D3, 4.53, mag_g3_kcorr, mag_i3_kcorr) E3_IP13_K = M3_K.cal_Mass(ML_select3_IP13_K) E3_R15BC_K = M3_K.cal_Mass(ML_select3_R15BC_K) E3_Z09_K = M3_K.cal_Mass(ML_select3_Z09_K) E3_T11_K = M3_K.cal_Mass(ML_select3_T11_K) ################################