def plot_color_vs_mass_vs_icd(): galaxies = mk_galaxy_struc() # Add the figures # Mass vs color plot I-H f1 = pyl.figure(1, figsize=(6, 4)) f1s1 = f1.add_subplot(212) color1 = [] mass1 = [] icd1 = [] for i in range(len(galaxies)): if galaxies[i].ston_I > 30.0: if -0.05 < galaxies[i].ICD_IH and galaxies[i].ICD_IH < 0.25: mass1.append(galaxies[i].Mass) color1.append(galaxies[i].Imag - galaxies[i].Hmag) icd1.append(galaxies[i].ICD_IH) else: mass1.append(galaxies[i].Mass) color1.append(galaxies[i].Imag - galaxies[i].Hmag) icd1.append(0.25) # Sort the arrays by ICD mass1 = pyl.asarray(mass1) color1 = pyl.asarray(color1) icd1 = pyl.asarray(icd1) IH_array = pyl.column_stack((mass1, color1, icd1)) IH_array = colsort(IH_array, 3) sc1 = f1s1.scatter(IH_array[:, 0], IH_array[:, 1], c=IH_array[:, 2], s=50, cmap='spectral') ############ # FIGURE 1 # ############ bar = pyl.colorbar(sc1) bar.set_label(r"$\xi[I,H]$") f1s1.set_xscale('log') f1s1.set_xlim(3e7, 1e12) f1s1.set_ylim(0.0, 4.0) f1s1.set_xlabel(r"Mass $[M_{\odot}]$") f1s1.set_ylabel("$(I-H)_{Observed}$") # pyl.subplots_adjust(left=0.15, bottom=0.15, right=.75) # pyl.savefig('color_vs_mass_vs_icd_IH.eps',bbox='tight') return f1s1
def plot_color_vs_mass_vs_icd(): galaxies=mk_galaxy_struc() # Add the figures # Mass vs color plot I-H f1 = pyl.figure(1,figsize=(6,4)) f1s1 = f1.add_subplot(212) color1 = [] mass1 = [] icd1 = [] for i in range(len(galaxies)): if galaxies[i].ston_I >30.0: if -0.05 < galaxies[i].ICD_IH and galaxies[i].ICD_IH < 0.25: mass1.append(galaxies[i].Mass) color1.append(galaxies[i].Imag-galaxies[i].Hmag) icd1.append(galaxies[i].ICD_IH) else: mass1.append(galaxies[i].Mass) color1.append(galaxies[i].Imag-galaxies[i].Hmag) icd1.append(0.25) # Sort the arrays by ICD mass1 = pyl.asarray(mass1) color1 = pyl.asarray(color1) icd1 = pyl.asarray(icd1) IH_array = pyl.column_stack((mass1,color1,icd1)) IH_array = colsort(IH_array,3) sc1 = f1s1.scatter(IH_array[:,0], IH_array[:,1], c=IH_array[:,2], s=50, cmap='spectral') ############ # FIGURE 1 # ############ bar = pyl.colorbar(sc1) bar.set_label(r"$\xi[I,H]$") f1s1.set_xscale('log') f1s1.set_xlim(3e7,1e12) f1s1.set_ylim(0.0,4.0) f1s1.set_xlabel(r"Mass $[M_{\odot}]$") f1s1.set_ylabel("$(I-H)_{Observed}$") # pyl.subplots_adjust(left=0.15, bottom=0.15, right=.75) # pyl.savefig('color_vs_mass_vs_icd_IH.eps',bbox='tight') return f1s1
def plot_uvj_vs_icd(): galaxies = mk_galaxy_struc() #Take out the UDF data galaxies = filter(lambda galaxy: galaxy.field == 1, galaxies) galaxies = filter(lambda galaxy: -0.05 < galaxy.ICD_IH < 0.25, galaxies) #f,(ax1, ax2) = pyl.subplots(1,2,sharex=True, sharey=True,figsize=(6.25,4.5)) F = pyl.figure(1, figsize=(6, 3.1)) grid = AxesGrid(F, 111, nrows_ncols=(1, 2), axes_pad=0.1, add_all=True, label_mode='L', share_all=True, cbar_location='top', cbar_mode='single') ax1 = grid[0] ax2 = grid[1] uv = [] vj = [] icd = [] uv_all = [] vj_all = [] icd_all = [] appenduv = uv.append appendvj = vj.append appendicd = icd.append appenduv_all = uv_all.append appendvj_all = vj_all.append appendicd_all = icd_all.append #Build Arrays for galaxy in galaxies: if galaxy.ston_I > 30. and galaxy.ston_H > 30.: appenduv(-2.5 * pyl.log10(galaxy.Uflux_rest / galaxy.Vflux_rest)) appendvj(-2.5 * pyl.log10(galaxy.Vflux_rest / galaxy.Jflux_rest)) appendicd(pyl.log10(galaxy.Mass)) appenduv_all(-2.5 * pyl.log10(galaxy.Uflux_rest / galaxy.Vflux_rest)) appendvj_all(-2.5 * pyl.log10(galaxy.Vflux_rest / galaxy.Jflux_rest)) appendicd_all(pyl.log10(galaxy.Mass)) #Convert to Numpy Array uv = pyl.asarray(uv) vj = pyl.asarray(vj) icd = pyl.asarray(icd) uv_all = pyl.asarray(uv_all) vj_all = pyl.asarray(vj_all) icd_all = pyl.asarray(icd_all) #Build Plotting Matrices cut = pyl.column_stack((uv, vj, icd)) total = pyl.column_stack((uv_all, vj_all, icd_all)) cut = colsort(cut, 3) total = colsort(total, 3) #plot! sc1 = ax1.scatter(total[:, 1], total[:, 0], c=total[:, 2], s=50, cmap='spectral') sc2 = ax2.scatter(cut[:, 1], cut[:, 0], c=cut[:, 2], s=50, cmap='spectral') #Add Lines ax1.set_ylim(-0.5, 2.5) ax1.set_xlim(-1.5, 2.5) limits = ax1.axis() ax1.axis x = [limits[0], 0.69, 1.4, 1.4] y = [1.2, 1.2, 1.82, limits[3]] ax1.plot(x, y, lw=2, c='k') ax2.plot(x, y, lw=2, c='k') #Add the color bar and labels and stuff grid.cbar_axes[0].colorbar(sc2) ax = grid.cbar_axes[0] ax.axis["top"].toggle(ticks=True, ticklabels=True, label=True) ax.set_xlabel('Log Mass $[M_{\odot}]$') grid.axes_llc.set_xticks([-1, 0, 1, 2]) grid.axes_llc.set_yticks([0, 1, 2]) ax1.set_ylabel('$U-V_{Rest}$') ax1.set_xlabel('$V-J_{Rest}$') ax2.set_xlabel('$V-J_{Rest}$') #pyl.savefig('UVJ_vs_mass.eps',bbox='tight') pyl.show()
axes_pad=0.05, add_all=True, share_all=True, aspect=True, direction='row') base = './../../images_v5/GS_2.5as_matched/gs_all_' galaxies = pickle.load(open('galaxies.pickle', 'rb')) galaxies = filter(lambda galaxy: galaxy.ston_I > 30, galaxies) d = [[galaxy.ICD_IH*100, galaxy.Mass, galaxy.ID] for galaxy in galaxies if\ galaxy.Mass > 11] d = pyl.asarray(d) d = colsort(d) d1 = d[:3] d2 = d[3:7] d3 = d[7:] for i, (icd, mass, ID) in enumerate(zip(d1[:, 0], d1[:, 1], d1[:, 2])): print icd, mass, ID H = pyf.getdata(base + str(int(ID)) + '_H.fits') I = pyf.getdata(base + str(int(ID)) + '_I.fits') H = img_scale.asinh(H, non_linear=0.5) I = img_scale.asinh(I, non_linear=0.5) grid[i * 3].imshow(I, origin='lower', cmap='PuBu_r') grid[i * 3 + 1].imshow(H, origin='lower', cmap='PuBu_r')
import img_scale F = pyl.figure(1, figsize=(6,4)) base = './../../images_v5/GS_2.5as_matched/gs_all_' galaxies = pickle.load(open('galaxies.pickle','rb')) galaxies = filter(lambda galaxy: 30>galaxy.ston_I > 10, galaxies) d = [[galaxy.ICD_IH_cored*100, galaxy.Mass, galaxy.ID, galaxy.ston_I] for galaxy in galaxies if\ galaxy.Mass > 11] d = pyl.asarray(d) print len(d) grid = axes_grid.ImageGrid(F, 111, nrows_ncols=(3,len(d)), axes_pad=0.05, add_all=True, share_all=True, aspect=True, direction='column') d = colsort(d) d1 = d #d1 = d[:5] #d2 = d[5:] for i, (icd, mass, ID, s) in enumerate(zip(d1[:,0], d1[:,1], d1[:,2], d1[:,3])): print icd, mass, ID H = pyf.getdata(base+str(int(ID))+'_H.fits') I = pyf.getdata(base+str(int(ID))+'_I.fits') H = img_scale.asinh(H, non_linear=0.5) I = img_scale.asinh(I, non_linear=0.5) grid[i*3].imshow(I, origin='lower', cmap='PuBu_r') grid[i*3+1].imshow(H, origin='lower', cmap='PuBu_r')
def plot_uvj_vs_icd(): #galaxies=mk_galaxy_struc() galaxies = pickle.load(open('galaxies.pickle', 'rb')) #Take out the UDF data #galaxies = filter(lambda galaxy: galaxy.field == 1, galaxies) #galaxies = filter(lambda galaxy: -0.05 < galaxy.ICD_IH < 0.25, galaxies) galaxies = filter(lambda galaxy: galaxy.ICD_IH != None, galaxies) #f,(ax1, ax2) = pyl.subplots(1,2,sharex=True, sharey=True,figsize=(6.25,4.5)) F = pyl.figure(1, figsize=(8, 4)) grid = AxesGrid(F, 111, nrows_ncols=(1, 3), axes_pad=0.1, add_all=True, label_mode='L', share_all=True, cbar_location='top', cbar_mode='each') ax1 = grid[0] ax2 = grid[1] ax3 = grid[2] uv = [] vj = [] icd = [] mass = [] appenduv = uv.append appendvj = vj.append appendicd = icd.append appendmass = mass.append #Build Arrays for galaxy in galaxies: if galaxy.ston_I > 30.: appenduv(-2.5 * pyl.log10(galaxy.Uflux_rest / galaxy.Vflux_rest)) appendvj(-2.5 * pyl.log10(galaxy.Vflux_rest / galaxy.Jflux_rest)) if galaxy.ICD_IH > 0.5: appendicd(0.5) else: appendicd(galaxy.ICD_IH) appendmass(galaxy.Mass) x = [g for g in galaxies if g.ston_I > 30. and g.Mips != None] uv2 = [] vj2 = [] mips = [] appenduv2 = uv2.append appendvj2 = vj2.append appendmips = mips.append for galaxy in x: appenduv2(-2.5 * pyl.log10(galaxy.Uflux_rest / galaxy.Vflux_rest)) appendvj2(-2.5 * pyl.log10(galaxy.Vflux_rest / galaxy.Jflux_rest)) if galaxy.Mips > 45: appendmips(45.) else: appendmips(galaxy.Mips) #Convert to Numpy Array uv = pyl.asarray(uv) vj = pyl.asarray(vj) uv2 = pyl.asarray(uv2) vj2 = pyl.asarray(vj2) icd = pyl.asarray(icd) mass = pyl.asarray(mass) mips = pyl.asarray(mips) #Build Plotting Matrices cut = pyl.column_stack((uv, vj, icd * 100., mass)) cut3 = pyl.column_stack((uv2, vj2, mips)) cut = colsort(cut, 3) cut2 = colsort(cut, 4) cut3 = colsort(cut3, 3) #plot! sc1 = ax1.scatter(cut[:, 1], cut[:, 0], c=cut[:, 2], s=50, cmap='Spectral') sc2 = ax2.scatter(cut2[:, 1], cut2[:, 0], c=cut2[:, 3], s=50, cmap='Spectral') sc3 = ax3.scatter(cut3[:, 1], cut3[:, 0], c=cut3[:, 2], s=50, cmap='Spectral') #Add Lines ax1.set_ylim(-0.5, 2.5) ax1.set_xlim(-1.5, 2.5) limits = ax1.axis() ax1.axis #x = [limits[0], 0.69, 1.4,1.4] #y = [1.2, 1.2, 1.82, limits[3]] x = [limits[0], 0.92, 1.6, 1.6] y = [1.3, 1.3, 1.89, limits[3]] ax1.plot(x, y, lw=2, c='k') ax2.plot(x, y, lw=2, c='k') ax3.plot(x, y, lw=2, c='k') #Add the color bar and labels and stuff grid.cbar_axes[0].colorbar(sc1) grid.cbar_axes[1].colorbar(sc2) grid.cbar_axes[2].colorbar(sc3) ax = grid.cbar_axes[0] ax.axis["top"].toggle(ticks=True, ticklabels=True, label=True) ax.set_xlabel(r'$\xi[i_{775},H_{160}]$ (%)', fontsize=16) ax = grid.cbar_axes[1] ax.set_xlabel(r'Log Mass $(M_\odot)$', fontsize=16) ax = grid.cbar_axes[2] ax.set_xlabel(r'24$\mu$m ($\mu$Jy)', fontsize=16) grid.axes_llc.set_xticks([-1, 0, 1, 2]) grid.axes_llc.set_yticks([0, 1, 2]) ax1.set_ylabel('$(U-V)_{Rest}$') ax1.set_xlabel('$(V-J)_{Rest}$') ax2.set_xlabel('$(V-J)_{Rest}$') ax3.set_xlabel('$(V-J)_{Rest}$') pyl.tight_layout() pyl.savefig('UVJ_vs_icd_mass.eps', bbox='tight') pyl.show()
def plot_uvj_vs_icd(): #galaxies=mk_galaxy_struc() galaxies = pickle.load(open('galaxies.pickle','rb')) #Take out the UDF data #galaxies = filter(lambda galaxy: galaxy.field == 1, galaxies) #galaxies = filter(lambda galaxy: -0.05 < galaxy.ICD_IH < 0.25, galaxies) galaxies = filter(lambda galaxy: galaxy.ICD_IH != None, galaxies) #f,(ax1, ax2) = pyl.subplots(1,2,sharex=True, sharey=True,figsize=(6.25,4.5)) F = pyl.figure(1,figsize=(8,4)) grid = AxesGrid(F, 111, nrows_ncols=(1,3), axes_pad = 0.1, add_all=True, label_mode = 'L', share_all=True, cbar_location = 'top', cbar_mode = 'each') ax1 = grid[0] ax2 = grid[1] ax3 = grid[2] uv =[] vj =[] icd = [] mass= [] appenduv = uv.append appendvj = vj.append appendicd = icd.append appendmass = mass.append #Build Arrays for galaxy in galaxies: if galaxy.ston_I > 30.: appenduv(-2.5*pyl.log10(galaxy.Uflux_rest/galaxy.Vflux_rest)) appendvj(-2.5*pyl.log10(galaxy.Vflux_rest/galaxy.Jflux_rest)) if galaxy.ICD_IH > 0.5: appendicd(0.5) else: appendicd(galaxy.ICD_IH) appendmass(galaxy.Mass) x = [g for g in galaxies if g.ston_I > 30. and g.Mips != None] uv2 =[] vj2 =[] mips =[] appenduv2 = uv2.append appendvj2 = vj2.append appendmips = mips.append for galaxy in x: appenduv2(-2.5*pyl.log10(galaxy.Uflux_rest/galaxy.Vflux_rest)) appendvj2(-2.5*pyl.log10(galaxy.Vflux_rest/galaxy.Jflux_rest)) if galaxy.Mips > 45: appendmips(45.) else: appendmips(galaxy.Mips) #Convert to Numpy Array uv = pyl.asarray(uv) vj = pyl.asarray(vj) uv2 = pyl.asarray(uv2) vj2 = pyl.asarray(vj2) icd = pyl.asarray(icd) mass = pyl.asarray(mass) mips = pyl.asarray(mips) #Build Plotting Matrices cut = pyl.column_stack((uv, vj, icd*100., mass)) cut3 = pyl.column_stack((uv2, vj2, mips)) cut = colsort(cut,3) cut2 = colsort(cut,4) cut3 = colsort(cut3,3) #plot! sc1 = ax1.scatter(cut[:,1], cut[:,0], c=cut[:,2], s=50, cmap='Spectral') sc2 = ax2.scatter(cut2[:,1], cut2[:,0], c=cut2[:,3], s=50, cmap='Spectral') sc3 = ax3.scatter(cut3[:,1], cut3[:,0], c=cut3[:,2], s=50, cmap='Spectral') #Add Lines ax1.set_ylim(-0.5,2.5) ax1.set_xlim(-1.5,2.5) limits = ax1.axis() ax1.axis #x = [limits[0], 0.69, 1.4,1.4] #y = [1.2, 1.2, 1.82, limits[3]] x = [limits[0], 0.92, 1.6,1.6] y = [1.3, 1.3, 1.89, limits[3]] ax1.plot(x,y,lw=2,c='k') ax2.plot(x,y,lw=2,c='k') ax3.plot(x,y,lw=2,c='k') #Add the color bar and labels and stuff grid.cbar_axes[0].colorbar(sc1) grid.cbar_axes[1].colorbar(sc2) grid.cbar_axes[2].colorbar(sc3) ax = grid.cbar_axes[0] ax.axis["top"].toggle(ticks=True, ticklabels=True, label=True) ax.set_xlabel(r'$\xi[i_{775},H_{160}]$ (%)', fontsize=16) ax = grid.cbar_axes[1] ax.set_xlabel(r'Log Mass $(M_\odot)$', fontsize=16) ax = grid.cbar_axes[2] ax.set_xlabel(r'24$\mu$m ($\mu$Jy)', fontsize=16) grid.axes_llc.set_xticks([-1,0,1,2]) grid.axes_llc.set_yticks([0,1,2]) ax1.set_ylabel('$(U-V)_{Rest}$') ax1.set_xlabel('$(V-J)_{Rest}$') ax2.set_xlabel('$(V-J)_{Rest}$') ax3.set_xlabel('$(V-J)_{Rest}$') pyl.tight_layout() pyl.savefig('UVJ_vs_icd_mass.eps',bbox='tight') pyl.show()
def plot_color_vs_mass_vs_icd(): #galaxies=mk_galaxy_struc() galaxies = pickle.load(open('galaxies.pickle', 'rb')) F = pyl.figure(1, figsize=(6, 3.5)) grid = AxesGrid(F, 111, nrows_ncols=(1, 1), add_all=True, label_mode='L', cbar_location='right', cbar_mode='each', aspect=False) color1 = [] mass1 = [] icd1 = [] color2 = [] mass2 = [] icd2 = [] for galaxy in galaxies: if galaxy.ston_I > 30. and galaxy.ICD_IH != None: mass1.append(galaxy.Mass) color1.append(galaxy.Imag - galaxy.Hmag) icd1.append(pyl.log10(galaxy.ICD_IH * 100)) ''' if galaxy.ICD_IH < -0.05: mass1.append(galaxy.Mass) color1.append(galaxy.Imag-galaxy.Hmag) icd1.append(-0.05*100) elif -0.05 < galaxy.ICD_IH < 0.25: mass1.append(galaxy.Mass) color1.append(galaxy.Imag-galaxy.Hmag) icd1.append(galaxy.ICD_IH*100.) else: mass1.append(galaxy.Mass) color1.append(galaxy.Imag-galaxy.Hmag) icd1.append(0.25*100.) ''' elif galaxy.ICD_IH != None: mass2.append(galaxy.Mass) color2.append(galaxy.Imag - galaxy.Hmag) icd2.append(galaxy.ICD_IH * 100) # Sort the arrays by ICD mass1 = pyl.asarray(mass1) color1 = pyl.asarray(color1) icd1 = pyl.asarray(icd1) IH_array = pyl.column_stack((mass1, color1, icd1)) IH_array = colsort(IH_array, 3) #sc2 = grid[0].scatter(mass2, icd2, c='0.8', s=20) sc1 = grid[0].scatter(IH_array[:, 0], IH_array[:, 1], c=IH_array[:, 2], s=50, cmap='spectral') grid.cbar_axes[0].colorbar(sc1) grid.cbar_axes[0].set_ylabel(r'Log $\xi[i_{775},H_{160}]$ (%)') #grid[0].set_xscale('log') #grid[0].set_xlim(3e7,1e12) #grid[0].set_ylim(0.0,3.5) grid[0].set_xlabel(r"Log Mass $(M_{\odot})$") grid[0].set_ylabel("$(i_{775}-H_{160})_{Observed}$") grid[0].set_yticks([0, 1, 2, 3]) grid[0].set_xticks([8, 9, 10, 11, 12]) #pyl.tight_layout() #pyl.savefig('color_vs_mass_vs_icd_IH.eps',bbox='tight') pyl.show()
def plot_color_vs_mass_vs_icd(): galaxies=mk_galaxy_struc() # Add the figures # pyl.rcParams.update(mplparams.aps['params']) # Mass vs color plot I-H f1 = pyl.figure('CM_ICD_IH',figsize=(6,4)) f1s1 = f1.add_subplot(111) label =[] color = [] mass = [] sersic = [] for galaxy in galaxies: if galaxy.ston_I >30. and galaxy.sersic <= 1.6 and galaxy.sersic >= 0.: if galaxy.sersic > 1.6: sersic.append(1.6) else: sersic.append(galaxy.sersic) #color.append(galaxy.Imag-galaxy.Hmag) color.append(galaxy.ICD_IH) mass.append(galaxy.Mass) label.append(galaxy.ID) # Sort the arrays by ICD mass = pyl.asarray(mass) color = pyl.asarray(color) sersic = pyl.asarray(sersic) IH_array = pyl.column_stack((mass,color,sersic,label)) IH_array = colsort(IH_array,3) ''' for label,x,y in zip(IH_array[:,3],IH_array[:,0], IH_array[:,1]): pyl.annotate(label,xy=(x,y), xytext=(x,y),textcoords='data',ha='right',va='bottom', bbox=dict(boxstyle='round,pad=0.5',fc='yellow',alpha=0.5), arrowprops=dict(arrowstyle='->')) ''' sc1 = f1s1.scatter(IH_array[:,0], IH_array[:,1], c=IH_array[:,2], s=50, cmap='spectral') ############ # FIGURE 1 # ############ pyl.figure('CM_ICD_IH') bar = pyl.colorbar(sc1) bar.set_label("Sersic Index, n") f1s1.set_xscale('log') f1s1.set_xlim(3e7,1e12) #f1s1.set_ylim(-0.1,3.5) f1s1.set_ylim(-0.01,0.25) f1s1.set_xlabel(r"Mass $[M_{\odot}]$") f1s1.set_ylabel("$(I-H)_{Observed}$") pyl.subplots_adjust(left=0.15, bottom=0.15, right=.75) # pyl.savefig('color_vs_mass_vs_icd_IH.eps',bbox='tight') pyl.show()
def plot_color_vs_mass_vs_icd(): galaxies = mk_galaxy_struc() # Add the figures # pyl.rcParams.update(mplparams.aps['params']) # Mass vs color plot I-H f1 = pyl.figure('CM_ICD_IH', figsize=(6, 4)) f1s1 = f1.add_subplot(111) # Mass vs color plot J-H f2 = pyl.figure('CM_ICD_ZH', figsize=(8, 8)) f2s1 = f2.add_subplot(111) # Mass vs color plot Z-H f3 = pyl.figure('CM_ICD_JH', figsize=(8, 8)) f3s1 = f3.add_subplot(111) color1 = [] mass1 = [] icd1 = [] color2 = [] mass2 = [] icd2 = [] color3 = [] mass3 = [] icd3 = [] for i in range(len(galaxies)): if galaxies[i].ston_I > 30.0: if -0.05 < galaxies[i].ICD_IH and galaxies[i].ICD_IH < 0.25: mass1.append(galaxies[i].Mass) color1.append(galaxies[i].Imag - galaxies[i].Hmag) icd1.append(galaxies[i].ICD_IH * 100.) else: mass1.append(galaxies[i].Mass) color1.append(galaxies[i].Imag - galaxies[i].Hmag) icd1.append(0.25 * 100.) if galaxies[i].ston_Z > 30.0: if -0.05 < galaxies[i].ICD_ZH and galaxies[i].ICD_ZH < 0.25: mass2.append(galaxies[i].Mass) color2.append(galaxies[i].Zmag - galaxies[i].Hmag) icd2.append(galaxies[i].ICD_ZH) else: mass2.append(galaxies[i].Mass) color2.append(galaxies[i].Zmag - galaxies[i].Hmag) icd2.append(0.3) if galaxies[i].ston_J > 30.0: if -0.05 < galaxies[i].ICD_JH and galaxies[i].ICD_JH < 0.25: mass3.append(galaxies[i].Mass) color3.append(galaxies[i].Jmag - galaxies[i].Hmag) icd3.append(galaxies[i].ICD_JH) else: mass3.append(galaxies[i].Mass) color3.append(galaxies[i].Jmag - galaxies[i].Hmag) icd3.append(0.3) # Sort the arrays by ICD mass1 = pyl.asarray(mass1) color1 = pyl.asarray(color1) icd1 = pyl.asarray(icd1) mass2 = pyl.asarray(mass2) color2 = pyl.asarray(color2) icd2 = pyl.asarray(icd2) mass3 = pyl.asarray(mass3) color3 = pyl.asarray(color3) icd3 = pyl.asarray(icd3) IH_array = pyl.column_stack((mass1, color1, icd1)) ZH_array = pyl.column_stack((mass2, color2, icd2)) JH_array = pyl.column_stack((mass3, color3, icd3)) IH_array = colsort(IH_array, 3) ZH_array = colsort(ZH_array, 3) JH_array = colsort(JH_array, 3) sc1 = f1s1.scatter(IH_array[:, 0], IH_array[:, 1], c=IH_array[:, 2], s=50, cmap='spectral', edgecolor='w') sc2 = f2s1.scatter(ZH_array[:, 0], ZH_array[:, 1], c=ZH_array[:, 2], s=50, cmap='spectral') sc3 = f3s1.scatter(JH_array[:, 0], JH_array[:, 1], c=JH_array[:, 2], s=50, cmap='spectral') ############ # FIGURE 1 # ############ pyl.figure('CM_ICD_IH') bar = pyl.colorbar(sc1) bar.set_label(r"$\xi[I,H]$ (%)") f1s1.set_xscale('log') f1s1.set_xlim(3e7, 1e12) f1s1.set_ylim(0.0, 3.5) f1s1.set_xlabel(r"Mass $[M_{\odot}]$") f1s1.set_ylabel("$(I-H)_{Observed}$") pyl.subplots_adjust(left=0.16, bottom=0.23, right=0.74) #pyl.tight_layout() pyl.savefig('color_vs_mass_vs_icd_IH.eps', bbox='tight') ############ # FIGURE 2 # ############ pyl.figure('CM_ICD_ZH') bar = pyl.colorbar(sc2) bar.set_label(r"$\xi[Z,H]$", fontsize=20) f2s1.set_xscale('log') f2s1.set_xlim(3e7, 1e12) f2s1.set_ylim(0.0, 3.5) f2s1.set_xlabel(r"$Log_{10}(M_{\odot})$", fontsize=20) f2s1.set_ylabel("$(Z-H)_{Observed}$", fontsize=20) f2s1.tick_params(axis='both', pad=7) pyl.savefig('color_vs_mass_vs_icd_ZH.eps') ############ # FIGURE 3 # ############ pyl.figure('CM_ICD_JH') bar = pyl.colorbar(sc3) bar.set_label(r"$\xi[J,H]$", fontsize=20) f3s1.set_xscale('log') f3s1.set_xlim(3e7, 1e12) f3s1.set_ylim(-0.5, 1.5) f3s1.set_xlabel(r"$Log_{10}(M_{\odot})$", fontsize=20) f3s1.set_ylabel("$(J-H)_{Observed}$", fontsize=20) f3s1.tick_params(axis='both', pad=7) pyl.savefig('color_vs_mass_vs_icd_JH.eps') pyl.show()
def plot_uvj_vs_icd(): galaxies=mk_galaxy_struc() #Take out the UDF data galaxies = filter(lambda galaxy: galaxy.field == 1, galaxies) galaxies = filter(lambda galaxy: -0.05 < galaxy.ICD_IH < 0.25, galaxies) #f,(ax1, ax2) = pyl.subplots(1,2,sharex=True, sharey=True,figsize=(6.25,4.5)) #F = pyl.figure(1,figsize=(6,4)) F = pyl.figure(1) grid = AxesGrid(F, 111, nrows_ncols=(2,1), axes_pad = 0.1, add_all=True, label_mode = 'L', share_all=True, cbar_location = 'right', cbar_mode = 'each') ax1 = grid[0] ax2 = grid[1] uv =[] vj =[] icd = [] mass= [] uv_all =[] vj_all =[] icd_all = [] appenduv = uv.append appendvj = vj.append appendicd = icd.append appendmass = mass.append appenduv_all = uv_all.append appendvj_all = vj_all.append appendicd_all = icd_all.append #Build Arrays for galaxy in galaxies: if galaxy.ston_I > 30.: appenduv(-2.5*pyl.log10(galaxy.Uflux_rest/galaxy.Vflux_rest)) appendvj(-2.5*pyl.log10(galaxy.Vflux_rest/galaxy.Jflux_rest)) appendicd(galaxy.ICD_IH) appendmass(galaxy.Mass) #Convert to Numpy Array uv = pyl.asarray(uv) vj = pyl.asarray(vj) icd = pyl.asarray(icd) mass = pyl.asarray(mass) #Build Plotting Matrices cut = pyl.column_stack((uv, vj, icd*100., pyl.log10(mass))) #total = pyl.column_stack((uv_all,vj_all,icd_all)) cut = colsort(cut,3) cut2 = colsort(cut,4) #total = colsort(total,3) #plot! sc1 = ax1.scatter(cut[:,1], cut[:,0], c=cut[:,2], s=50, cmap='spectral') sc2 = ax2.scatter(cut2[:,1], cut2[:,0], c=cut2[:,3], s=50, cmap='spectral') #Add Lines ax1.set_ylim(-0.5,2.5) ax1.set_xlim(-1.5,2.5) limits = ax1.axis() ax1.axis x = [limits[0], 0.69, 1.4,1.4] y = [1.2, 1.2, 1.82, limits[3]] ax1.plot(x,y,lw=2,c='k') ax2.plot(x,y,lw=2,c='k') ax1.fill_between(x,y,limits[3], facecolor='w', edgecolor='k', hatch='/', zorder=0) ax2.fill_between(x,y,limits[3], facecolor='w', edgecolor='k', hatch='/', zorder=0) #Add the color bar and labels and stuff grid.cbar_axes[0].colorbar(sc1) grid.cbar_axes[1].colorbar(sc2) ax = grid.cbar_axes[0] ax.axis["right"].toggle(ticks=True, ticklabels=True, label=True) ax.set_ylabel('ICD[F775W, F160W] (%)', fontsize=16) ax = grid.cbar_axes[1] ax.set_ylabel(r'Log Mass $(M_\odot)$', fontsize=16) grid.axes_llc.set_xticks([-1,0,1,2]) grid.axes_llc.set_yticks([0,1,2]) ax1.text(0,2,'Passive',color='k', horizontalalignment='center', backgroundcolor='w') ax2.text(0,2,'Passive',color='k', horizontalalignment='center', backgroundcolor='w') ax1.set_ylabel('$U-V_{Rest}$') ax1.set_xlabel('$V-J_{Rest}$') ax2.set_xlabel('$V-J_{Rest}$') pyl.show()
def plot_uvj_vs_icd(): galaxies=mk_galaxy_struc() #Take out the UDF data galaxies = filter(lambda galaxy: galaxy.field == 1, galaxies) galaxies = filter(lambda galaxy: -0.05 < galaxy.ICD_IH < 0.25, galaxies) #f,(ax1, ax2) = pyl.subplots(1,2,sharex=True, sharey=True,figsize=(6.25,4.5)) F = pyl.figure(1,figsize=(6,3.1)) grid = AxesGrid(F, 111, nrows_ncols=(1,2), axes_pad = 0.1, add_all=True, label_mode = 'L', share_all=True, cbar_location = 'top', cbar_mode = 'single') ax1 = grid[0] ax2 = grid[1] uv =[] vj =[] icd = [] uv_all =[] vj_all =[] icd_all = [] appenduv = uv.append appendvj = vj.append appendicd = icd.append appenduv_all = uv_all.append appendvj_all = vj_all.append appendicd_all = icd_all.append #Build Arrays for galaxy in galaxies: if galaxy.ston_I >30. and galaxy.ston_H > 30.: appenduv(-2.5*pyl.log10(galaxy.Uflux_rest/galaxy.Vflux_rest)) appendvj(-2.5*pyl.log10(galaxy.Vflux_rest/galaxy.Jflux_rest)) appendicd(pyl.log10(galaxy.Mass)) appenduv_all(-2.5*pyl.log10(galaxy.Uflux_rest/galaxy.Vflux_rest)) appendvj_all(-2.5*pyl.log10(galaxy.Vflux_rest/galaxy.Jflux_rest)) appendicd_all(pyl.log10(galaxy.Mass)) #Convert to Numpy Array uv = pyl.asarray(uv) vj = pyl.asarray(vj) icd = pyl.asarray(icd) uv_all = pyl.asarray(uv_all) vj_all = pyl.asarray(vj_all) icd_all = pyl.asarray(icd_all) #Build Plotting Matrices cut = pyl.column_stack((uv,vj,icd)) total = pyl.column_stack((uv_all,vj_all,icd_all)) cut = colsort(cut,3) total = colsort(total,3) #plot! sc1 = ax1.scatter(total[:,1], total[:,0], c=total[:,2], s=50, cmap='spectral') sc2 = ax2.scatter(cut[:,1], cut[:,0], c=cut[:,2], s=50, cmap='spectral') #Add Lines ax1.set_ylim(-0.5,2.5) ax1.set_xlim(-1.5,2.5) limits = ax1.axis() ax1.axis x = [limits[0], 0.69, 1.4,1.4] y = [1.2, 1.2, 1.82, limits[3]] ax1.plot(x,y,lw=2,c='k') ax2.plot(x,y,lw=2,c='k') #Add the color bar and labels and stuff grid.cbar_axes[0].colorbar(sc2) ax = grid.cbar_axes[0] ax.axis["top"].toggle(ticks=True, ticklabels=True, label=True) ax.set_xlabel('Log Mass $[M_{\odot}]$') grid.axes_llc.set_xticks([-1,0,1,2]) grid.axes_llc.set_yticks([0,1,2]) ax1.set_ylabel('$U-V_{Rest}$') ax1.set_xlabel('$V-J_{Rest}$') ax2.set_xlabel('$V-J_{Rest}$') #pyl.savefig('UVJ_vs_mass.eps',bbox='tight') pyl.show()
def plot_color_vs_mass_vs_icd(): galaxies=mk_galaxy_struc() # Add the figures # pyl.rcParams.update(mplparams.aps['params']) # Mass vs color plot I-H f1 = pyl.figure('CM_ICD_IH',figsize=(6,4)) f1s1 = f1.add_subplot(111) # Mass vs color plot J-H f2 = pyl.figure('CM_ICD_ZH',figsize=(8,8)) f2s1 = f2.add_subplot(111) # Mass vs color plot Z-H f3 = pyl.figure('CM_ICD_JH',figsize=(8,8)) f3s1 = f3.add_subplot(111) color1 = [] mass1 = [] icd1 = [] color2 = [] mass2 = [] icd2 = [] color3 = [] mass3 = [] icd3 = [] for i in range(len(galaxies)): if galaxies[i].ston_I >30.0: if -0.05 < galaxies[i].ICD_IH and galaxies[i].ICD_IH < 0.25: mass1.append(galaxies[i].Mass) color1.append(galaxies[i].Imag-galaxies[i].Hmag) icd1.append(galaxies[i].ICD_IH*100.) else: mass1.append(galaxies[i].Mass) color1.append(galaxies[i].Imag-galaxies[i].Hmag) icd1.append(0.25*100.) if galaxies[i].ston_Z >30.0: if -0.05 < galaxies[i].ICD_ZH and galaxies[i].ICD_ZH < 0.25: mass2.append(galaxies[i].Mass) color2.append(galaxies[i].Zmag-galaxies[i].Hmag) icd2.append(galaxies[i].ICD_ZH) else: mass2.append(galaxies[i].Mass) color2.append(galaxies[i].Zmag-galaxies[i].Hmag) icd2.append(0.3) if galaxies[i].ston_J >30.0: if -0.05 < galaxies[i].ICD_JH and galaxies[i].ICD_JH < 0.25: mass3.append(galaxies[i].Mass) color3.append(galaxies[i].Jmag-galaxies[i].Hmag) icd3.append(galaxies[i].ICD_JH) else: mass3.append(galaxies[i].Mass) color3.append(galaxies[i].Jmag-galaxies[i].Hmag) icd3.append(0.3) # Sort the arrays by ICD mass1 = pyl.asarray(mass1) color1 = pyl.asarray(color1) icd1 = pyl.asarray(icd1) mass2 = pyl.asarray(mass2) color2 = pyl.asarray(color2) icd2 = pyl.asarray(icd2) mass3 = pyl.asarray(mass3) color3 = pyl.asarray(color3) icd3 = pyl.asarray(icd3) IH_array = pyl.column_stack((mass1,color1,icd1)) ZH_array = pyl.column_stack((mass2,color2,icd2)) JH_array = pyl.column_stack((mass3,color3,icd3)) IH_array = colsort(IH_array,3) ZH_array = colsort(ZH_array,3) JH_array = colsort(JH_array,3) sc1 = f1s1.scatter(IH_array[:,0], IH_array[:,1], c=IH_array[:,2], s=50, cmap='spectral',edgecolor='w') sc2 = f2s1.scatter(ZH_array[:,0], ZH_array[:,1], c=ZH_array[:,2], s=50, cmap='spectral') sc3 = f3s1.scatter(JH_array[:,0], JH_array[:,1], c=JH_array[:,2], s=50, cmap='spectral') ############ # FIGURE 1 # ############ pyl.figure('CM_ICD_IH') bar = pyl.colorbar(sc1) bar.set_label(r"$\xi[I,H]$ (%)") f1s1.set_xscale('log') f1s1.set_xlim(3e7,1e12) f1s1.set_ylim(0.0,3.5) f1s1.set_xlabel(r"Mass $[M_{\odot}]$") f1s1.set_ylabel("$(I-H)_{Observed}$") pyl.subplots_adjust(left=0.16, bottom=0.23, right=0.74) #pyl.tight_layout() pyl.savefig('color_vs_mass_vs_icd_IH.eps',bbox='tight') ############ # FIGURE 2 # ############ pyl.figure('CM_ICD_ZH') bar = pyl.colorbar(sc2) bar.set_label(r"$\xi[Z,H]$",fontsize=20) f2s1.set_xscale('log') f2s1.set_xlim(3e7,1e12) f2s1.set_ylim(0.0,3.5) f2s1.set_xlabel(r"$Log_{10}(M_{\odot})$",fontsize=20) f2s1.set_ylabel("$(Z-H)_{Observed}$",fontsize=20) f2s1.tick_params(axis='both',pad=7) pyl.savefig('color_vs_mass_vs_icd_ZH.eps') ############ # FIGURE 3 # ############ pyl.figure('CM_ICD_JH') bar = pyl.colorbar(sc3) bar.set_label(r"$\xi[J,H]$",fontsize=20) f3s1.set_xscale('log') f3s1.set_xlim(3e7,1e12) f3s1.set_ylim(-0.5,1.5) f3s1.set_xlabel(r"$Log_{10}(M_{\odot})$",fontsize=20) f3s1.set_ylabel("$(J-H)_{Observed}$",fontsize=20) f3s1.tick_params(axis='both',pad=7) pyl.savefig('color_vs_mass_vs_icd_JH.eps') pyl.show()
def plot_uvj_vs_icd(): galaxies = mk_galaxy_struc() #Take out the UDF data galaxies = filter(lambda galaxy: galaxy.field == 1, galaxies) galaxies = filter(lambda galaxy: -0.05 < galaxy.ICD_IH < 0.25, galaxies) #f,(ax1, ax2) = pyl.subplots(1,2,sharex=True, sharey=True,figsize=(6.25,4.5)) #F = pyl.figure(1,figsize=(6,4)) F = pyl.figure(1) grid = AxesGrid(F, 111, nrows_ncols=(2, 1), axes_pad=0.1, add_all=True, label_mode='L', share_all=True, cbar_location='right', cbar_mode='each') ax1 = grid[0] ax2 = grid[1] uv = [] vj = [] icd = [] mass = [] uv_all = [] vj_all = [] icd_all = [] appenduv = uv.append appendvj = vj.append appendicd = icd.append appendmass = mass.append appenduv_all = uv_all.append appendvj_all = vj_all.append appendicd_all = icd_all.append #Build Arrays for galaxy in galaxies: if galaxy.ston_I > 30.: appenduv(-2.5 * pyl.log10(galaxy.Uflux_rest / galaxy.Vflux_rest)) appendvj(-2.5 * pyl.log10(galaxy.Vflux_rest / galaxy.Jflux_rest)) appendicd(galaxy.ICD_IH) appendmass(galaxy.Mass) #Convert to Numpy Array uv = pyl.asarray(uv) vj = pyl.asarray(vj) icd = pyl.asarray(icd) mass = pyl.asarray(mass) #Build Plotting Matrices cut = pyl.column_stack((uv, vj, icd * 100., pyl.log10(mass))) #total = pyl.column_stack((uv_all,vj_all,icd_all)) cut = colsort(cut, 3) cut2 = colsort(cut, 4) #total = colsort(total,3) #plot! sc1 = ax1.scatter(cut[:, 1], cut[:, 0], c=cut[:, 2], s=50, cmap='spectral') sc2 = ax2.scatter(cut2[:, 1], cut2[:, 0], c=cut2[:, 3], s=50, cmap='spectral') #Add Lines ax1.set_ylim(-0.5, 2.5) ax1.set_xlim(-1.5, 2.5) limits = ax1.axis() ax1.axis x = [limits[0], 0.69, 1.4, 1.4] y = [1.2, 1.2, 1.82, limits[3]] ax1.plot(x, y, lw=2, c='k') ax2.plot(x, y, lw=2, c='k') ax1.fill_between(x, y, limits[3], facecolor='w', edgecolor='k', hatch='/', zorder=0) ax2.fill_between(x, y, limits[3], facecolor='w', edgecolor='k', hatch='/', zorder=0) #Add the color bar and labels and stuff grid.cbar_axes[0].colorbar(sc1) grid.cbar_axes[1].colorbar(sc2) ax = grid.cbar_axes[0] ax.axis["right"].toggle(ticks=True, ticklabels=True, label=True) ax.set_ylabel('ICD[F775W, F160W] (%)', fontsize=16) ax = grid.cbar_axes[1] ax.set_ylabel(r'Log Mass $(M_\odot)$', fontsize=16) grid.axes_llc.set_xticks([-1, 0, 1, 2]) grid.axes_llc.set_yticks([0, 1, 2]) ax1.text(0, 2, 'Passive', color='k', horizontalalignment='center', backgroundcolor='w') ax2.text(0, 2, 'Passive', color='k', horizontalalignment='center', backgroundcolor='w') ax1.set_ylabel('$U-V_{Rest}$') ax1.set_xlabel('$V-J_{Rest}$') ax2.set_xlabel('$V-J_{Rest}$') pyl.show()
low_mass.append(galaxy.Mass) low_color.append(galaxy.Imag - galaxy.Hmag) low_icd.append(galaxy.ICD_IH*100) low_mass = pyl.asarray(low_mass) low_color = pyl.asarray(low_color) low_icd = pyl.asarray(low_icd) high_mass = pyl.asarray(high_mass) high_color = pyl.asarray(high_color) high_icd = pyl.asarray(high_icd) low = pyl.column_stack((low_mass, low_color, low_icd)) high = pyl.column_stack((high_mass, high_color, high_icd)) #sort high_sort = colsort(high, 3) #plot sc2 = f1s1.scatter(low[:,0], low[:,1], c='0.8', edgecolor='0.8', s=25) #sc1 = f1s1.scatter(high_sort[:,0], high_sort[:,1], c=high_sort[:,2], s=50, # cmap='spectral') sc1 = f1s1.scatter(high_sort[:,0], high_sort[:,1], c='#9370DB', s=50) #bar = pyl.colorbar(sc1) #bar.set_label(r'$\xi[i_{775}, H_{160}]$ (%)') f1s1.set_xlabel(r'Log Mass $(M_\odot)$') f1s1.set_ylabel(r'$(i_{775} - H_{160})_{Observed}$') f1s1.set_xticks([8,9,10,11,12]) import matplotlib.font_manager