def calcavesky(): input = open("noise.dat", 'r') aperture = [] counts = [] area = [] j = 0 for line in input: if line.find('#') > -1: #skip lines with '#' in them continue if line.find('mosaic_minus') > -1: #skip lines with '#' in them j = 0 continue j = j + 1 if (j > 3): #print j, line t = line.split() aperture.append(float(t[0])) counts.append(float(t[1])) area.append(float(t[2])) input.close() aperture = N.array(aperture, 'f') counts = N.array(counts, 'f') area = N.array(area, 'f') ap = N.zeros(npoints, 'f') aparea = N.zeros(nap, 'f') aveap = N.zeros(nap, 'f') aveaperr = N.zeros(nap, 'f') avearea = N.zeros(nap, 'f') aveareaerr = N.zeros(nap, 'f') #for i in range(len(ap)): for i in range(nap): #print i, len(ap),aperture[i],aperture[i+1] if (i < (nap - 1)): ap = N.compress( (aperture >= aperture[i]) & (aperture < aperture[i + 1]), counts) aparea = N.compress( (aperture >= aperture[i]) & (aperture < aperture[i + 1]), area) else: ap = N.compress((aperture >= aperture[i]) & (aperture < 20.), counts) aparea = N.compress((aperture >= aperture[i]) & (aperture < 20.), area) #print ap #aparea=N.compress((aperture >= aperture[i]) & (aperture < aperture[i+1]),area) aveap[i] = N.average(ap) aveaperr[i] = scipy.stats.std(ap) avearea[i] = N.average(aparea) aveareaerr[i] = scipy.stats.std(aparea) print "ave sky = %8.4f +/- %8.4f" % (N.average(ap), scipy.stats.std(ap)) print "ave area = %8.4f +/- %8.4f" % (N.average(aparea), scipy.stats.std(aparea)) return aveap, aveaperr, avearea, aveareaerr
def binitave(x, y, n): #bin arrays x, y into n bins, returning xbin,ybin nx = len(x) y = N.take(y, N.argsort(x)) #sort y according to x rankings x = N.take(x, N.argsort(x)) xbin = N.zeros(n, 'f') ybin = N.zeros(n, 'f') ybinerr = N.zeros(n, 'f') for i in range(n): nmin = i * int(float(nx) / float(n)) nmax = (i + 1) * int(float(nx) / float(n)) #xbin[i]=pylab.median(x[nmin:nmax]) #ybin[i]=pylab.median(y[nmin:nmax]) xbin[i] = N.average(x[nmin:nmax]) ybin[i] = N.average(y[nmin:nmax]) ybinerr[i] = scipy.stats.std(y[nmin:nmax]) return xbin, ybin, ybinerr
def binitbins(xmin, xmax, nbin, x, y): #use equally spaced bins dx = float((xmax - xmin) / (nbin)) xbin = N.arange(xmin, (xmax), dx) + dx / 2. #print "within binitbins" #print "xbin = ",xbin #print "dx = ",dx #print "xmax = ",xmax #print "xmin = ",xmin ybin = N.zeros(len(xbin), 'd') ybinerr = N.zeros(len(xbin), 'd') xbinnumb = N.array(len(x), 'd') x1 = N.compress((x >= xmin) & (x <= xmax), x) y1 = N.compress((x >= xmin) & (x <= xmax), y) x = x1 y = y1 xbinnumb = ((x - xmin) * nbin / (xmax - xmin) ) #calculate x bin number for each point j = -1 for i in range(len(xbin)): ydata = N.compress(abs(xbinnumb - float(i)) < .5, y) try: ybin[i] = N.average(ydata) #ybin[i]=pylab.median(ydata) ybinerr[i] = pylab.std(ydata) / N.sqrt(float(len(ydata))) except ZeroDivisionError: ybin[i] = 0. ybinerr[i] = 0. return xbin, ybin, ybinerr
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 biniterr( x, y, n ): #bin arrays x, y into n equally-populated bins, returning xbin,ybin nx = len(x) #x=N.array(x,'f') #y=N.array(y,'f') y = N.take(y, N.argsort(x)) x = N.take(x, N.argsort(x)) xbin = N.zeros(n, 'f') xbin = N.zeros(n, 'f') ybin = N.zeros(n, 'f') ybinerr = N.zeros(n, 'f') for i in range(n): nmin = i * int(float(nx) / float(n)) nmax = (i + 1) * int(float(nx) / float(n)) #xbin[i]=scipy.stats.stats.median(x[nmin:nmax]) #ybin[i]=scipy.stats.stats.median(y[nmin:nmax]) xbin[i] = N.average(x[nmin:nmax]) ybin[i] = N.average(y[nmin:nmax]) ybinerr[i] = pylab.std(y[nmin:nmax]) / N.sqrt(1. * (nmax - nmin)) return xbin, ybin, ybinerr
def calcCorrelationHelper(s1p, s2p): # if the traits share less than six strains, then we don't # bother with the correlations if len(s1p) < 6: return 0.0 # subtract by x-bar and y-bar elementwise #oldS1P = s1p.copy() #oldS2P = s2p.copy() s1p = (s1p - numarray.average(s1p)).astype(numarray.Float64) s2p = (s2p - numarray.average(s2p)).astype(numarray.Float64) # square for the variances s1p_2 = numarray.sum(s1p**2) s2p_2 = numarray.sum(s2p**2) try: corr = (numarray.sum(s1p*s2p)/ numarray.sqrt(s1p_2 * s2p_2)) except ZeroDivisionError: corr = 0.0 return corr
def binitsumequal(x, y, n): #bin arrays x, y into n bins, returning xbin,ybin nx = len(x) #x=N.array(x,'f') #y=N.array(y,'f') y = N.take(y, N.argsort(x)) x = N.take(x, N.argsort(x)) xbin = N.zeros(n, 'f') ybin = N.zeros(n, 'f') #ybinerr=N.zeros(n,'f') for i in range(n): nmin = i * int(float(nx) / float(n)) nmax = (i + 1) * int(float(nx) / float(n)) xbin[i] = N.average(x[nmin:nmax]) ybin[i] = N.sum(y[nmin:nmax]) #xbin[i]=N.average(x[nmin:nmax]) #ybin[i]=N.average(y[nmin:nmax]) #ybinerr[i]=scipy.stats.std(y[nmin:nmax]) return xbin, ybin #, ybinerr
def getsdssphotcats(self): #get photometric sources within 2R200 print "elapsed time = ",time.clock()-starttime self.mcut=N.zeros(len(self.z),'f') cl=N.arange(17,len(self.z),1) self.nphot=N.zeros(len(self.z),'f') self.nspec=N.zeros(len(self.z),'f') for i in range(len(self.z)): #for i in cl: dL = self.dL[i] print "getting phot cat for cluster abell",self.id[i] r200arcmin=self.r200deg[i]*60. #drsearch=2.*r200arcmin#2xR200 in arcmin for sdss query drsearch=1.*r200arcmin#2xR200 in arcmin for sdss query #Vg=0.3556-0.7614*((self.avegr)-0.6148)#(V-g) from Blanton et al 2003 mr=mabscut - 0.1331 + 5.*N.log10(dL)+25.+self.kcorr[i] print i, self.z[i], dL, mr self.mcut[i]=mr print "ra, dec, dr, mr = %12.8f %12.8f %8.3f %5.2f" % (self.ra[i],self.dec[i],drsearch,mr) #query="select g.ra, g.dec, g.u, g.g, g.r, g.i, g.z, g.plate_ID, g.MJD, from galaxy g, dbo.fGetNearbyObjEq(%12.8f,%12.8f,%8.3f) n where g.objID = n.objID and (g.g < %5.2f) and ((0.384*g.g + 0.716*g.r)< %5.2f)" % (self.ra[i],self.dec[i],drsearch,(mr+1.5),mr) query="select g.ra, g.dec, g.u, g.g, g.r, g.i, g.z, g.objid, g.specObjID,g.extinction_u, g.extinction_g, g.extinction_r, g.extinction_i, g.extinction_z from galaxy g, dbo.fGetNearbyObjEq(%12.8f,%12.8f,%8.3f) n where g.objID = n.objID and (g.g < %5.2f) and (g.PrimTarget & 0x00000040) > 0 " % (self.ra[i],self.dec[i],drsearch,(mr)) lines=sqlcl.query(query).readlines() #print query print "got number+1 phot objects = ",len(lines) #print lines self.nphot[i]=1.*len(lines) query="select g.ra, g.dec, g.u, g.g, g.r, g.i, g.z, g.objid, g.specObjID,g.extinction_u, g.extinction_g, g.extinction_r, g.extinction_i, g.extinction_z, l.ew, l.ewErr, l2.ew, l2.ewErr from galaxy g, specobj s, SpecLine l, SpecLine l2, dbo.fGetNearbyObjEq(%12.8f,%12.8f,%8.3f) n where g.objID = n.objID and g.objID = s.bestobjid and s.specobjID=l.specobjID and s.specobjID=l2.specobjID and (g.g < %5.2f) and (g.PrimTarget & 0x00000040) > 0 and l.LineID = 3727 and l2.LineID = 6565" % (self.ra[i],self.dec[i],drsearch,(mr)) lines=sqlcl.query(query).readlines() #print query print "got number+1 spec objects w/in R200= ",len(lines) #print lines self.nspec[i]=1.*len(lines) self.compl=self.nspec/self.nphot print "average completeness of sdss spectroscopy is = ",N.average(self.compl), pylab.std(self.compl)
def customCmp(traitPair, traitPair2): magAvg1 = numarray.average(map(abs, traitPair[1])) magAvg2 = numarray.average(map(abs, traitPair2[1])) # invert the sign to get descending order return -cmp(magAvg1, magAvg2)
import numarray as N #check translation of ediscs ra and dec era = [] edec = [] gra = [] gdec = [] infile1 = open('cl1018radec.dat', 'r') for line in infile1: t = line.split() era.append(float(t[0])) edec.append(float(t[1])) infile1.close() era = N.array(era, 'd') edec = N.array(edec, 'd') infile1 = open('cl1018-GMOSradec.dat', 'r') for line in infile1: t = line.split() gra.append(float(t[0])) gdec.append(float(t[1])) infile1.close() gra = N.array(gra, 'd') gdec = N.array(gdec, 'd') dr = N.sqrt((gra - era)**2 + (gdec - edec)**2) dr = dr * 3600. for i in range(len(dr)): print dr[i] print "Average difference = ", N.average(dr), max(dr), min(dr)
z = [] fHa = [] infile = open('targets', 'r') for line in infile: if line.find('#') > -1: continue t = line.split() id.append(t[0]) z.append(float(t[6])) fHa.append(float(t[5])) z = N.array(z, 'f') fHa = N.array(fHa, 'd') * 1.e-16 #f(HA) 1e-16 erg/s/cm2 dL = N.zeros(len(z), 'd') for i in range(len(dL)): dL[i] = my.dLcm(z[i], h) LHa = fHa * 4. * N.pi * dL**2 sfr = LHa * 7.9e-42 print "id z SFR SFR/dL^2 f/(1Msun/yr@z=0.35) expt Ncycles (70um)" for i in range(len(z)): r = 1.e6 * sfr[i] / (my.dL(z[i], h)**2) r2 = r / (3.12 / 11.5 * 10.) exp = 1 / N.sqrt(r2) print "%s %5.4f %5.1f %5.2f %5.2f %5.2f %2i" % ( id[i], z[i], sfr[i], r, r2, exp, round(10. * exp)) zmin = min(z) zmax = max(z) r = (my.dL(zmax, h) / my.dL(zmin, h))**2 print "(max dL/min dL)^2 = ", r print "Average SFR = ", N.average(sfr)
def gotoit(): nbin = 10 #c=Cluster() #g=Galaxy() clusterfile = "clusters.spec.dat" print "reading in cluster file to get cluster parameters" c.creadfiles(clusterfile) print "got ", len(c.z), " clusters" c.convarray() c.Kcorr() go2 = [] #combined arrays containing all galaxies gsf = [] #combined arrays containing all galaxies gsig5 = [] gsig10 = [] gsig52r200 = [] #spec catalogs extended out to 2xR200 gsig102r200 = [] #spec catalogs extended out to 2xR200 gsig5phot = [] gsig10phot = [] sgo2 = [] #combined arrays containing all galaxies sgha = [] #combined arrays containing all galaxies sgsf = [] #combined arrays containing all galaxies sgsig5 = [] sgsig10 = [] sgsig52r200 = [] #spec catalogs extended out to 2xR200 sgsig102r200 = [] #spec catalogs extended out to 2xR200 sgsig5phot = [] sgsig10phot = [] if (mode < 1): c.getsdssphotcats() c.getsdssspeccats() gr = [] #list of median g-r colors psplotinit('summary.ps') x1 = .1 x2 = .45 x3 = .6 x4 = .95 y1 = .15 y2 = .45 y3 = .55 y4 = .85 ppgplot.pgsch(1.2) #font size ppgplot.pgslw(2) #for i in range(len(c.z)): cl = [10] (xl, xu, yl, yu) = ppgplot.pgqvp(0) print "viewport = ", xl, xu, yl, yu complall = [] for i in range(len(c.z)): #for i in cl: gname = "g" + str(i) gname = Galaxy() gspecfile = "abell" + str(c.id[i]) + ".spec.dat" gname.greadfiles(gspecfile, i) print "number of members = ", len(gname.z) if len(gname.z) < 10: print "less than 10 members", len(gname.z) continue gname.convarray() #gname.cullmembers() #gname.getmemb()#get members w/in R200 #gr.append(N.average(gname.g-gname.r)) gspec2r200file = "abell" + str(c.id[i]) + ".spec2r200.dat" gname.greadspecfiles(gspec2r200file, c.dL[i], c.kcorr[i], i) print i, c.id[i], " getnearest, first call", len(gname.ra), len( gname.sra), sum(gname.smemb) #gname.getnearest(i) (gname.sig52r200, gname.sig102r200) = gname.getnearestgen( gname.ra, gname.dec, gname.sra, gname.sdec, i ) #measure distances from ra1, dec1 to members in catalog ra2, dec2 sig52r200 = N.compress(gname.memb > 0, gname.sig52r200) gsig52r200[len(gsig5phot):] = sig52r200 sig102r200 = N.compress(gname.memb > 0, gname.sig102r200) gsig102r200[len(gsig10phot):] = sig102r200 gphotfile = "abell" + str(c.id[i]) + ".phot.dat" gname.greadphotfiles(gphotfile, c.dL[i], c.kcorr[i]) gname.getnearest(i) #print "len of local density arrays = ",len(gname.sig5),len(gname.sig5phot) #print gspecfile, c.z[i],c.kcorr[i] (ds5, ds10) = gname.gwritefiles(gspecfile, i) o2 = N.compress(gname.memb > 0, gname.o2) go2[len(go2):] = o2 sf = N.compress(gname.memb > 0, gname.sf) gsf[len(gsf):] = sf sig5 = N.compress(gname.memb > 0, gname.sig5) gsig5[len(gsig5):] = sig5 sig10 = N.compress(gname.memb > 0, gname.sig10) gsig10[len(gsig10):] = sig10 sig5phot = N.compress(gname.memb > 0, gname.sig5phot) gsig5phot[len(gsig5phot):] = sig5phot sig10phot = N.compress(gname.memb > 0, gname.sig10phot) gsig10phot[len(gsig10phot):] = sig10phot ds5 = N.array(ds5, 'f') ds10 = N.array(ds10, 'f') #print len(ds5),len(ds10) #ppgplot.pgsvp(xl,xu,yl,yu) ppgplot.pgsvp(0.1, .9, .08, .92) ppgplot.pgslw(7) label = 'Abell ' + str( c.id[i]) + ' (z=%5.2f, \gs=%3.0f km/s)' % (c.z[i], c.sigma[i]) ppgplot.pgtext(0., 1., label) ppgplot.pgslw(2) ppgplot.pgsvp(x1, x2, y1, y2) #sets viewport #ppgplot.pgbox("",0.0,0,"",0.0) ppgplot.pgswin(-1., 3., -1., 3.) #axes limits ppgplot.pgbox('bcnst', 1, 2, 'bcvnst', 1, 2) #tickmarks and labeling ppgplot.pgmtxt('b', 2.5, 0.5, 0.5, "\gS\d10\u(phot) (gal/Mpc\u2\d)") #xlabel ppgplot.pgmtxt('l', 2.6, 0.5, 0.5, "\gS\d10\u(spec) (gal/Mpc\u2\d)") x = N.arange(-5., 10., .1) y = x ppgplot.pgsls(1) #dotted ppgplot.pgslw(4) #line width ppgplot.pgline(x, y) x = N.log10(sig10phot) y = N.log10(sig10) ppgplot.pgsch(.7) ppgplot.pgpt(x, y, 17) xp = N.array([-0.5], 'f') yp = N.array([2.5], 'f') ppgplot.pgpt(xp, yp, 17) ppgplot.pgtext((xp + .1), yp, 'spec(1.2xR200) vs phot') ppgplot.pgsci(4) xp = N.array([-0.5], 'f') yp = N.array([2.2], 'f') ppgplot.pgpt(xp, yp, 21) ppgplot.pgtext((xp + .1), yp, 'spec(2xR200) vs phot') y = N.log10(sig102r200) ppgplot.pgsch(.9) ppgplot.pgpt(x, y, 21) ppgplot.pgsch(1.2) ppgplot.pgslw(2) #line width ppgplot.pgsci(1) #ppgplot.pgenv(-200.,200.,-1.,20.,0,0) #ppgplot.pgsci(2) #ppgplot.pghist(len(ds5),ds5,-200.,200.,30,1) #ppgplot.pgsci(4) #ppgplot.pghist(len(ds10),ds10,-200.,200.,30,1) #ppgplot.pgsci(1) #ppgplot.pglab("\gD\gS","Ngal",gspecfile) #ppgplot.pgpanl(1,2) g = N.compress(gname.memb > 0, gname.g) r = N.compress(gname.memb > 0, gname.r) V = N.compress(gname.memb > 0, gname.V) dmag = N.compress(gname.memb > 0, gname.dmagnearest) dnearest = N.compress(gname.memb > 0, gname.nearest) dz = N.compress(gname.memb > 0, gname.dz) #ppgplot.pgsvp(x3,x4,y1,y2) #sets viewport #ppgplot.pgenv(-.5,3.,-1.,5.,0,0) #ppgplot.pgpt((g-V),(g-r),17) #ppgplot.pgsci(1) #ppgplot.pglab("g - M\dV\u",'g-r',gspecfile) ppgplot.pgsvp(x1, x2, y3, y4) #sets viewport #ppgplot.pgbox("",0.0,0,"",0.0) ppgplot.pgswin( (c.ra[i] + 2. * c.r200deg[i] / N.cos(c.dec[i] * N.pi / 180.)), (c.ra[i] - 2 * c.r200deg[i] / N.cos(c.dec[i] * N.pi / 180.)), (c.dec[i] - 2. * c.r200deg[i]), (c.dec[i] + 2. * c.r200deg[i])) ppgplot.pgbox('bcnst', 0.0, 0.0, 'bcvnst', 0.0, 0.0) #tickmarks and labeling ppgplot.pgmtxt('b', 2.5, 0.5, 0.5, "RA") #xlabel ppgplot.pgmtxt('l', 2.6, 0.5, 0.5, "Dec") #ppgplot.pglab("RA",'Dec',gspecfile) ppgplot.pgsfs(2) ppgplot.pgcirc(c.ra[i], c.dec[i], c.r200deg[i]) ppgplot.pgsls(4) ppgplot.pgcirc(c.ra[i], c.dec[i], 1.2 * c.r200deg[i]) ppgplot.pgsls(1) #ppgplot.pgcirc(c.ra[i],c.dec[i],c.r200deg[i]/N.cos(c.dec[i]*N.pi/180.)) ppgplot.pgsci(2) ppgplot.pgpt(gname.ra, gname.dec, 17) ppgplot.pgsci(4) ppgplot.pgpt(gname.photra, gname.photdec, 21) ppgplot.pgsci(1) #calculate completeness w/in R200 dspec = N.sqrt((gname.ra - c.ra[i])**2 + (gname.dec - c.dec[i])**2) dphot = N.sqrt((gname.photra - c.ra[i])**2 + (gname.photdec - c.dec[i])**2) nphot = 1. * len(N.compress(dphot < c.r200deg[i], dphot)) nspec = 1. * len(N.compress(dspec < c.r200deg[i], dspec)) s = "Completeness for cluster Abell %s = %6.2f (nspec=%6.1f,nphot= %6.1f)" % ( str(c.id[i]), float(nspec / nphot), nspec, nphot) print s complall.append(float(nspec / nphot)) ppgplot.pgsvp(x3, x4, y3, y4) #sets viewport #ppgplot.pgsvp(x1,x2,y3,y4) #sets viewport #ppgplot.pgbox("",0.0,0,"",0.0) ppgplot.pgswin(-0.005, .05, -1., 1.) ppgplot.pgbox('bcnst', .02, 2, 'bcvnst', 1, 4) #tickmarks and labeling ppgplot.pgsch(1.0) ppgplot.pgmtxt('b', 2.5, 0.5, 0.5, "Dist to nearest phot neighbor (deg)") #xlabel ppgplot.pgsch(1.2) ppgplot.pgmtxt('l', 2.6, 0.5, 0.5, 'M\dV\u(phot) - M\dV\u(spec)') ppgplot.pgsci(2) ppgplot.pgpt(dnearest, dmag, 17) ppgplot.pgsci(1) x = N.arange(-30., 30., 1.) y = 0 * x ppgplot.pgsci(1) ppgplot.pgsls(2) ppgplot.pgline(x, y) ppgplot.pgsls(1) ppgplot.pgsci(1) dm = N.compress(dnearest < 0.01, dmag) std = '%5.3f (%5.3f)' % (pylab.mean(dm), pylab.std(dm)) #ppgplot.pgslw(7) #label='Abell '+str(c.id[i]) #ppgplot.pgtext(0.,1.,label) ppgplot.pgslw(2) label = '\gDM\dV\u(err) = ' + std ppgplot.pgsch(.9) ppgplot.pgtext(0., .8, label) #label = "z = %5.2f"%(c.z[i]) #ppgplot.pgtext(0.,.8,label) ppgplot.pgsch(1.2) #ppgplot.pgsvp(x3,x4,y3,y4) #sets viewport #ppgplot.pgenv(-.15,.15,-3.,3.,0,0) #ppgplot.pgsci(2) #ppgplot.pgpt(dz,dmag,17) #ppgplot.pgsci(1) #ppgplot.pglab("z-z\dcl\u",'\gD Mag',gspecfile) ppgplot.pgsvp(x3, x4, y1, y2) #sets viewport ppgplot.pgswin(-3., 3., -1., 1.) ppgplot.pgbox('bcnst', 1, 2, 'bcvnst', 1, 4) #tickmarks and labeling ppgplot.pgmtxt('b', 2.5, 0.5, 0.5, "\gDv/\gs") #xlabel ppgplot.pgmtxt('l', 2.6, 0.5, 0.5, 'M\dV\u(phot) - M\dV\u(spec)') ppgplot.pgsci(2) dv = dz / (1 + c.z[i]) * 3.e5 / c.sigma[i] ppgplot.pgpt(dv, dmag, 17) ppgplot.pgsci(1) x = N.arange(-30., 30., 1.) y = 0 * x ppgplot.pgsci(1) ppgplot.pgsls(2) ppgplot.pgline(x, y) ppgplot.pgsls(1) ppgplot.pgsci(1) #ppgplot.pgsvp(x1,x2,y1,y2) #sets viewport #ppgplot.pgenv(0.,3.5,-3.,3.,0,0) #ppgplot.pgsci(4) #ppgplot.pgpt((g-r),dmag,17) #ppgplot.pgsci(1) #ppgplot.pglab("g-r",'\gD Mag',gspecfile) #ppgplot.pgsvp(x1,x2,y1,y2) #sets viewport #ppgplot.pgenv(-25.,-18.,-1.,1.,0,0) #ppgplot.pgsci(4) #ppgplot.pgpt((V),dmag,17) #x=N.arange(-30.,30.,1.) #y=0*x #ppgplot.pgsci(1) #ppgplot.pgsls(2) #ppgplot.pgline(x,y) #ppgplot.pgsls(1) #ppgplot.pgsci(1) #ppgplot.pglab("M\dV\u(spec)",'M\dV\u(phot) - M\dV\u(spec)',gspecfile) #ppgplot.pgpage() #ppgplot.pgpage() #combine galaxy data ppgplot.pgpage() (sssig5, sssig10) = gname.getnearestgen(gname.sra, gname.sdec, gname.sra, gname.sdec, i) #get spec-spec local density (spsig5, spsig10) = gname.getnearestgen(gname.sra, gname.sdec, gname.photra, gname.photdec, i) #get spec-phot local density o2 = N.compress(gname.smemb > 0, gname.so2) sgo2[len(sgo2):] = o2 ha = N.compress(gname.smemb > 0, gname.sha) sgha[len(sgha):] = ha sf = N.compress(gname.smemb > 0, gname.ssf) sgsf[len(sgsf):] = sf sig5 = N.compress(gname.smemb > 0, sssig5) sgsig5[len(sgsig5):] = sig5 sig10 = N.compress(gname.smemb > 0, sssig10) sgsig10[len(sgsig10):] = sig10 sig5phot = N.compress(gname.smemb > 0, spsig5) sgsig5phot[len(sgsig5phot):] = sig5phot sig10phot = N.compress(gname.smemb > 0, spsig10) sgsig10phot[len(sgsig10phot):] = sig10phot #gr=N.array(gr,'f') #c.assigncolor(gr) #for i in range(len(c.z)): # print c.id[i],c.z[i],c.r200[i],c.r200deg[i] print "Average Completeness w/in R200 = ", N.average(N.array( complall, 'f')) print "sig o2", len(gsig10), len(gsig10phot), len(go2) print "sig o2 large", len(sgsig10), len(sgsig10phot), len(sgo2) plotsigo2all(gsig10, gsig10phot, go2, 'o2vsig10spec', nbin) #plotsigo2(gsig5phot,-1*go2,'o2vsig5phot',nbin) plotsigsff(gsig5, gsf, 'sffvsig5spec', nbin) #sf frac versus sigma plotsigsff(gsig5phot, gsf, 'sffvsig5phot', nbin) #sf frac versus sigma plotsigsffall(gsig5, gsig5phot, gsf, 'sffvsig5all', nbin) #sf frac versus sigma plotsig10sffall(gsig10, gsig10phot, gsf, 'sffvsig10all', nbin) #sf frac versus sigma #plotsighaall(gsig10,gsig10phot,gha,'havsig10spec',20) #plotsigo2all(sgsig10,sgsig10phot,sgo2,'o2vsig10spec.large',30) plotsighaall(sgsig10, sgsig10phot, sgha, 'havsig10spec.large', 10) #plotsigsffall(sgsig5,sgsig5phot,sgsf,'sffvsig5.large',nbin)#sf frac versus sigma #plotsig10sffall(sgsig10,sgsig10phot,sgsf,'sffvsig10.large',nbin)#sf frac versus sigma psplotinit('one2one.ps') ppgplot.pgenv(-1.5, 2.5, -1.5, 2.5, 0) ppgplot.pglab("\gS\d10\u(phot) (gal/Mpc\u2\d)", "\gS\d10\u(spec) (gal/Mpc\u2\d)", "") x = N.arange(-5., 10., .1) y = x ppgplot.pgsls(1) #dotted ppgplot.pgslw(4) #line width ppgplot.pgline(x, y) x = N.log10(gsig10phot) y = N.log10(gsig10) ppgplot.pgsch(.7) ppgplot.pgpt(x, y, 17) ppgplot.pgsch(1.) ppgplot.pgsci(1) ppgplot.pgend()