def plotallsSFRLocaldens(): figure(figsize=[15,10]) #figure() clf() #subplots_adjust(wspace=.25,hspace=.35) #colors=['r','b','c','g','m','y','k','0.5','r'] #shapes=['o','^','s','>','p','d','v','o','s'] xall=[] yall=[] i=0 for cl in mylocalclusters: i += 1 x,y=cl.plotsSFRLocaldens(colors[i-1],shapes[i-1]) xall=xall+x yall=yall+y legend(numpoints=1,loc='upper right') xbin,ybin,ybinerr=my.binit(xall,yall,5) plot(xbin,ybin,'k-') ax=gca() ax.set_xscale('log') ax.set_yscale('log') #axis([.9,1000,-.05e-10,.85e-9]) xlabel('$Local \ Density $',fontsize=20) ylabel('$SFR/M_* \ (M_\odot/yr/M_\odot)$',fontsize=20) f=figuredir+'sSFRLocaldens.eps' savefig(f)
def plotsSFRHIDefall(): figure(figsize=[10,8]) clf() xall=[] yall=[] i=0 for cl in mylocalclusters: i += 1 x,y=cl.plotsSFRHIDef(colors[i-1],shapes[i-1]) xall=xall+x#.tolist() yall=yall+y#.tolist() axvline(x=0,ls='--',color='k') #axhline(y=0.2,ls='--',color='b') xall=array(xall,'d') yall=array(yall,'d') xbin,ybin,ybinerr=my.binit(xall,yall,5) #print xall #print yall #print xbin,ybin plot(xbin,ybin,'k-',marker='o',markersize=12,label='_nolegend_') errorbar(xbin,ybin,yerr=ybinerr,fmt=None,ecolor='k',label='_nolegend_') r,p=spearman(xall,yall) ax=gca() text(.9,.15,'$ rho = %4.2f$'%(r),horizontalalignment='right',transform=ax.transAxes,fontsize=14) text(.9,.1,'$p = %4.4f$'%(p),horizontalalignment='right',transform=ax.transAxes,fontsize=14) #ax.set_yscale('log') axis([-.5,2,-.01,.25]) xlabel('$HI \ Deficiency $',fontsize=18) ylabel('$sSFR \ (M_\odot \ yr^{-1} / 10^9 M_\odot )$',fontsize=18) legend(numpoints=1) f=figuredir+'sSFRHIDef.eps' savefig(f)
def plotsighaall(sig, psig, o2b, file, nbin): o2b = N.array(o2b, 'f') sig = N.array(sig, 'f') psig = N.array(psig, 'f') #o2b=o2b+4. o2 = N.compress(o2b > -500., o2b) sig = N.compress(o2b > -500., sig) psig = N.compress(o2b > -500., psig) psplot = file + ".ps" psplotinit(psplot) #ppgplot.pgsch(0.7) ppgplot.pgslw(7) (sigbin, o2bin) = my.binit(sig, o2, nbin) #print 'dude', sigbin, o2bin sigbin = N.log10(sigbin) ppgplot.pgswin(-2., 2., -5., 20.) ppgplot.pgbox('blcnst', 0.0, 0.0, 'bcvnst', 0.0, 0.0) #tickmarks and labeling ppgplot.pgsch(1.0) ppgplot.pgmtxt('b', 2.5, 0.5, 0.5, "\gS\d10\u (gal/Mpc\u2\d)") #xlabel ppgplot.pgsch(1.2) ppgplot.pgmtxt('l', 2.6, 0.5, 0.5, 'EW(H\ga) (\(2078))') ppgplot.pgsls(1) #dotted ppgplot.pgslw(4) #line width ppgplot.pgpt(sigbin, o2bin, 17) ppgplot.pgpt(N.log10(sig), o2, 1) #my.errory(sigbin,o2bin,yerr) #print 'dude2', sigbin, o2bin ppgplot.pgsci(2) ppgplot.pgline(sigbin, o2bin) (sigbin, o2bin) = my.binit(psig, o2, nbin) #print 'dude', sigbin, o2bin sigbin = N.log10(sigbin) ppgplot.pgsci(1) ppgplot.pgpt(sigbin, o2bin, 21) #my.errory(sigbin,o2bin,yerr) ppgplot.pgsci(4) ppgplot.pgline(sigbin, o2bin) ppgplot.pgsci(1) ppgplot.pgend()
def plotSFR24HIperAreaall(): figure(figsize=[10,8]) #figure() clf() #subplots_adjust(wspace=.25,hspace=.35) #colors=['r','b','c','g','m','y','k','0.5','r'] colors=['k','k','k','k','k','k','k','k','k'] shapes=['o','^','s','*','p','d','v','h','<'] xall=[] yall=[] x1all=[] y1all=[] i=0 for cl in mylocalclusters: i += 1 #subplot(3,3,i) x,y,x1,y1=cl.plotSFR24HIperArea(colors[i-1],shapes[i-1]) #print x,y xall=xall+x yall=yall+y x1all=x1all+x1#field galaxies y1all=y1all+y1 legend(loc='upper right',numpoints=1)#labels=clusternames) xbin,ybin,ybinerr=my.binit(xall,yall,5) plot(xbin,ybin,'k-') errorbar(xbin,ybin,ybinerr,fmt=None,color='k') print xbin,ybin,ybinerr #xbin,ybin,ybinerr=my.biniterr(xall,yall,5) xbin,ybin,ybinerr=my.binit(x1all,y1all,5) print xbin,ybin,ybinerr plot(xbin,ybin,'k--') errorbar(xbin,ybin,ybinerr,fmt=None,color='k', lw=3) ax=gca() #ax.set_xscale('log') #ax.set_yscale('log') #axis([8.e8,2e12,.002,70]) # text(-.75,-.35,'Local Density',fontsize=18,horizontalalignment='center',transform=ax.transAxes) # subplot(3,3,4) # text(-2.8,1.9,'$R_{24}/R_r$',fontsize=18,verticalalignment='center',rotation=90,transform=ax.transAxes) xlabel('$HI \ Mass \ / Area (M_\odot/arcsec^2)$',fontsize=20) ylabel('$SFR \ (M_\odot/yr)$',fontsize=20) f=figuredir+'SFR24HIperArea.eps' savefig(f)
def azmr(self): x=N.compress((self.mpaflag > 0.1) & (self.ew > 4.) & (self.Mabs < -18.),self.Mabs) y=N.compress((self.mpaflag > 0.1) & (self.ew > 4.) & (self.Mabs < -18.),self.ar) x1=N.compress((self.mpaflag > 0.1) & (self.ew > 4.) & (self.Mabs < -20.38),self.Mabs) y1=N.compress((self.mpaflag > 0.1) & (self.ew > 4.) & (self.Mabs < -20.38),self.ar) y=2.5*N.log10(y) #pylab.plot(x,y,'k.',markersize=0.1,zorder=1) print "average Ar for Mr < -20.38 = %5.2f +/- %5.2f"%(N.average(y1),pylab.std(y1)) (xbin,ybin)=my.binit(x1,y1,20) #(xbin,ybin,ybinerr)=my.biniterr(x,y,20) for i in range(len(xbin)): print i,xbin[i],ybin[i] print "Average of binned values = ",N.average(ybin) print "average Ar for Mr < -20.38 = %5.2f +/- %5.2f"%(N.average(N.log10(y1)),pylab.std(N.log10(y1))) #pylab.axis([-26.,-12.,0.1,30.]) pylab.xlabel(r'$\rm{M_r}$',fontsize=28.) pylab.ylabel(r'$\rm{A_r}$',fontsize=28.) (xbin,ybin)=my.binit(x,y,20) #(xbin,ybin,ybinerr)=my.biniterr(x,y,20) for i in range(len(xbin)): print i,xbin[i],ybin[i] pylab.plot(xbin,ybin,'r-',lw=5) ax=pylab.gca() xmin=-24. xmax=-18. ymin=-1. ymax=3. my.contourf(x,y,xmin,xmax,ymin,ymax) pylab.axvline(x=-20.6,linewidth=3,ls='--',c='g') xl=N.arange(-23.,-20.5,.2) yl=0.76*N.ones(len(xl),'f') pylab.plot(xl,yl,'b-',lw=3) pylab.axis([-24.,-18,-1.,2.4]) #ax.set_yscale('log') #pylab.show() pylab.savefig('armr.eps') print "fraction w/MPA stellar mass and Az = ",N.sum(self.mpaflag)/(1.*len(self.mpaflag))
def plotsigo2all(sig, psig, o2b, file, nbin): #o2=N.zeros(len(o2b),'f') #for i in range(len(o2b)): #print i, sig[i], psig[i], o2b[i] # if o2b[i] < 0: # o2[i]=-1*o2b[i] #print "hey", o2[i] o2 = o2b psplot = file + ".ps" psplotinit(psplot) ppgplot.pgsch(0.7) (sigbin, o2bin) = my.binit(sig, o2, nbin) #print 'dude', sigbin, o2bin sigbin = N.log10(sigbin) ppgplot.pgswin(-1., 3., -.5, 10.) ppgplot.pgbox('bcnst', 0.0, 0.0, 'bcvnst', 0.0, 0.0) #tickmarks and labeling ppgplot.pgsch(1.0) ppgplot.pgmtxt('b', 2.5, 0.5, 0.5, "\gS\d10\u (gal/Mpc\u2\d)") #xlabel ppgplot.pgsch(1.2) ppgplot.pgmtxt('l', 2.6, 0.5, 0.5, 'EW([OII]) (\(2078))') ppgplot.pgsls(1) #dotted ppgplot.pgslw(4) #line width ppgplot.pgsci(2) ppgplot.pgpt(sigbin, o2bin, 17) #print 'dude2', sigbin, o2bin ppgplot.pgline(sigbin, o2bin) (sigbin, o2bin) = my.binit(psig, o2, nbin) #print 'dude', sigbin, o2bin sigbin = N.log10(sigbin) ppgplot.pgsci(4) ppgplot.pgpt(sigbin, o2bin, 21) ppgplot.pgline(sigbin, o2bin) ppgplot.pgsci(1) ppgplot.pgend()
def plotallsSFRratioLocaldens(): figure(figsize=[15,10]) clf() #colors=['r','b','c','g','m','y','k','0.5','r'] #shapes=['o','^','s','>','p','d','v','o','s'] xall=[] yall=[] i=0 for cl in mylocalclusters: i += 1 x,y=cl.plotsSFRratioLocaldens(colors[i-1],shapes[i-1]) xall=xall+x yall=yall+y xbin,ybin,ybinerr=my.binit(xall,yall,5) plot(xbin,ybin,'k-') ax=gca() ax.set_xscale('log') xlabel('$Local \ Density $',fontsize=18) ylabel('$sSFR_{90} - sSFR_{50} $',fontsize=18) f=figuredir+'sSFRLocaldens.eps' savefig(f)
def plotsigo2(sig, o2, file, nbin): psplot = file + ".ps" psplotinit(psplot) (sigbin, o2bin) = my.binit(sig, o2, nbin) ppgplot.pgbox("", 0.0, 0, "L", 0.0, 0) ymin = -10. ymax = 2. xmin = min(sig) - 10. #xmax=max(sig)-200. xmax = 350. ppgplot.pgenv(xmin, xmax, ymin, ymax, 0) ppgplot.pglab("\gS\d5\u (gal/Mpc\u2\d)", "EW([OII]) (\(2078))", "") ppgplot.pgsls(1) #dotted ppgplot.pgslw(4) #line width sig = N.array(sig, 'f') o2 = N.array(o2, 'f') ppgplot.pgpt(sig, o2, 1) ppgplot.pgsci(2) ppgplot.pgline(sigbin, o2bin) ppgplot.pgsci(1) ppgplot.pgend()
def plotNUV24ssfrall(): figure(figsize=[10,8]) #figure() clf() #subplots_adjust(wspace=.25,hspace=.35) #colors=['k','k','k','k','k','k','k','k','k'] #shapes=['o','^','s','*','p','d','v','h','<'] xall=[] yall=[] x1all=[] y1all=[] xa=[] ya=[] i=0 for cl in mylocalclusters: i += 1 #subplot(3,3,i) #if cl.prefix.find('Coma') > -1: # continue x,y,x1,y1=cl.plotNUV24ssfr(colors[i-1],shapes[i-1],plotsingle=0) #print x,y if len(x)>0: xall=xall+x.tolist() yall=yall+y.tolist() if len(x1) > 0: x1all=x1all+x1.tolist()#field galaxies y1all=y1all+y1.tolist() xa=xa+x.tolist()+x1.tolist() ya=ya+y.tolist()+y1.tolist() xall=array(xall,'d') yall=array(yall,'d') x1all=array(x1all,'d') x1all=array(x1all,'d') xall=array(xall,'d') yall=array(yall,'d') xbin,ybin,ybinerr=my.binit(xa,ya,4) plot(xbin,ybin,'k-',marker='o',color='k',markersize=14,label='All') errorbar(xbin,ybin,ybinerr,fmt=None,color='k',ecolor='k') xbin,ybin,ybinerr=my.binit(xall,yall,5) plot(xbin,ybin,'k-',marker='o',color='r',mec='k',markersize=14,label='Cluster') xbin,ybin,ybinerr=my.binit(x1all,y1all,5) plot(xbin,ybin,'k-',marker='o',color='b',mec='k',markersize=14,label='Field') #errorbar(xbin,ybin,ybinerr,fmt=None,color='k',ecolor='k',lw=3,label='_nolegend_') #print "Clusters: Re(24)/Re(r) vs NUV-24" #spearman(xall,yall) #print "Field: Re(24)/Re(r) vs NUV-24" #spearman(x1all,y1all) #print 'Cluster vs Field, Re(24)/Re(r), KS' #D,p=ks(yall,y1all) #print 'Cluster vs Field, NUV-24, KS' #D,p=ks(xall,x1all) legend(numpoints=1,loc='upper left',scatterpoints=1) print 'Size vs NUV-24 color' r,p=spearman(xa,ya) ax=gca() text(.9,.9,'$rho = %4.2f$'%(r),horizontalalignment='right',transform=ax.transAxes,fontsize=14) text(.9,.85,'$p = %5.4f$'%(p),horizontalalignment='right',transform=ax.transAxes,fontsize=14) ax=gca() #ax.set_xscale('log') #ax.set_yscale('log') #xmin=2.e8 #xmax=3.e12 #axhline(y=1,color='k',ls='--') ax=gca() #ax.set_yscale('log') #axis([1,9,.2,5]) # plot SF Main Sequence from Elbaz et al 2011 #legend(loc='upper left',numpoints=1)#labels=clusternames) #axis([8.e8,2e12,.002,70]) # text(-.75,-.35,'Local Density',fontsize=18,horizontalalignment='center',transform=ax.transAxes) # subplot(3,3,4) # text(-2.8,1.9,'$R_{24}/R_r$',fontsize=18,verticalalignment='center',rotation=90,transform=ax.transAxes) xlabel('$M_{24} - log_{10}(M_*)$',fontsize=22) ylabel('$NUV - M_{24}$',fontsize=22) f=figuredir+'NUV24ssfr.eps' savefig(f) f=figuredir+'NUV24ssfr.png' savefig(f)
def plotSFR24StellarMassall(): figure(figsize=[10,8]) #figure() clf() #subplots_adjust(wspace=.25,hspace=.35) #colors=['k','k','k','k','k','k','k','k','k'] #shapes=['o','^','s','*','p','d','v','h','<'] xall=[] yall=[] x1all=[] y1all=[] i=0 for cl in mylocalclusters: i += 1 #subplot(3,3,i) #if cl.prefix.find('Coma') > -1: # continue x,y,x1,y1=cl.plotSFR24stellmass(colors[i-1],shapes[i-1]) #print x,y xall=xall+x yall=yall+y x1all=x1all+x1#field galaxies y1all=y1all+y1 xall=array(xall,'d') yall=array(yall,'d') x1all=array(x1all,'d') x1all=array(x1all,'d') xbin,ybin,ybinerr=my.binit(xall,yall,5) plot(xbin,ybin,'k-',marker='o',color='r',markersize=14,label='Clusters') errorbar(xbin,ybin,ybinerr,fmt=None,color='k',ecolor='k') #print xbin,ybin,ybinerr #xbin,ybin,ybinerr=my.biniterr(xall,yall,5) xbin,ybin,ybinerr=my.binit(x1all,y1all,5) #print xbin,ybin,ybinerr plot(xbin,ybin,'k-',marker='o',color='b',mec='k',markersize=14,label='Field') errorbar(xbin,ybin,ybinerr,fmt=None,color='k',ecolor='k',lw=3,label='_nolegend_') ax=gca() ax.set_xscale('log') ax.set_yscale('log') xmin=2.e8 xmax=3.e12 axis([xmin,xmax,.001,60]) # plot SF Main Sequence from Elbaz et al 2011 xl=arange(9,12,.1) xl=10.**xl yl=.25e-9*xl plot(xl,yl,'c-',lw=3,label='Elbaz+ 2011') yl=.025e-9*xl plot(xl,yl,'k--',lw=3,label='_nolabel_') yl=.0025e-9*xl plot(xl,yl,'k--',lw=3,label='_nolabel_') legend(loc='upper left',numpoints=1)#labels=clusternames) #axis([8.e8,2e12,.002,70]) # text(-.75,-.35,'Local Density',fontsize=18,horizontalalignment='center',transform=ax.transAxes) # subplot(3,3,4) # text(-2.8,1.9,'$R_{24}/R_r$',fontsize=18,verticalalignment='center',rotation=90,transform=ax.transAxes) xlabel('$Stellar \ Mass \ (M_\odot)$',fontsize=22) ylabel('$SFR_{IR} \ (M_\odot/yr)$',fontsize=22) f=figuredir+'SFR24StellarMass.eps' savefig(f) f=figuredir+'SFR24StellarMass.png' savefig(f) figure(figsize=(10,8)) sSFRcl=yall/xall*1.e9 sSFRf=y1all/x1all*1.e9 mybins=arange(-4,0,.15) yc,xc,t=hist(log10(sSFRcl),bins=mybins,histtype='step',color='r',label='Cluster',hatch='\\',normed=True) yf,xf,t=hist(log10(sSFRf),bins=mybins,histtype='step',color='b',label='Field',hatch='/',normed=True) xlabel('$log_{10}(sSFR_{IR} \ (Gyr^{-1} ))$',fontsize=22)#'(M_\odot/yr/(10^9 M_\odot))$',fontsize=22) ylabel('$ Normalized \ Counts $',fontsize=22) legend() f=figuredir+'sSFRhist.eps' savefig(f) f=figuredir+'sSFRhist.png' savefig(f)