axs[i].set_ylim(0,50) axs[i].set_xlabel(lab[i], fontsize = 14) axs[i].text(-1.4, 45, "$\mu={0:5.2f}$".format(avr_pho[i]), fontsize = 14, color = "r") axs[i].text(-1.4, 39, "$\mu={0:5.2f}$".format(avr_sed[i]), fontsize = 14) #axs[i].text(-1.4, 46, "$\mu={0:5.2f}$".format(avr_sed[i]), fontsize = 14) #axs[i].text(-1.4, 40, "$\sigma={0:5.2f}$".format(std_sed[i]), fontsize = 14) fig.text(0.05, 0.55, r"$\bf Frequency$", fontsize = 14, rotation = "vertical") #axs[i].set_yticks([]) if i == 2 : axs[i].set_xticks(axs[i].get_xticks()[:- 1]) if i == 1 or i == 3 : axs[i].tick_params(labelleft = False, labelright = True) if i == 2 : axs[i].hist(res_sed[i], 10, ec = "#7F7F7F", fc = "#7F7F7F") axs[i].hist(res_pho[i], 10, ec = "k", fc = "none", ls = "dotted", histtype = "step") else : axs[i].hist(res_sed[i], rt.nbins(res_pho[i], range_ = ran)[0], ec = "#7F7F7F", fc = "#7F7F7F") axs[i].hist(res_pho[i], rt.nbins(res_pho[i], range_ = ran)[0], ec = "k", fc = "none", ls = "dotted", histtype = "step") axs[i].axvline(avr_pho[i], ls = "--", color = "r", lw = 2, label = r"${\rm photo\,SED}$") axs[i].axvline(avr_sed[i], ls = "--", color = "k", lw = 2, label = r"${\rm full\,SED}$") #axs[i].text(-1.49, 1.0, r"$68\%\,{\rm range}\,{\rm ratio}$", fontsize = 12) #if i == 0 : axs[i].legend(loc = "upper left", frameon = False, fontsize = 12) #plt.tight_layout() fig.subplots_adjust(wspace = 0.0) plt.savefig("../../plots/photometric_fit/residual_hists_sed.pdf", bbox_inches = "tight") #plt.savefig("../../plots/photometric_fit/residual_hists.png", bbox_inches = "tight") #plt.show()
lcolor_x = (u_lib - g_lib)[dmask] lcolor_y = (g_lib - r_lib)[dmask] #lcolor_y = (r_lib - i_lib)[dmask] scolor_x = (u_sam - g_sam) scolor_y = (g_sam - r_sam) #scolor_y = (r_sam - i_sam) # define plot properties --------------------------------------------------------------------------- fig, axs = plt.subplots(2, 2, sharex="col", sharey="row", figsize=(10, 9)) # construct 0.1 models per bin contour of SSAG ----------------------------------------------------- nx, xi, xf, bsx = nbins(lcolor_x) ny, yi, yf, bsy = nbins(lcolor_y) print("bin sizes:") print("xbins : {0:5.3f}".format(bsx)) print("ybins : {0:5.3f}".format(bsy)) H, xe, ye = np.histogram2d(lcolor_x, lcolor_y, bins=(nx, ny), normed=True) H = gaussian_filter(H, sigma=2) # plot contour and residual of sample model galaxies ----------------------------------------------- my_cm = mpl.colors.ListedColormap(np.loadtxt("colormap.dat") / 255) for i, ax in enumerate(np.ravel(axs)): ax.set_xlim(0.5, 2.5) ax.set_ylim(0.0, 1.25)
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) lcolor_x = (u_lib - g_lib)[((V - pV) < 1.2) & (mu < 1.)] lcolor_y = (g_lib - r_lib)[((V - pV) < 1.2) & (mu < 1.)] zmask = redshift < 0.03 ocolor_x = (u_obs - g_obs)[zmask] ocolor_y = (g_obs - r_obs)[zmask] ug = np.repeat(u - g, 100) gr = np.repeat(g - r, 100) nx, xi, xf, bsx = rt.nbins(ocolor_x) ny, yi, yf, bsy = rt.nbins(ocolor_y) H, xe, ye = np.histogram2d(ocolor_x, ocolor_y, bins = (nx, ny), normed = True) H = gaussian_filter(H, sigma = 2) lab = [r"$M/M_\textrm{SSAG}$", r"$\left<\log(t)\right>_M$", r"$\left<\log(Z/Z_\odot)\right>_M$", r"$A_V$"] plt.figure(figsize = (9, 8)) axs = [plt.subplot2grid((16, 17), (0, 0), rowspan = 8, colspan = 8), plt.subplot2grid((16, 17), (0, 8), rowspan = 8, colspan = 8), plt.subplot2grid((16, 17), (8, 0), rowspan = 8, colspan = 8), plt.subplot2grid((16, 17), (8, 8), rowspan = 8, colspan = 8)] axc = plt.subplot2grid((16, 17), (0, 16), rowspan = 16, colspan = 1)
lcolor_x = (u_lib - g_lib)[dmask] lcolor_y = (g_lib - r_lib)[dmask] #lcolor_y = (r_lib - i_lib)[dmask] scolor_x = (u_sam - g_sam) scolor_y = (g_sam - r_sam) #scolor_y = (r_sam - i_sam) # define plot properties --------------------------------------------------------------------------- fig, axs = plt.subplots(2, 2, sharex = "col", sharey = "row", figsize = (10,9)) # construct 0.1 models per bin contour of SSAG ----------------------------------------------------- nx, xi, xf, bsx = nbins(lcolor_x) ny, yi, yf, bsy = nbins(lcolor_y) print("bin sizes:") print("xbins : {0:5.3f}".format(bsx)) print("ybins : {0:5.3f}".format(bsy)) H, xe, ye = np.histogram2d(lcolor_x, lcolor_y, bins = (nx, ny), normed = True) H = gaussian_filter(H, sigma = 2) # plot contour and residual of sample model galaxies ----------------------------------------------- my_cm = mpl.colors.ListedColormap(np.loadtxt("colormap.dat") / 255) for i, ax in enumerate(np.ravel(axs)) : ax.set_xlim(0.5, 2.5) ax.set_ylim(0.0, 1.25)
ran = axs[i].set_xlim(-1.5, +1.5) axs[i].set_ylim(0, 35) axs[i].set_xlabel(lab[i], fontsize=14) axs[i].text(-1.4, 32, "$\mu={0:5.2f}$".format(avr[i]), fontsize=14) axs[i].text(-1.4, 27, "$\sigma={0:5.2f}$".format(std[i]), fontsize=14) fig.text(0.05, 0.55, r"$\bf Frequency$", fontsize=14, rotation="vertical") #axs[i].set_yticks([]) if i == 2: axs[i].set_xticks(axs[i].get_xticks()[:-1]) if i == 1 or i == 3: axs[i].tick_params(labelleft=False, labelright=True) if i == 2: axs[i].hist(res[i], 10, ec="#7F7F7F", fc="#7F7F7F") else: axs[i].hist(res[i], rt.nbins(res[i], range_=ran)[0], ec="#7F7F7F", fc="#7F7F7F") axs[i].axvline(avr[i], ls="--", color="k", lw=2, label=r"${\bf mean}$") #axs[i].axvline(med[i], ls = "--", color = "r", lw = 1, label = r"${\bf median}$") axs[i].axvline(avr[i] - std[i], ls="-.", color="k", lw=2, label=r"${\bf std.\,deviation}$") axs[i].axvline(avr[i] + std[i], ls="-.", color="k", lw=2) #if i == 0 : axs[i].legend(loc = "upper left", frameon = False, fontsize = 12) #plt.tight_layout() fig.subplots_adjust(wspace=0.0)