#!/usr/bin/python import numpy as np import matplotlib.pyplot as plt import scipy.stats.mstats as st import thesis_redux_tools as rt name_pho = np.loadtxt("../../inputs/SFHs_set3/set3_list.log", usecols = (0,), dtype = "|S") name_sed = np.loadtxt("../../outputs/spectroscopic_fit/names.log", dtype = "|S") order_sed = [j for i in xrange(120) for j in xrange(12000) if name_pho[i] == name_sed[j][:12]+".fits.gz"] tform, mass, burstm, burstm, hdelta, b4000 = np.loadtxt("../../inputs/set3_catalog.txt", usecols = (5, 16, 17, 18, 44, 45), unpack = True) table = np.loadtxt("../../outputs/photometric_fit/remote_set3/photofit_SDSS.physical") table[:, 2:6] = 10 ** table[:, 2:6] table = rt.binned_stat(table, 100) ave_sed = np.loadtxt("../../outputs/spectroscopic_fit/table_din.v3.log")[order_sed] ave_sed[:, 1:3] = 10 ** ave_sed[:, 1:3] ave_sed = rt.binned_stat(ave_sed, bin_size = 100) #res_pho = [rt.err(table[:, i], table[:, i + 1]) if i in [0] else rt.err(table[:, i], table[:, i + 1], False) for i in xrange(0, 10, 2)] #res_sed = [rt.err(table[:, ::2][:, i], ave_sed[:, i]) if i in [0] else rt.err(table[:, ::2][:, i], ave_sed[:, i], False) for i in xrange(5)] # -------------------------------------------------------------------------------------------------- lm = np.array([0, 8]) plt.figure(figsize = (6.5, 6)) plt.plot(lm, lm, "--k") tks, tls = [], []
r_sam.append(f[0].header["rmag"]) i_sam.append(f[0].header["imag"]) z_sam.append(f[0].header["zmag"]) phy_sam.append([f[0].header["mass"], f[0].header["mwla"], f[0].header["rfwla"], f[0].header["z"], f[0].header["v"] - f[0].header["pv"]]) u_sam = np.array(u_sam) g_sam = np.array(g_sam) r_sam = np.array(r_sam) i_sam = np.array(i_sam) z_sam = np.array(z_sam) phy_sam = np.array(phy_sam) phy_mod = np.loadtxt("../../outputs/photometric_fit/remote_set1/phot_fit.models", usecols = range(5, 10)) med = binned_stat(phy_mod, 100, stat = "median") std = binned_stat(phy_mod, 100, stat = "stdev") # read SFH library data ---------------------------------------------------------------------------- sfhs_cat = "../../inputs/run07_sfh_catalog.txt" u_lib, g_lib, r_lib, i_lib, z_lib, V, pV, mu = np.genfromtxt(sfhs_cat, missing = '""', usecols = range(39, 44) + [38, 25, 14], unpack = True) # define mask -------------------------------------------------------------------------------------- dmask = (V - pV < 2.0) & (mu <= 1.0) # MAKE PLOT ======================================================================================== # define color-color plane -------------------------------------------------------------------------
f[0].header["mass"], f[0].header["mwla"], f[0].header["rfwla"], f[0].header["z"], f[0].header["v"] - f[0].header["pv"] ]) u_sam = np.array(u_sam) g_sam = np.array(g_sam) r_sam = np.array(r_sam) i_sam = np.array(i_sam) z_sam = np.array(z_sam) phy_sam = np.array(phy_sam) phy_mod = np.loadtxt( "../../outputs/photometric_fit/remote_set1/phot_fit.models", usecols=range(5, 10)) med = binned_stat(phy_mod, 100, stat="median") std = binned_stat(phy_mod, 100, stat="stdev") # read SFH library data ---------------------------------------------------------------------------- sfhs_cat = "../../inputs/run07_sfh_catalog.txt" u_lib, g_lib, r_lib, i_lib, z_lib, V, pV, mu = np.genfromtxt( sfhs_cat, missing='""', usecols=range(39, 44) + [38, 25, 14], unpack=True) # define mask -------------------------------------------------------------------------------------- dmask = (V - pV < 2.0) & (mu <= 1.0) # MAKE PLOT ======================================================================================== # define color-color plane -------------------------------------------------------------------------
from mpl_toolkits.axes_grid1.inset_locator import inset_axes from scipy.ndimage.filters import gaussian_filter from matplotlib import rc, cm from matplotlib.colors import ListedColormap as LC import sys sdss_cat = "../../../degree_thesis/data/photometry/total_photometry.txt" u_obs, g_obs, r_obs, i_obs, z_obs, redshift = np.loadtxt(sdss_cat, usecols = range(1, 6) + [11], unpack = True) name_sed = np.loadtxt("../../outputs/spectroscopic_fit/names.log", dtype = "|S") name_pho = np.loadtxt("../../inputs/SFHs_set3/set3_list.log", usecols = (0,), dtype = "|S") order_sed = [j for i in xrange(120) for j in xrange(12000) if name_pho[i] == name_sed[j][:12]+".fits.gz"] table = np.loadtxt("../../outputs/photometric_fit/remote_set3/photofit_SDSS.physical") ave_sed = rt.binned_stat(np.loadtxt("../../outputs/spectroscopic_fit/table_din.v4.log")[order_sed], bin_size = 1) chis = ave_sed[:, 5:] ave_sed = ave_sed[:, :5] sfhs_cat = "../../inputs/run09_sfh_catalog.txt" u_lib, g_lib, r_lib, i_lib, z_lib, tm, tf, tform, Z, V, pV, mass, mass1gyr, A, mu = np.genfromtxt(sfhs_cat, missing = '""', usecols = range(39, 44) + [33, 35, 5, 12, 38, 25, 16, 18, 19, 14], unpack = True) u, g, r, i, z = np.genfromtxt("../../inputs/set3_catalog.txt", usecols = range(39, 39 + 5), unpack = True, missing = '""') table[:, 6:8] = np.log10(table[:, 6:8]) res_sed = [rt.err(table[:, ::2][:, i], ave_sed[:, i]) if i in [0] else rt.err(table[:, ::2][:, i], ave_sed[:, i], False) for i in xrange(5)] res_sed.pop(2)
i.append(f[0].header["imag"]) z.append(f[0].header["zmag"]) sfr.append(f[0].header["mass1gyr"] / f[0].header["mass"]) u = np.repeat(u, 100) g = np.repeat(g, 100) r = np.repeat(r, 100) i = np.repeat(i, 100) z = np.repeat(z, 100) sfr = np.array(sfr) ur = (u - r)[table[:, 6] > 0.4] table = rt.binned_stat(table, 100, "median") ur = rt.binned_stat(ur, 100, "median") table[:, 6:8] = np.log10(table[:, 6:8]) res = [ rt.err(table[:, i], table[:, i + 1]) if i == 0 else rt.err(table[:, i], table[:, i + 1], False) for i in xrange(0, 10, 2) ] lab = [ r"$\Delta\,M/M_\textrm{SSAG}$", r"$\Delta\,\left<\log(t)\right>_M$", r"$\Delta\,\left<\log(t)\right>_{L_r}$", r"$\Delta\,\left<\log(Z/Z_\odot)\right>_M$", r"$\Delta\,A_V$"
#!/usr/bin/python import numpy as np import matplotlib.pyplot as plt import scipy.stats.mstats as st import thesis_redux_tools as rt table = np.loadtxt( "../../outputs/photometric_fit/photoz/photofit_JPASz3p00.physical") table = rt.binned_stat(table, 50) table[:, 2:6] = 10**table[:, 2:6] res_pho = [ rt.err(table[:, i], table[:, i + 1]) if i in [0] else rt.err( table[:, i], table[:, i + 1], False) for i in xrange(0, 10, 2) ] #print table[np.argmax(res_pho[0]), 0], np.max(res_pho[0]) #print table[np.argmax(res_pho[1]), 2], np.max(res_pho[1]) mask = table[:, 6] > 0.4 # -------------------------------------------------------------------------------------------------- lm = np.array([0, 1]) plt.figure(figsize=(8, 7)) plt.plot(lm, lm, "--k") tks, tls = [], [] for per in [10, 30, 50]:
dtype="|S") name_sed = np.loadtxt("../../outputs/spectroscopic_fit/names.log", dtype="|S") order_sed = [ j for i in xrange(120) for j in xrange(12000) if name_pho[i] == name_sed[j][:12] + ".fits.gz" ] tform, mass, burstm, burstm, hdelta, b4000 = np.loadtxt( "../../inputs/set3_catalog.txt", usecols=(5, 16, 17, 18, 44, 45), unpack=True) table = np.loadtxt( "../../outputs/photometric_fit/remote_set3/photofit_SDSS.physical") table[:, 2:6] = 10**table[:, 2:6] table = rt.binned_stat(table, 100) ave_sed = np.loadtxt( "../../outputs/spectroscopic_fit/table_din.v3.log")[order_sed] ave_sed[:, 1:3] = 10**ave_sed[:, 1:3] ave_sed = rt.binned_stat(ave_sed, bin_size=100) #res_pho = [rt.err(table[:, i], table[:, i + 1]) if i in [0] else rt.err(table[:, i], table[:, i + 1], False) for i in xrange(0, 10, 2)] #res_sed = [rt.err(table[:, ::2][:, i], ave_sed[:, i]) if i in [0] else rt.err(table[:, ::2][:, i], ave_sed[:, i], False) for i in xrange(5)] # -------------------------------------------------------------------------------------------------- lm = np.array([0, 8]) plt.figure(figsize=(6.5, 6)) plt.plot(lm, lm, "--k")
#!/usr/bin/python import numpy as np import matplotlib.pyplot as plt import scipy.stats.mstats as st import thesis_redux_tools as rt table = np.loadtxt("../../outputs/photometric_fit/photoz/photofit_JPASz3p00.physical") table = rt.binned_stat(table, 50) table[:, 2:6] = 10 ** table[:, 2:6] res_pho = [rt.err(table[:, i], table[:, i + 1]) if i in [0] else rt.err(table[:, i], table[:, i + 1], False) for i in xrange(0, 10, 2)] #print table[np.argmax(res_pho[0]), 0], np.max(res_pho[0]) #print table[np.argmax(res_pho[1]), 2], np.max(res_pho[1]) mask = table[:, 6] > 0.4 # -------------------------------------------------------------------------------------------------- lm = np.array([0, 1]) plt.figure(figsize = (8, 7)) plt.plot(lm, lm, "--k") tks, tls = [], [] for per in [10, 30, 50] : m1, m2 = rt.err_slope(per) tks.append(m2 * lm[1]) tls.append((str(per) + r"\%"))