def plot_icd_vs_mips(): galaxies = mk_galaxy_struc() f1 = pyl.figure(1,figsize=(6,4)) f1s1 = f1.add_subplot(111) # Upper and Lower limit arrow verts arrowup_verts = [[0.,0.], [-1., -1], [0.,0.], [0.,-2.],[0.,0.], [1,-1]] arrowdown_verts = [[0.,0.], [-1., 1], [0.,0.], [0.,2.],[0.,0.], [1,1]] for i in range(len(galaxies)): if galaxies[i].ston_I > 30.: if not galaxies[i].Mips == -1: f1s1.scatter(galaxies[i].Mips, galaxies[i].ICD_IH, c='#F28500', marker='o') if galaxies[i].ICD_IH > 0.25: f1s1.scatter(galaxies[i].Mips,0.25,s=100,marker=None, verts=arrowup_verts) if galaxies[i].ICD_IH < -0.05: f1s1.scatter(galaxies[i].Mips,-0.05,s=100,marker=None, verts=arrowdown_verts) pyl.subplots_adjust(left=0.17,bottom=0.18) f1s1.tick_params(axis='both',pad=7)#,labelsize=15) f1s1.set_ylim(-0.05,0.25) f1s1.set_xlabel(r"$F_{24\mu m}$",fontsize=18) f1s1.set_ylabel(r"$\xi[I,H]$",fontsize=18) pyl.show()
def plot_icd_vs_mass(): galaxies = mk_galaxy_struc() # Add the figures # Mass vs ICD plot I-H f1 = pyl.figure(1,figsize=(5,3.09)) f1s1 = f1.add_subplot(111) #Upper and Lower limit arrow verts arrowup_verts = [[0.,0.], [-1., -1], [0.,0.], [0.,-2.],[0.,0.], [1, -1]] arrowdown_verts = [[0.,0.], [-1., 1], [0.,0.], [0.,2.],[0.,0.], [1, 1]] for galaxy in galaxies: if galaxy.ston_I > 30.: if galaxy.ICD_IH > 0.25: f1s1.scatter(galaxy.z, 0.25, s=100, marker=None, verts=arrowup_verts) elif galaxy.ICD_IH < -0.05: f1s1.scatter(galaxy.z, -0.05, s=100, marker=None, verts=arrowdown_verts) elif galaxy.Spiral ==1: col1 = f1s1.text(galaxy.Mass, galaxy.ICD_IH, 's',color='r') elif galaxy.Elliptical ==1: col2 = f1s1.text(galaxy.Mass, galaxy.ICD_IH, 'e',color='g') elif galaxy.Uncertain ==1: col3 = f1s1.text(galaxy.Mass, galaxy.ICD_IH, 'u',color='b') else: print 'wtf?' ############ # FIGURE 1 # ############ f1s1.axvspan(3e7,1e9,facecolor='#FFFDD0',ec='None',zorder=0) f1s1.axvspan(1e11,1e12,facecolor='#FFFDD0',ec='None',zorder=0) f1s1.set_xscale('log') f1s1.set_xlim(3e7,1e12) f1s1.set_ylim(-0.05,0.25) f1s1.hlines(0.0,3e7,1e12) # remove extra ticks #f1s1.xaxis.set_major_formatter(pyl.NullFormatter()) #f1s2.set_xscale('log') #f1s2.set_xlim(3e7,1e12) #f1s2.set_ylim(-0.1,0.4) #f1s2.hlines(0.0,3e7,1e12) #f1s2.tick_params(axis='both',pad=7) # labels #f1xl=pyl.figtext(0.5,0.025,r"$Log_{10}(M_{\odot})$",fontsize=30,ha='center') #f1yl=pyl.figtext(0.025,0.5,r"$\xi[I,H]$",fontsize=30,ha='center',rotation='vertical') f1s1.set_xlabel(r"Mass [$M_{\odot}]$") f1s1.set_ylabel(r"$\xi[I,H]$") #pyl.savefig('icd_vs_mass_vs_GM20_IH.eps',bbox='tight') pyl.show()
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_icd_vs_mass(): galaxies = mk_galaxy_struc() # Add the figures # Mass vs ICD plot I-H f1 = pyl.figure(1, figsize=(6, 4)) f1s1 = f1.add_subplot(211) #Upper and Lower limit arrow verts arrowup_verts = [[0., 0.], [-1., -1], [0., 0.], [0., -2.], [0., 0.], [1, -1]] arrowdown_verts = [[0., 0.], [-1., 1], [0., 0.], [0., 2.], [0., 0.], [1, 1]] for i in range(len(galaxies)): if galaxies[i].ston_I > 30.0: f1s1.scatter(galaxies[i].Mass, galaxies[i].ICD_IH, c='#F28500', s=50, zorder=2) #Add upper limit arrows if galaxies[i].ICD_IH > 0.25: f1s1.scatter(galaxies[i].Mass, 0.25, s=100, marker=None, verts=arrowup_verts) if galaxies[i].ICD_IH < -0.05: f1s1.scatter(galaxies[i].Mass, -0.05, s=100, marker=None, verts=arrowdown_verts) ############ # FIGURE 1 # ############ pyl.figure(1) f1s1.set_xscale('log') f1s1.set_xlim(3e7, 1e12) f1s1.set_ylim(-0.05, 0.25) f1s1.hlines(0.0, 3e7, 1e12) # labels f1s1.set_xlabel(r"Mass [$M_{\odot}]$") f1s1.set_ylabel(r"$\xi[I,H]$") # pyl.show() return f1s1
def plot_sersic_vs_icd_vs_colorgrad(): galaxies = mk_galaxy_struc() f1 = pyl.figure(1,figsize=(8,8)) f1s1 = f1.add_subplot(221) f1s2 = f1.add_subplot(222) f1s3 = f1.add_subplot(223) f1s4 = f1.add_subplot(224) for galaxy in galaxies: if galaxy.ston_I >30. and galaxy.sersic != None: if 1.5 < galaxy.z and galaxy.z < 2.: col1 =f1s1.scatter(galaxy.sersic, galaxy.ICD_IH, s=50, c='r', edgecolor='w',zorder=0,lw='1',label='1.5 < z < 2') if 2. < galaxy.z and galaxy.z < 2.5: col2 =f1s2.scatter(galaxy.sersic, galaxy.ICD_IH, s=50, c='g', edgecolor='w',zorder=1) if 2.5 < galaxy.z and galaxy.z < 3.: col3 =f1s3.scatter(galaxy.sersic, galaxy.ICD_IH, s=50, c='b', edgecolor='w',zorder=2) if 3. < galaxy.z and galaxy.z < 3.5: col4 =f1s4.scatter(galaxy.sersic, galaxy.ICD_IH, s=50, c='k', edgecolor='w',zorder=3) f1s1.set_xlim(-0.1,8.5) f1s1.set_ylim(-0.01,0.3) f1s2.set_xlim(-0.1,8.5) f1s2.set_ylim(-0.01,0.3) f1s3.set_xlim(-0.1,8.5) f1s3.set_ylim(-0.01,0.3) f1s4.set_xlim(-0.1,8.5) f1s4.set_ylim(-0.01,0.3) f1s1.legend([col1],['1.5 < z < 2'],scatterpoints=1) f1s2.legend([col2],['2 < z < 2.5'],scatterpoints=1) f1s3.legend([col3],['2.5 < z < 3'],scatterpoints=1) f1s4.legend([col4],['3 < z < 3.5'],scatterpoints=1) f1s1.set_xlabel('Sersic Index, n') f1s1.set_ylabel(r'$\xi[I,H]$') #pyl.subplots_adjust(left=0.15,bottom=0.15) pyl.savefig('sersic_vs_icd_vs_colorgrad.eps',bbox='tight') pyl.show()
def plot_icd_vs_mass(): galaxies = mk_galaxy_struc() galaxies = filter(lambda galaxy: galaxy.ston_I > 30., galaxies) # Mass vs ICD plot I-H f1 = pyl.figure(1, figsize=(6, 4)) f1s1 = f1.add_subplot(111) #Upper and Lower limit arrow verts arrowup_verts = [[0., 0.], [-1., -1], [0., 0.], [0., -2.], [0., 0.], [1, -1]] arrowdown_verts = [[0., 0.], [-1., 1], [0., 0.], [0., 2.], [0., 0.], [1, 1]] for galaxy in galaxies: f1s1.scatter(galaxy.Mass, galaxy.ICD_IH * 100., c='r', s=50) #if galaxies[i].ICD_IH > 0.25: # f1s1.scatter(galaxies[i].Mass,0.25*100.,s=100,marker=None, # verts=arrowup_verts) #if galaxies[i].ICD_IH < -0.05: # f1s1.scatter(galaxies[i].Mass,-0.05*100.,s=100,marker=None, # verts=arrowdown_verts) ############ # FIGURE 1 # ############ pyl.figure(1) #f1s1.axvspan(3e7,1e9,facecolor='#FFFDD0',ec='None',zorder=0) #f1s1.axvspan(1e11,1e12,facecolor='#FFFDD0',ec='None',zorder=0) f1s1.set_xscale('log') f1s1.set_xlim(3e7, 1e12) f1s1.set_ylim(-5, 25) f1s1.hlines(0.0, 3e7, 1e12) #f1s2.set_xscale('log') #f1s2.set_xlim(3e7,1e12) #f1s2.set_ylim(-0.1,0.4) #f1s2.hlines(0.0,3e7,1e12) f1s1.set_xlabel(r"Mass ($M_{\odot})$") f1s1.set_ylabel("ICD[F775W, F160W] (%)") pyl.tight_layout() pyl.show()
def plot_icd_vs_mass(): galaxies = mk_galaxy_struc() galaxies = filter(lambda galaxy: galaxy.ston_I > 30., galaxies) # Mass vs ICD plot I-H f1 = pyl.figure(1,figsize=(6,4)) f1s1 = f1.add_subplot(111) #Upper and Lower limit arrow verts arrowup_verts = [[0.,0.], [-1., -1], [0.,0.], [0.,-2.],[0.,0.], [1, -1]] arrowdown_verts = [[0.,0.], [-1., 1], [0.,0.], [0.,2.],[0.,0.], [1, 1]] for galaxy in galaxies: f1s1.scatter(galaxy.Mass, galaxy.ICD_IH*100., c='r', s=50) #if galaxies[i].ICD_IH > 0.25: # f1s1.scatter(galaxies[i].Mass,0.25*100.,s=100,marker=None, # verts=arrowup_verts) #if galaxies[i].ICD_IH < -0.05: # f1s1.scatter(galaxies[i].Mass,-0.05*100.,s=100,marker=None, # verts=arrowdown_verts) ############ # FIGURE 1 # ############ pyl.figure(1) #f1s1.axvspan(3e7,1e9,facecolor='#FFFDD0',ec='None',zorder=0) #f1s1.axvspan(1e11,1e12,facecolor='#FFFDD0',ec='None',zorder=0) f1s1.set_xscale('log') f1s1.set_xlim(3e7,1e12) f1s1.set_ylim(-5,25) f1s1.hlines(0.0,3e7,1e12) #f1s2.set_xscale('log') #f1s2.set_xlim(3e7,1e12) #f1s2.set_ylim(-0.1,0.4) #f1s2.hlines(0.0,3e7,1e12) f1s1.set_xlabel(r"Mass ($M_{\odot})$") f1s1.set_ylabel("ICD[F775W, F160W] (%)") pyl.tight_layout() pyl.show()
def plot_icd_vs_mass(): galaxies = mk_galaxy_struc() # Add the figures # Mass vs ICD plot I-H f1 = pyl.figure(1,figsize=(6,4)) f1s1 = f1.add_subplot(211) #Upper and Lower limit arrow verts arrowup_verts = [[0.,0.], [-1., -1], [0.,0.], [0.,-2.],[0.,0.], [1, -1]] arrowdown_verts = [[0.,0.], [-1., 1], [0.,0.], [0.,2.],[0.,0.], [1, 1]] for i in range(len(galaxies)): if galaxies[i].ston_I > 30.0: f1s1.scatter(galaxies[i].Mass, galaxies[i].ICD_IH, c='#F28500', s=50, zorder=2) #Add upper limit arrows if galaxies[i].ICD_IH > 0.25: f1s1.scatter(galaxies[i].Mass,0.25,s=100,marker=None, verts=arrowup_verts) if galaxies[i].ICD_IH < -0.05: f1s1.scatter(galaxies[i].Mass,-0.05,s=100,marker=None, verts=arrowdown_verts) ############ # FIGURE 1 # ############ pyl.figure(1) f1s1.set_xscale('log') f1s1.set_xlim(3e7,1e12) f1s1.set_ylim(-0.05,0.25) f1s1.hlines(0.0,3e7,1e12) # labels f1s1.set_xlabel(r"Mass [$M_{\odot}]$") f1s1.set_ylabel(r"$\xi[I,H]$") # pyl.show() return f1s1
def plot_icd_vs_mips(): galaxies = mk_galaxy_struc() f1 = pyl.figure(1, figsize=(6, 4)) f1s1 = f1.add_subplot(111) # Upper and Lower limit arrow verts arrowup_verts = [[0., 0.], [-1., -1], [0., 0.], [0., -2.], [0., 0.], [1, -1]] arrowdown_verts = [[0., 0.], [-1., 1], [0., 0.], [0., 2.], [0., 0.], [1, 1]] for i in range(len(galaxies)): if galaxies[i].ston_I > 30.: if not galaxies[i].Mips == -1: f1s1.scatter(galaxies[i].Mips, galaxies[i].ICD_IH, c='#F28500', marker='o') if galaxies[i].ICD_IH > 0.25: f1s1.scatter(galaxies[i].Mips, 0.25, s=100, marker=None, verts=arrowup_verts) if galaxies[i].ICD_IH < -0.05: f1s1.scatter(galaxies[i].Mips, -0.05, s=100, marker=None, verts=arrowdown_verts) pyl.subplots_adjust(left=0.17, bottom=0.18) f1s1.tick_params(axis='both', pad=7) #,labelsize=15) f1s1.set_ylim(-0.05, 0.25) f1s1.set_xlabel(r"$F_{24\mu m}$", fontsize=18) f1s1.set_ylabel(r"$\xi[I,H]$", fontsize=18) pyl.show()
def plot_color_vs_mass(): galaxies = mk_galaxy_struc() # Add the figures # Mass vs color plot I-H f1 = pyl.figure('CM_IH', figsize=(8, 8)) f1s1 = f1.add_subplot(111) # Mass vs color plot J-H f2 = pyl.figure('CM_ZH', figsize=(8, 8)) f2s1 = f2.add_subplot(111) # Mass vs color plot Z-H f3 = pyl.figure('CM_JH', figsize=(8, 8)) f3s1 = f3.add_subplot(111) for i in range(len(galaxies)): if 20.0 < galaxies[i].ston_I and galaxies[i].ston_I < 30.0: f1s1.plot(galaxies[i].Mass, galaxies[i].Imag - galaxies[i].Hmag, c='0.8', marker='s', alpha=0.4, zorder=0) elif galaxies[i].ston_I < 20.0: f1s1.plot(galaxies[i].Mass, galaxies[i].Imag - galaxies[i].Hmag, c='0.8', marker='.', alpha=0.4) if 20.0 < galaxies[i].ston_Z and galaxies[i].ston_Z < 30.0: f2s1.plot(galaxies[i].Mass, galaxies[i].Zmag - galaxies[i].Hmag, c='0.8', marker='s', alpha=0.4) elif galaxies[i].ston_Z < 20.0: f2s1.plot(galaxies[i].Mass, galaxies[i].Zmag - galaxies[i].Hmag, c='0.8', marker='.', alpha=0.4) if 20.0 < galaxies[i].ston_J and galaxies[i].ston_J < 30.0: f3s1.plot(galaxies[i].Mass, galaxies[i].Jmag - galaxies[i].Hmag, c='0.8', marker='s', alpha=0.4) elif galaxies[i].ston_J < 20.0: f3s1.plot(galaxies[i].Mass, galaxies[i].Jmag - galaxies[i].Hmag, c='0.8', marker='.', alpha=0.4) for i in range(len(galaxies)): # Color vs Mass Plots if galaxies[i].ston_I > 30.0: if galaxies[i].Mips >= 10.0: f1s1.plot(galaxies[i].Mass, galaxies[i].Imag - galaxies[i].Hmag, c='#FFAB19', marker='o', markersize=9) if galaxies[i].ICD_IH > 0.1: f1s1.plot(galaxies[i].Mass, galaxies[i].Imag - galaxies[i].Hmag, c='None', marker='s', markersize=10) else: f1s1.plot(galaxies[i].Mass, galaxies[i].Imag - galaxies[i].Hmag, c='#196DFF', marker='*') if galaxies[i].ston_Z > 30.0: if galaxies[i].Mips >= 10.0: f2s1.plot(galaxies[i].Mass, galaxies[i].Zmag - galaxies[i].Hmag, c='#FFAB19', marker='o', markersize=9) if galaxies[i].ICD_ZH > 0.05: f2s1.plot(galaxies[i].Mass, galaxies[i].Zmag - galaxies[i].Hmag, c='None', marker='s', markersize=10) else: f2s1.plot(galaxies[i].Mass, galaxies[i].Zmag - galaxies[i].Hmag, c='#196DFF', marker='*') if galaxies[i].ston_J > 30.0: if galaxies[i].Mips >= 10.0: f3s1.plot(galaxies[i].Mass, galaxies[i].Jmag - galaxies[i].Hmag, c='#FFAB19', marker='o', markersize=9) if galaxies[i].ICD_JH > 0.03: f3s1.plot(galaxies[i].Mass, galaxies[i].Jmag - galaxies[i].Hmag, c='None', marker='s', markersize=10) else: f3s1.plot(galaxies[i].Mass, galaxies[i].Jmag - galaxies[i].Hmag, c='#196DFF', marker='*') ############ # FIGURE 4 # ############ pyl.figure('CM_IH') f1s1.set_xscale('log') f1s1.set_xlim(3e7, 1e12) f1s1.set_ylim(0, 4.5) f1s1.set_xlabel(r"$Log_{10}(M_{\odot})$", fontsize=20) f1s1.set_ylabel("$(I-H)_{Observed}$", fontsize=20) f1s1.tick_params(axis='both', pad=7) pyl.savefig('color_vs_mass_IH.eps') ############ # FIGURE 5 # ############ pyl.figure('CM_ZH') f2s1.set_xscale('log') f2s1.set_xlim(3e7, 1e12) 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_ZH.eps') ############ # FIGURE 6 # ############ pyl.figure('CM_JH') f3s1.set_xscale('log') f3s1.set_xlim(3e7, 1e12) f3s1.set_ylim(-0.5, 2) 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_JH.eps') pyl.show()
def plot_color_vs_mass_hist(): galaxies = mk_galaxy_struc() # Definitions for the axes left, width = 0.1, 0.65 bottom, height = 0.1, 0.65 bottom_h = left_h = left+width+0.02 rect_scatter = [left, bottom, width, height] rect_histx = [left, bottom_h, width, 0.2] rect_histy = [left_h, bottom, 0.2, height] # Add the figures # Mass vs color plot I-H f1 = pyl.figure(1,figsize=(8,8)) f1s1 = f1.add_axes(rect_scatter) f1s2 = f1.add_axes(rect_histx) f1s3 = f1.add_axes(rect_histy) # Mass vs color plot J-H f2 = pyl.figure(2,figsize=(8,8)) f2s1 = f2.add_axes(rect_scatter) f2s2 = f2.add_axes(rect_histx) f2s3 = f2.add_axes(rect_histy) #f2s1 = f2.add_subplot(111) # Mass vs color plot Z-H f3 = pyl.figure(3,figsize=(8,8)) f3s1 = f3.add_axes(rect_scatter) f3s2 = f3.add_axes(rect_histx) f3s3 = f3.add_axes(rect_histy) #f3s1 = f3.add_subplot(111) mass1 = [] color1 = [] mass2 = [] color2 = [] mass3 = [] color3 = [] for i in range(len(galaxies)): # Color vs Mass Plots if galaxies[i].ston_I >30.0: if galaxies[i].Mips >=10.0: f1s1.plot(galaxies[i].Mass,galaxies[i].Imag-galaxies[i].Hmag, c='#FFAB19', marker='o', markersize=9) mass1.append(galaxies[i].Mass) # Get the right mass color1.append(galaxies[i].Imag-galaxies[i].Hmag) # Get the color if galaxies[i].ICD_IH > 0.1: f1s1.plot(galaxies[i].Mass,galaxies[i].Imag-galaxies[i].Hmag, c='None', marker='s', markersize=10) else: f1s1.plot(galaxies[i].Mass,galaxies[i].Imag-galaxies[i].Hmag, c='#196DFF', marker='*') elif 20.0 < galaxies[i].ston_I and galaxies[i].ston_I < 30.0 : f1s1.plot(galaxies[i].Mass,galaxies[i].Imag-galaxies[i].Hmag, c='0.8', marker='s', alpha=0.4) else: f1s1.plot(galaxies[i].Mass,galaxies[i].Imag-galaxies[i].Hmag, c='0.8', marker='.', alpha=0.4) if galaxies[i].ston_Z >30.0: if galaxies[i].Mips >=10.0: f2s1.plot(galaxies[i].Mass,galaxies[i].Zmag-galaxies[i].Hmag, c='#FFAB19', marker='o', markersize=9) mass2.append(galaxies[i].Mass) # Get the right mass color2.append(galaxies[i].Zmag-galaxies[i].Hmag) # Get the color if galaxies[i].ICD_ZH > 0.05: f2s1.plot(galaxies[i].Mass,galaxies[i].Zmag-galaxies[i].Hmag, c='None', marker='s', markersize=10) else: f2s1.plot(galaxies[i].Mass,galaxies[i].Zmag-galaxies[i].Hmag, c='#196DFF', marker='*') elif 20.0 < galaxies[i].ston_Z and galaxies[i].ston_Z < 30.0 : f2s1.plot(galaxies[i].Mass,galaxies[i].Zmag-galaxies[i].Hmag, c='0.8', marker='s', alpha=0.4) else: f2s1.plot(galaxies[i].Mass,galaxies[i].Zmag-galaxies[i].Hmag, c='0.8', marker='.', alpha=0.4) if galaxies[i].ston_J >30.0: if galaxies[i].Mips >=10.0: f3s1.plot(galaxies[i].Mass,galaxies[i].Jmag-galaxies[i].Hmag, c='#FFAB19', marker='o', markersize=9) mass3.append(galaxies[i].Mass) # Get the right mass color3.append(galaxies[i].Jmag-galaxies[i].Hmag) # Get the color if galaxies[i].ICD_JH > 0.03: f3s1.plot(galaxies[i].Mass,galaxies[i].Jmag-galaxies[i].Hmag, c='None', marker='s', markersize=10) else: f3s1.plot(galaxies[i].Mass,galaxies[i].Jmag-galaxies[i].Hmag, c='#196DFF', marker='*') elif 20.0 < galaxies[i].ston_J and galaxies[i].ston_J < 30.0 : f3s1.plot(galaxies[i].Mass,galaxies[i].Jmag-galaxies[i].Hmag, c='0.8', marker='s', alpha=0.4) else: f3s1.plot(galaxies[i].Mass,galaxies[i].Jmag-galaxies[i].Hmag, c='0.8', marker='.', alpha=0.4) ############ # FIGURE 1 # ############ pyl.figure(1) f1s1.set_xscale('log') f1s1.set_xlim(3e7,1e12) f1s1.set_ylim(0,4.5) f1s1.set_xlabel(r"$Log_{10}(M_{\odot})$",fontsize=20) f1s1.set_ylabel("$(I-H)_{Observed}$",fontsize=20) f1s1.tick_params(axis='both',pad=7) binsx = pyl.logspace(7, 12) binsy = pyl.linspace(f1s1.get_ylim()[0], f1s1.get_ylim()[1] + 0.25) f1s2.hist(mass1, bins=binsx) f1s2.set_xlim( f1s1.get_xlim() ) f1s2.tick_params(labelbottom='off') f1s2.set_xscale('log') f1s3.hist(color1, bins=binsy, orientation='horizontal') f1s3.set_ylim( f1s1.get_ylim() ) f1s3.tick_params(labelleft='off') pyl.savefig('color_vs_mass_hist_IH.eps') ############ # FIGURE 2 # ############ pyl.figure(2) f2s1.set_xscale('log') f2s1.set_xlim(3e7,1e12) 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) binsx = pyl.logspace(7, 12) binsy = pyl.linspace(f2s1.get_ylim()[0], f2s1.get_ylim()[1] + 0.25) f2s2.hist(mass2, bins=binsx) f2s2.set_xlim( f2s1.get_xlim() ) f2s2.tick_params(labelbottom='off') f2s2.set_xscale('log') f2s3.hist(color2, bins=binsy, orientation='horizontal') f2s3.set_ylim( f2s1.get_ylim() ) f2s3.tick_params(labelleft='off') pyl.savefig('color_vs_mass_hist_ZH.eps') ############ # FIGURE 3 # ############ pyl.figure(3) f3s1.set_xscale('log') f3s1.set_xlim(3e7,1e12) f3s1.set_ylim(-0.5,2) 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) binsx = pyl.logspace(7, 12) binsy = pyl.linspace(f3s1.get_ylim()[0], f3s1.get_ylim()[1] + 0.25) f3s2.hist(mass3, bins=binsx) f3s2.set_xlim( f3s1.get_xlim() ) f3s2.tick_params(labelbottom='off') f3s2.set_xscale('log') f3s3.hist(color3, bins=binsy, orientation='horizontal') f3s3.set_ylim( f3s1.get_ylim() ) f3s3.tick_params(labelleft='off') pyl.savefig('color_vs_mass_hist_JH.eps') pyl.show()
def plot_color_vs_mass_hist(): galaxies = mk_galaxy_struc() # Definitions for the axes left, width = 0.1, 0.65 bottom, height = 0.1, 0.65 bottom_h = left_h = left + width + 0.02 rect_scatter = [left, bottom, width, height] rect_histx = [left, bottom_h, width, 0.2] rect_histy = [left_h, bottom, 0.2, height] # Add the figures # Mass vs color plot I-H f1 = pyl.figure(1, figsize=(8, 8)) f1s1 = f1.add_axes(rect_scatter) f1s2 = f1.add_axes(rect_histx) f1s3 = f1.add_axes(rect_histy) # Mass vs color plot J-H f2 = pyl.figure(2, figsize=(8, 8)) f2s1 = f2.add_axes(rect_scatter) f2s2 = f2.add_axes(rect_histx) f2s3 = f2.add_axes(rect_histy) #f2s1 = f2.add_subplot(111) # Mass vs color plot Z-H f3 = pyl.figure(3, figsize=(8, 8)) f3s1 = f3.add_axes(rect_scatter) f3s2 = f3.add_axes(rect_histx) f3s3 = f3.add_axes(rect_histy) #f3s1 = f3.add_subplot(111) mass1 = [] color1 = [] mass2 = [] color2 = [] mass3 = [] color3 = [] for i in range(len(galaxies)): # Color vs Mass Plots if galaxies[i].ston_I > 30.0: if galaxies[i].Mips >= 10.0: f1s1.plot(galaxies[i].Mass, galaxies[i].Imag - galaxies[i].Hmag, c='#FFAB19', marker='o', markersize=9) mass1.append(galaxies[i].Mass) # Get the right mass color1.append(galaxies[i].Imag - galaxies[i].Hmag) # Get the color if galaxies[i].ICD_IH > 0.1: f1s1.plot(galaxies[i].Mass, galaxies[i].Imag - galaxies[i].Hmag, c='None', marker='s', markersize=10) else: f1s1.plot(galaxies[i].Mass, galaxies[i].Imag - galaxies[i].Hmag, c='#196DFF', marker='*') elif 20.0 < galaxies[i].ston_I and galaxies[i].ston_I < 30.0: f1s1.plot(galaxies[i].Mass, galaxies[i].Imag - galaxies[i].Hmag, c='0.8', marker='s', alpha=0.4) else: f1s1.plot(galaxies[i].Mass, galaxies[i].Imag - galaxies[i].Hmag, c='0.8', marker='.', alpha=0.4) if galaxies[i].ston_Z > 30.0: if galaxies[i].Mips >= 10.0: f2s1.plot(galaxies[i].Mass, galaxies[i].Zmag - galaxies[i].Hmag, c='#FFAB19', marker='o', markersize=9) mass2.append(galaxies[i].Mass) # Get the right mass color2.append(galaxies[i].Zmag - galaxies[i].Hmag) # Get the color if galaxies[i].ICD_ZH > 0.05: f2s1.plot(galaxies[i].Mass, galaxies[i].Zmag - galaxies[i].Hmag, c='None', marker='s', markersize=10) else: f2s1.plot(galaxies[i].Mass, galaxies[i].Zmag - galaxies[i].Hmag, c='#196DFF', marker='*') elif 20.0 < galaxies[i].ston_Z and galaxies[i].ston_Z < 30.0: f2s1.plot(galaxies[i].Mass, galaxies[i].Zmag - galaxies[i].Hmag, c='0.8', marker='s', alpha=0.4) else: f2s1.plot(galaxies[i].Mass, galaxies[i].Zmag - galaxies[i].Hmag, c='0.8', marker='.', alpha=0.4) if galaxies[i].ston_J > 30.0: if galaxies[i].Mips >= 10.0: f3s1.plot(galaxies[i].Mass, galaxies[i].Jmag - galaxies[i].Hmag, c='#FFAB19', marker='o', markersize=9) mass3.append(galaxies[i].Mass) # Get the right mass color3.append(galaxies[i].Jmag - galaxies[i].Hmag) # Get the color if galaxies[i].ICD_JH > 0.03: f3s1.plot(galaxies[i].Mass, galaxies[i].Jmag - galaxies[i].Hmag, c='None', marker='s', markersize=10) else: f3s1.plot(galaxies[i].Mass, galaxies[i].Jmag - galaxies[i].Hmag, c='#196DFF', marker='*') elif 20.0 < galaxies[i].ston_J and galaxies[i].ston_J < 30.0: f3s1.plot(galaxies[i].Mass, galaxies[i].Jmag - galaxies[i].Hmag, c='0.8', marker='s', alpha=0.4) else: f3s1.plot(galaxies[i].Mass, galaxies[i].Jmag - galaxies[i].Hmag, c='0.8', marker='.', alpha=0.4) ############ # FIGURE 1 # ############ pyl.figure(1) f1s1.set_xscale('log') f1s1.set_xlim(3e7, 1e12) f1s1.set_ylim(0, 4.5) f1s1.set_xlabel(r"$Log_{10}(M_{\odot})$", fontsize=20) f1s1.set_ylabel("$(I-H)_{Observed}$", fontsize=20) f1s1.tick_params(axis='both', pad=7) binsx = pyl.logspace(7, 12) binsy = pyl.linspace(f1s1.get_ylim()[0], f1s1.get_ylim()[1] + 0.25) f1s2.hist(mass1, bins=binsx) f1s2.set_xlim(f1s1.get_xlim()) f1s2.tick_params(labelbottom='off') f1s2.set_xscale('log') f1s3.hist(color1, bins=binsy, orientation='horizontal') f1s3.set_ylim(f1s1.get_ylim()) f1s3.tick_params(labelleft='off') pyl.savefig('color_vs_mass_hist_IH.eps') ############ # FIGURE 2 # ############ pyl.figure(2) f2s1.set_xscale('log') f2s1.set_xlim(3e7, 1e12) 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) binsx = pyl.logspace(7, 12) binsy = pyl.linspace(f2s1.get_ylim()[0], f2s1.get_ylim()[1] + 0.25) f2s2.hist(mass2, bins=binsx) f2s2.set_xlim(f2s1.get_xlim()) f2s2.tick_params(labelbottom='off') f2s2.set_xscale('log') f2s3.hist(color2, bins=binsy, orientation='horizontal') f2s3.set_ylim(f2s1.get_ylim()) f2s3.tick_params(labelleft='off') pyl.savefig('color_vs_mass_hist_ZH.eps') ############ # FIGURE 3 # ############ pyl.figure(3) f3s1.set_xscale('log') f3s1.set_xlim(3e7, 1e12) f3s1.set_ylim(-0.5, 2) 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) binsx = pyl.logspace(7, 12) binsy = pyl.linspace(f3s1.get_ylim()[0], f3s1.get_ylim()[1] + 0.25) f3s2.hist(mass3, bins=binsx) f3s2.set_xlim(f3s1.get_xlim()) f3s2.tick_params(labelbottom='off') f3s2.set_xscale('log') f3s3.hist(color3, bins=binsy, orientation='horizontal') f3s3.set_ylim(f3s1.get_ylim()) f3s3.tick_params(labelleft='off') pyl.savefig('color_vs_mass_hist_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_sersic_vs_icd_vs_colorgrad(): galaxies = mk_galaxy_struc() f1 = pyl.figure(1, figsize=(8, 8)) f1s1 = f1.add_subplot(221) f1s2 = f1.add_subplot(222) f1s3 = f1.add_subplot(223) f1s4 = f1.add_subplot(224) for galaxy in galaxies: if galaxy.ston_I > 30. and galaxy.sersic != None: if 1.5 < galaxy.z and galaxy.z < 2.: col1 = f1s1.scatter(galaxy.sersic, galaxy.ICD_IH, s=50, c='r', edgecolor='w', zorder=0, lw='1', label='1.5 < z < 2') if 2. < galaxy.z and galaxy.z < 2.5: col2 = f1s2.scatter(galaxy.sersic, galaxy.ICD_IH, s=50, c='g', edgecolor='w', zorder=1) if 2.5 < galaxy.z and galaxy.z < 3.: col3 = f1s3.scatter(galaxy.sersic, galaxy.ICD_IH, s=50, c='b', edgecolor='w', zorder=2) if 3. < galaxy.z and galaxy.z < 3.5: col4 = f1s4.scatter(galaxy.sersic, galaxy.ICD_IH, s=50, c='k', edgecolor='w', zorder=3) f1s1.set_xlim(-0.1, 8.5) f1s1.set_ylim(-0.01, 0.3) f1s2.set_xlim(-0.1, 8.5) f1s2.set_ylim(-0.01, 0.3) f1s3.set_xlim(-0.1, 8.5) f1s3.set_ylim(-0.01, 0.3) f1s4.set_xlim(-0.1, 8.5) f1s4.set_ylim(-0.01, 0.3) f1s1.legend([col1], ['1.5 < z < 2'], scatterpoints=1) f1s2.legend([col2], ['2 < z < 2.5'], scatterpoints=1) f1s3.legend([col3], ['2.5 < z < 3'], scatterpoints=1) f1s4.legend([col4], ['3 < z < 3.5'], scatterpoints=1) f1s1.set_xlabel('Sersic Index, n') f1s1.set_ylabel(r'$\xi[I,H]$') #pyl.subplots_adjust(left=0.15,bottom=0.15) pyl.savefig('sersic_vs_icd_vs_colorgrad.eps', bbox='tight') pyl.show()
def plot_sersic_vs_icd_vs_colorgrad(): galaxies = mk_galaxy_struc() #f1 = pyl.figure(1,figsize=(8,8)) #f1s1 = f1.add_subplot(221) #f1s2 = f1.add_subplot(222, sharex=f1s1, sharey=f1s1) #f1s3 = f1.add_subplot(223, sharex=f1s1, sharey=f1s1) #f1s4 = f1.add_subplot(224, sharex=f1s1, sharey=f1s1) f1, f1s = pyl.subplots(2, 2, sharex=True, sharey=True, figsize=(5, 5)) f1s1 = f1s[0][0] f1s2 = f1s[0][1] f1s3 = f1s[1][0] f1s4 = f1s[1][1] for galaxy in galaxies: if galaxy.ston_I > 30. and galaxy.sersic != None: if galaxy.sersic < 1.: col1 = f1s1.scatter((galaxy.Mass), galaxy.ICD_IH * 100., s=50, c='k', edgecolor='w', zorder=2) if 1. < galaxy.sersic < 2.: col2 = f1s2.scatter((galaxy.Mass), galaxy.ICD_IH * 100., s=50, c='k', edgecolor='w', zorder=0, lw='1') if 2. < galaxy.sersic < 3.: col3 = f1s3.scatter((galaxy.Mass), galaxy.ICD_IH * 100., s=50, c='k', edgecolor='w', zorder=1) if 3. < galaxy.sersic: col4 = f1s4.scatter((galaxy.Mass), galaxy.ICD_IH * 100., s=50, c='k', edgecolor='w', zorder=3) f1s1.set_xscale('log') f1s1.set_xlim(3e7, 1e12) f1s1.set_ylim(-5, 25) f1s1.hlines(0.0, 3e7, 1e12) f1s1.vlines(5e10, -5, 25) f1s2.set_xscale('log') f1s2.set_xlim(3e7, 1e12) f1s2.set_ylim(-5, 25) f1s2.hlines(0.0, 3e7, 1e12) f1s2.vlines(5e10, -5, 25) f1s3.set_xscale('log') f1s3.set_xlim(3e7, 1e12) f1s3.set_ylim(-5, 25) f1s3.hlines(0.0, 3e7, 1e12) f1s3.vlines(5e10, -5, 25) f1s4.set_xscale('log') f1s4.set_xlim(3e7, 1e12) f1s4.set_ylim(-5, 25) f1s4.hlines(0.0, 3e7, 1e12) f1s4.vlines(5e10, -5, 25) #f1s1.legend([col1],['n < 1'],scatterpoints=1) #f1s2.legend([col2],['1 < n < 2'],scatterpoints=1) #f1s3.legend([col3],['2 < n < 3.'],scatterpoints=1) #f1s4.legend([col4],['3 < n'],scatterpoints=1) pyl.figtext(0.4, 0.80, 'n < 1', ha='center') pyl.figtext(0.6, 0.80, '1 < n < 2', ha='center') pyl.figtext(0.4, 0.45, '2 < n < 3', ha='center') pyl.figtext(0.6, 0.45, '3 < n', ha='center') f1s1.set_yticks([0, 5, 10, 15, 20]) f1s1.set_xticks([1e8, 1e9, 1e10, 1e11]) pyl.figtext(0.025, 0.5, r'$\xi[I,H]$ (%)', fontsize=20, va='center', rotation='vertical') pyl.figtext(0.5, 0.025, 'Mass ($M_\odot$)', fontsize=20, ha='center') pyl.subplots_adjust(hspace=0.0, wspace=0.0, bottom=0.14, left=0.14) #pyl.savefig('icd_vs_mass_vs_sersic_bins_IH.eps',bbox='tight') 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_sersic_vs_icd_vs_colorgrad(): galaxies = mk_galaxy_struc() #f1 = pyl.figure(1,figsize=(8,8)) #f1s1 = f1.add_subplot(221) #f1s2 = f1.add_subplot(222, sharex=f1s1, sharey=f1s1) #f1s3 = f1.add_subplot(223, sharex=f1s1, sharey=f1s1) #f1s4 = f1.add_subplot(224, sharex=f1s1, sharey=f1s1) f1, f1s = pyl.subplots(2, 2, sharex=True, sharey=True,figsize=(5,5)) f1s1 = f1s[0][0] f1s2 = f1s[0][1] f1s3 = f1s[1][0] f1s4 = f1s[1][1] for galaxy in galaxies: if galaxy.ston_I >30. and galaxy.sersic != None: if galaxy.sersic < 1.: col1 =f1s1.scatter((galaxy.Mass), galaxy.ICD_IH * 100., s=50, c='k', edgecolor='w',zorder=2) if 1. < galaxy.sersic < 2.: col2 =f1s2.scatter((galaxy.Mass), galaxy.ICD_IH * 100., s=50, c='k', edgecolor='w',zorder=0,lw='1') if 2. < galaxy.sersic < 3.: col3 =f1s3.scatter((galaxy.Mass), galaxy.ICD_IH * 100., s=50, c='k', edgecolor='w',zorder=1) if 3. < galaxy.sersic: col4 =f1s4.scatter((galaxy.Mass), galaxy.ICD_IH * 100., s=50, c='k', edgecolor='w',zorder=3) f1s1.set_xscale('log') f1s1.set_xlim(3e7,1e12) f1s1.set_ylim(-5,25) f1s1.hlines(0.0,3e7,1e12) f1s1.vlines(5e10,-5,25) f1s2.set_xscale('log') f1s2.set_xlim(3e7,1e12) f1s2.set_ylim(-5,25) f1s2.hlines(0.0,3e7,1e12) f1s2.vlines(5e10,-5,25) f1s3.set_xscale('log') f1s3.set_xlim(3e7,1e12) f1s3.set_ylim(-5,25) f1s3.hlines(0.0,3e7,1e12) f1s3.vlines(5e10,-5,25) f1s4.set_xscale('log') f1s4.set_xlim(3e7,1e12) f1s4.set_ylim(-5,25) f1s4.hlines(0.0,3e7,1e12) f1s4.vlines(5e10,-5,25) #f1s1.legend([col1],['n < 1'],scatterpoints=1) #f1s2.legend([col2],['1 < n < 2'],scatterpoints=1) #f1s3.legend([col3],['2 < n < 3.'],scatterpoints=1) #f1s4.legend([col4],['3 < n'],scatterpoints=1) pyl.figtext(0.4, 0.80, 'n < 1', ha='center') pyl.figtext(0.6, 0.80, '1 < n < 2', ha='center') pyl.figtext(0.4, 0.45, '2 < n < 3', ha='center') pyl.figtext(0.6, 0.45, '3 < n', ha='center') f1s1.set_yticks([0,5,10,15,20]) f1s1.set_xticks([1e8,1e9,1e10,1e11]) pyl.figtext(0.025, 0.5, r'$\xi[I,H]$ (%)', fontsize=20, va='center', rotation='vertical') pyl.figtext(0.5, 0.025, 'Mass ($M_\odot$)', fontsize=20, ha='center') pyl.subplots_adjust(hspace=0.0, wspace=0.0, bottom=0.14, left=0.14) #pyl.savefig('icd_vs_mass_vs_sersic_bins_IH.eps',bbox='tight') pyl.show()
def plot_color_vs_mass(): galaxies = mk_galaxy_struc() # Add the figures # Mass vs color plot I-H f1 = pyl.figure('CM_IH',figsize=(8,8)) f1s1 = f1.add_subplot(111) # Mass vs color plot J-H f2 = pyl.figure('CM_ZH',figsize=(8,8)) f2s1 = f2.add_subplot(111) # Mass vs color plot Z-H f3 = pyl.figure('CM_JH',figsize=(8,8)) f3s1 = f3.add_subplot(111) for i in range(len(galaxies)): if 20.0 < galaxies[i].ston_I and galaxies[i].ston_I < 30.0 : f1s1.plot(galaxies[i].Mass,galaxies[i].Imag-galaxies[i].Hmag, c='0.8', marker='s', alpha=0.4,zorder=0) elif galaxies[i].ston_I < 20.0: f1s1.plot(galaxies[i].Mass,galaxies[i].Imag-galaxies[i].Hmag, c='0.8', marker='.', alpha=0.4) if 20.0 < galaxies[i].ston_Z and galaxies[i].ston_Z < 30.0 : f2s1.plot(galaxies[i].Mass,galaxies[i].Zmag-galaxies[i].Hmag, c='0.8', marker='s', alpha=0.4) elif galaxies[i].ston_Z < 20.0: f2s1.plot(galaxies[i].Mass,galaxies[i].Zmag-galaxies[i].Hmag, c='0.8', marker='.', alpha=0.4) if 20.0 < galaxies[i].ston_J and galaxies[i].ston_J < 30.0 : f3s1.plot(galaxies[i].Mass,galaxies[i].Jmag-galaxies[i].Hmag, c='0.8', marker='s', alpha=0.4) elif galaxies[i].ston_J < 20.0: f3s1.plot(galaxies[i].Mass,galaxies[i].Jmag-galaxies[i].Hmag, c='0.8', marker='.', alpha=0.4) for i in range(len(galaxies)): # Color vs Mass Plots if galaxies[i].ston_I >30.0: if galaxies[i].Mips >=10.0: f1s1.plot(galaxies[i].Mass,galaxies[i].Imag-galaxies[i].Hmag, c='#FFAB19', marker='o', markersize=9) if galaxies[i].ICD_IH > 0.1: f1s1.plot(galaxies[i].Mass,galaxies[i].Imag-galaxies[i].Hmag, c='None', marker='s', markersize=10) else: f1s1.plot(galaxies[i].Mass,galaxies[i].Imag-galaxies[i].Hmag, c='#196DFF', marker='*') if galaxies[i].ston_Z >30.0: if galaxies[i].Mips >=10.0: f2s1.plot(galaxies[i].Mass,galaxies[i].Zmag-galaxies[i].Hmag, c='#FFAB19', marker='o', markersize=9) if galaxies[i].ICD_ZH > 0.05: f2s1.plot(galaxies[i].Mass,galaxies[i].Zmag-galaxies[i].Hmag, c='None', marker='s', markersize=10) else: f2s1.plot(galaxies[i].Mass,galaxies[i].Zmag-galaxies[i].Hmag, c='#196DFF', marker='*') if galaxies[i].ston_J >30.0: if galaxies[i].Mips >=10.0: f3s1.plot(galaxies[i].Mass,galaxies[i].Jmag-galaxies[i].Hmag, c='#FFAB19', marker='o', markersize=9) if galaxies[i].ICD_JH > 0.03: f3s1.plot(galaxies[i].Mass,galaxies[i].Jmag-galaxies[i].Hmag, c='None', marker='s', markersize=10) else: f3s1.plot(galaxies[i].Mass,galaxies[i].Jmag-galaxies[i].Hmag, c='#196DFF', marker='*') ############ # FIGURE 4 # ############ pyl.figure('CM_IH') f1s1.set_xscale('log') f1s1.set_xlim(3e7,1e12) f1s1.set_ylim(0,4.5) f1s1.set_xlabel(r"$Log_{10}(M_{\odot})$",fontsize=20) f1s1.set_ylabel("$(I-H)_{Observed}$",fontsize=20) f1s1.tick_params(axis='both',pad=7) pyl.savefig('color_vs_mass_IH.eps') ############ # FIGURE 5 # ############ pyl.figure('CM_ZH') f2s1.set_xscale('log') f2s1.set_xlim(3e7,1e12) 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_ZH.eps') ############ # FIGURE 6 # ############ pyl.figure('CM_JH') f3s1.set_xscale('log') f3s1.set_xlim(3e7,1e12) f3s1.set_ylim(-0.5,2) 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_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()
#!/usr/bin/env python # File: plot_selected_vs_z_hist.py # Created on: Mon Aug 20 21:04:20 2012 # Last Change: Fri 28 Sep 2012 10:21:27 AM CDT # Purpose of script: <+INSERT+> # Author: Steven Boada import pylab as pyl from mk_galaxy_struc import mk_galaxy_struc galaxies = mk_galaxy_struc() low =[] med=[] high=[] appendlow = low.append appendmed = med.append appendhigh = high.append for galaxy in galaxies: if galaxy.ston_I >30. and galaxy.ICD_IH <0.25: if 0.04 <= galaxy.ICD_IH and galaxy.ICD_IH <= 0.11: appendlow(galaxy.z) if 0.11 <= galaxy.ICD_IH and galaxy.ICD_IH <= 0.18: appendmed(galaxy.z) if 0.18 <= galaxy.ICD_IH and galaxy.ICD_IH <= 0.25: appendhigh(galaxy.z) count, bins, ignored = pyl.hist((low, med, high), label = (r"$0.04 \leq \xi[I,H] \leq 0.11$",
def plot_icd_vs_mass(): galaxies = mk_galaxy_struc() # Add the figures # Mass vs ICD plot I-H f1 = pyl.figure(1,figsize=(8,8)) f1s1 = f1.add_subplot(221) f1s2 = f1.add_subplot(222) f1s3 = f1.add_subplot(223) f1s4 = f1.add_subplot(224) #Upper and Lower limit arrow verts arrowup_verts = [[0.,0.], [-1., -1], [0.,0.], [0.,-2.],[0.,0.], [1, -1]] arrowdown_verts = [[0.,0.], [-1., 1], [0.,0.], [0.,2.],[0.,0.], [1, 1]] for galaxy in galaxies: if galaxy.ston_I > 30. and galaxy.sersic != None: if 1.5 < galaxy.z and galaxy.z < 2.: if galaxy.ICD_IH > 0.25: f1s1.scatter(galaxy.Mass,0.25,s=100,marker=None, verts=arrowup_verts) elif galaxy.ICD_IH < -0.05: f1s1.scatter(galaxy.Mass,-0.05,s=100,marker=None, verts=arrowdown_verts) else: col1 = f1s1.scatter((galaxy.Mass),galaxy.ICD_IH, s=50, c='r', edgecolor='w') if 2. < galaxy.z and galaxy.z < 2.5: if galaxy.ICD_IH > 0.25: f1s2.scatter(galaxy.Mass,0.25,s=100,marker=None, verts=arrowup_verts) elif galaxy.ICD_IH < -0.05: f1s2.scatter(galaxy.Mass,-0.05,s=100,marker=None, verts=arrowdown_verts) else: col2 = f1s2.scatter((galaxy.Mass),galaxy.ICD_IH, s=50, c='g', edgecolor='w') if 2.5 < galaxy.z and galaxy.z < 3.: if galaxy.ICD_IH > 0.25: f1s3.scatter(galaxy.Mass,0.25,s=100,marker=None, verts=arrowup_verts) elif galaxy.ICD_IH < -0.05: f1s3.scatter(galaxy.Mass,-0.05,s=100,marker=None, verts=arrowdown_verts) else: col3 = f1s3.scatter((galaxy.Mass),galaxy.ICD_IH, s=50, c='b', edgecolor='w') if 3. < galaxy.z and galaxy.z < 3.5: if galaxy.ICD_IH > 0.25: f1s4.scatter(galaxy.Mass,0.25,s=100,marker=None, verts=arrowup_verts) elif galaxy.ICD_IH < -0.05: f1s4.scatter(galaxy.Mass,-0.05,s=100,marker=None, verts=arrowdown_verts) else: col4 = f1s4.scatter((galaxy.Mass),galaxy.ICD_IH, s=50, c='k', edgecolor='w') f1s1.legend([col1],['1.5 < z < 2'],scatterpoints=1) f1s2.legend([col2],['2 < z < 2.5'],scatterpoints=1) f1s3.legend([col3],['2.5 < z < 3'],scatterpoints=1) f1s4.legend([col4],['3 < z < 3.5'],scatterpoints=1) #pyl.subplots_adjust(left=0.18,right=0.9,top=0.9,bottom=0.15,hspace=0.0) #pyl.subplots_adjust(left=0.17,bottom=0.18) #f1s1.axvspan(3e7,1e9,facecolor='#FFFDD0',ec='None',zorder=0) #f1s1.axvspan(1e11,1e12,facecolor='#FFFDD0',ec='None',zorder=0) f1s1.set_xscale('log') f1s1.set_xlim(3e7,1e12) f1s1.set_ylim(-0.05,0.25) f1s1.hlines(0.0,3e7,1e12) f1s2.set_xscale('log') f1s2.set_xlim(3e7,1e12) f1s2.set_ylim(-0.05,0.25) f1s2.hlines(0.0,3e7,1e12) f1s3.set_xscale('log') f1s3.set_xlim(3e7,1e12) f1s3.set_ylim(-0.05,0.25) f1s3.hlines(0.0,3e7,1e12) f1s4.set_xscale('log') f1s4.set_xlim(3e7,1e12) f1s4.set_ylim(-0.05,0.25) f1s4.hlines(0.0,3e7,1e12) # remove extra ticks #f1s1.xaxis.set_major_formatter(pyl.NullFormatter()) # labels #f1xl=pyl.figtext(0.5,0.025,r"$Log_{10}(M_{\odot})$",fontsize=30,ha='center') #f1yl=pyl.figtext(0.025,0.5,r"$\xi[I,H]$",fontsize=30,ha='center',rotation='vertical') f1s1.set_xlabel(r"$M/M_{\odot}$") f1s1.set_ylabel(r"$\xi[I,H]$") #f1s1l =pyl.figtext(0.25,0.8,"$1.5 \leq z \leq 2.5$",fontsize=16,ha='center') #f1s2l =pyl.figtext(0.25,0.4,"$2.5 \leq z \leq 3.5$",fontsize=16,ha='center') #pyl.savefig('icd_vs_mass_IH.eps') pyl.show()
def plot_icd_vs_mass(): galaxies = mk_galaxy_struc() # Add the figures # Mass vs ICD plot I-H f1 = pyl.figure(1, figsize=(8, 8)) f1s1 = f1.add_subplot(221) f1s2 = f1.add_subplot(222) f1s3 = f1.add_subplot(223) f1s4 = f1.add_subplot(224) #Upper and Lower limit arrow verts arrowup_verts = [[0., 0.], [-1., -1], [0., 0.], [0., -2.], [0., 0.], [1, -1]] arrowdown_verts = [[0., 0.], [-1., 1], [0., 0.], [0., 2.], [0., 0.], [1, 1]] for galaxy in galaxies: if galaxy.ston_I > 30. and galaxy.sersic != None: if 1.5 < galaxy.z and galaxy.z < 2.: if galaxy.ICD_IH > 0.25: f1s1.scatter(galaxy.Mass, 0.25, s=100, marker=None, verts=arrowup_verts) elif galaxy.ICD_IH < -0.05: f1s1.scatter(galaxy.Mass, -0.05, s=100, marker=None, verts=arrowdown_verts) else: col1 = f1s1.scatter((galaxy.Mass), galaxy.ICD_IH, s=50, c='r', edgecolor='w') if 2. < galaxy.z and galaxy.z < 2.5: if galaxy.ICD_IH > 0.25: f1s2.scatter(galaxy.Mass, 0.25, s=100, marker=None, verts=arrowup_verts) elif galaxy.ICD_IH < -0.05: f1s2.scatter(galaxy.Mass, -0.05, s=100, marker=None, verts=arrowdown_verts) else: col2 = f1s2.scatter((galaxy.Mass), galaxy.ICD_IH, s=50, c='g', edgecolor='w') if 2.5 < galaxy.z and galaxy.z < 3.: if galaxy.ICD_IH > 0.25: f1s3.scatter(galaxy.Mass, 0.25, s=100, marker=None, verts=arrowup_verts) elif galaxy.ICD_IH < -0.05: f1s3.scatter(galaxy.Mass, -0.05, s=100, marker=None, verts=arrowdown_verts) else: col3 = f1s3.scatter((galaxy.Mass), galaxy.ICD_IH, s=50, c='b', edgecolor='w') if 3. < galaxy.z and galaxy.z < 3.5: if galaxy.ICD_IH > 0.25: f1s4.scatter(galaxy.Mass, 0.25, s=100, marker=None, verts=arrowup_verts) elif galaxy.ICD_IH < -0.05: f1s4.scatter(galaxy.Mass, -0.05, s=100, marker=None, verts=arrowdown_verts) else: col4 = f1s4.scatter((galaxy.Mass), galaxy.ICD_IH, s=50, c='k', edgecolor='w') f1s1.legend([col1], ['1.5 < z < 2'], scatterpoints=1) f1s2.legend([col2], ['2 < z < 2.5'], scatterpoints=1) f1s3.legend([col3], ['2.5 < z < 3'], scatterpoints=1) f1s4.legend([col4], ['3 < z < 3.5'], scatterpoints=1) #pyl.subplots_adjust(left=0.18,right=0.9,top=0.9,bottom=0.15,hspace=0.0) #pyl.subplots_adjust(left=0.17,bottom=0.18) #f1s1.axvspan(3e7,1e9,facecolor='#FFFDD0',ec='None',zorder=0) #f1s1.axvspan(1e11,1e12,facecolor='#FFFDD0',ec='None',zorder=0) f1s1.set_xscale('log') f1s1.set_xlim(3e7, 1e12) f1s1.set_ylim(-0.05, 0.25) f1s1.hlines(0.0, 3e7, 1e12) f1s2.set_xscale('log') f1s2.set_xlim(3e7, 1e12) f1s2.set_ylim(-0.05, 0.25) f1s2.hlines(0.0, 3e7, 1e12) f1s3.set_xscale('log') f1s3.set_xlim(3e7, 1e12) f1s3.set_ylim(-0.05, 0.25) f1s3.hlines(0.0, 3e7, 1e12) f1s4.set_xscale('log') f1s4.set_xlim(3e7, 1e12) f1s4.set_ylim(-0.05, 0.25) f1s4.hlines(0.0, 3e7, 1e12) # remove extra ticks #f1s1.xaxis.set_major_formatter(pyl.NullFormatter()) # labels #f1xl=pyl.figtext(0.5,0.025,r"$Log_{10}(M_{\odot})$",fontsize=30,ha='center') #f1yl=pyl.figtext(0.025,0.5,r"$\xi[I,H]$",fontsize=30,ha='center',rotation='vertical') f1s1.set_xlabel(r"$M/M_{\odot}$") f1s1.set_ylabel(r"$\xi[I,H]$") #f1s1l =pyl.figtext(0.25,0.8,"$1.5 \leq z \leq 2.5$",fontsize=16,ha='center') #f1s2l =pyl.figtext(0.25,0.4,"$2.5 \leq z \leq 3.5$",fontsize=16,ha='center') #pyl.savefig('icd_vs_mass_IH.eps') 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()
#!/usr/bin/env python # File: plot_icd_vs_colorgrad.py # Created on: Tue 08 May 2012 11:03:26 AM CDT # Last Change: Sun 21 Oct 2012 02:43:33 PM CDT # Purpose of script: <+INSERT+> # Author: Steven Boada import pylab as pyl from mk_galaxy_struc import mk_galaxy_struc galaxies = mk_galaxy_struc() f1 = pyl.figure(1,figsize=(8,8)) f1s1 = f1.add_subplot(221) f1s2 = f1.add_subplot(222) f1s3 = f1.add_subplot(223) f1s4 = f1.add_subplot(224) for galaxy in galaxies: if galaxy.ston_I >= 30. and galaxy.Color_grad != None and galaxy.sersic !=\ None: if galaxy.sersic < 1.: col1 =f1s1.scatter(galaxy.ICD_IH, galaxy.Color_grad, s=50, c='k', edgecolor='w') if 1. < galaxy.sersic < 2.: col2 =f1s2.scatter(galaxy.ICD_IH, galaxy.Color_grad, s=50,c='k', edgecolor='w') if 2. < galaxy.sersic < 3.: col3 =f1s3.scatter(galaxy.ICD_IH, galaxy.Color_grad, s=50, c='k', edgecolor='w') if 3. < galaxy.sersic:
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()