def plothod(self, ax=None, Mlow=1.e11, Mhigh=5e15, dlogM=0.01, popt=2, color='k', MFwgt=False, rebinsize=1, renormalize=False): """ popt = 0: cen only popt = 1: sat only popt = 2: tot """ if MFwgt == True: Mlist = self.mf.m wgt = self.mf.Nofm if rebinsize > 1: Mlist = np.exp( BRutils.rebin(np.log(self.mf.m), rebinsize=rebinsize)) tmpo = np.log10(Mlist[1:] / Mlist[:-1]).mean() assert ( np.fabs(np.log10(Mlist[1:]) - np.log10(Mlist[:-1]) - tmpo) < 0.001 * tmpo).all() Nrebin = BRutils.rebin(self.mf.Nofm, rebinsize=rebinsize) wgt = Nrebin ## need to rescale by dlog10M fac?? else: Mlist = np.exp( np.arange(np.log(Mlow), np.log(Mhigh) + 0.5 * dlogM, dlogM)) wgt = np.zeros(len(Mlist)) + 1. if ax is None: ff = plt.figure(figsize=[6, 6]) ax = ff.add_subplot(1, 1, 1) else: ff = None if popt == 0: myy = wgt * self.Ncen(Mlist) if popt == 1: myy = wgt * self.Ncen(Mlist) * (0. + self.Nsat(Mlist)) if popt == 2: myy = wgt * self.Ncen(Mlist) * (1. + self.Nsat(Mlist)) if renormalize == True: myy = myy / float(myy.sum()) ax.plot(Mlist, myy, color) ax.set_xscale('log') return ff, ax
def plothod(self,ax=None, Mlow=1.e11,Mhigh=5e15,dlogM=0.01,popt=2,color='k',MFwgt=False,rebinsize=1,renormalize=False): """ popt = 0: cen only popt = 1: sat only popt = 2: tot """ if MFwgt == True: Mlist = self.mf.m wgt = self.mf.Nofm if rebinsize > 1: Mlist = np.exp(BRutils.rebin(np.log(self.mf.m),rebinsize=rebinsize)) tmpo = np.log10(Mlist[1:]/Mlist[:-1]).mean() assert (np.fabs(np.log10(Mlist[1:]) - np.log10(Mlist[:-1]) - tmpo) < 0.001*tmpo).all() Nrebin = BRutils.rebin(self.mf.Nofm,rebinsize=rebinsize) wgt = Nrebin ## need to rescale by dlog10M fac?? else: Mlist = np.exp(np.arange(np.log(Mlow),np.log(Mhigh)+0.5*dlogM,dlogM)) wgt = np.zeros(len(Mlist))+1. if ax is None: ff = plt.figure(figsize=[6,6]) ax = ff.add_subplot(1,1,1) else: ff = None if popt == 0: myy = wgt*self.Ncen(Mlist) if popt == 1: myy = wgt*self.Ncen(Mlist)*(0.+self.Nsat(Mlist)) if popt == 2: myy = wgt*self.Ncen(Mlist)*(1.+self.Nsat(Mlist)) if renormalize == True: myy = myy/float(myy.sum()) ax.plot(Mlist,myy,color) ax.set_xscale('log') return ff, ax
def plothodsubsample(self, ax=None, popt=0, rebinsize=10, fillopt=0, color='k', renormalize=False, MFwgt=False, flist=[0.954499736104], nsubsample=1000, whichbox=1, cenopt=2, satopt=2, bosswdir='/home/howdiedoo/boss/', whichPB=0, COMVopt=0, alpha=0.5, fsatrescale=1.): """ Computes if necessary the subsample. popt = 0: Ncen popt = 1: Nsat popt = 2: Ntot popt = 3: Nsat/fsatrescale; only makes sense on a MFwgt plot. """ try: x = self.bNcen[0, 0] x = self.bNcen[0, 0] x = self.bNcen[0, 0] wgt = np.zeros(len(self.msub)) + 1. if MFwgt == True: hh = hod.hodfromchain(self.chain[0], whichbox=whichbox, cenopt=cenopt, satopt=satopt, bosswdir=bosswdir, whichPB=whichPB, COMVopt=COMVopt) wgt = hh.mf.Nofm if rebinsize > 1: Nrebin = BRutils.rebin(hh.mf.Nofm, rebinsize=rebinsize) wgt = Nrebin except: ## need to run subsample. hh = hod.hodfromchain(self.chain[0], whichbox=whichbox, cenopt=cenopt, satopt=satopt, bosswdir=bosswdir, whichPB=whichPB, COMVopt=COMVopt) Mlist = hh.mf.m wgt = np.zeros(len(Mlist)) + 1. if MFwgt == True: wgt = hh.mf.Nofm if rebinsize > 1: Mlist = np.exp( BRutils.rebin(np.log(hh.mf.m), rebinsize=rebinsize)) wgt = np.zeros(len(Mlist)) + 1. tmpo = np.log10(Mlist[1:] / Mlist[:-1]).mean() assert ( np.fabs(np.log10(Mlist[1:]) - np.log10(Mlist[:-1]) - tmpo) < 0.001 * tmpo).all() if MFwgt == True: Nrebin = BRutils.rebin(hh.mf.Nofm, rebinsize=rebinsize) wgt = Nrebin self.hodsubsample(Mlist, flist=flist, nsubsample=nsubsample, whichbox=whichbox, cenopt=cenopt, satopt=satopt, bosswdir=bosswdir, whichPB=whichPB, COMVopt=COMVopt) if ax is None: ff = plt.figure(figsize=[6, 6]) ax = ff.add_subplot(1, 1, 1) else: ff = None if popt == 0: myy1 = wgt * self.bNcen[1] myy2 = wgt * self.bNcen[2] if popt == 1: myy1 = wgt * self.bNsat[1] myy2 = wgt * self.bNsat[2] if popt == 2: myy1 = wgt * self.bNtot[1] myy2 = wgt * self.bNtot[2] if popt == 3: myy1 = wgt * self.bNsat[1] / fsatrescale myy2 = wgt * self.bNsat[2] / fsatrescale if renormalize == True: myy1 = myy1 / float(myy1.sum()) myy2 = myy2 / float(myy2.sum()) if fillopt == 1: ax.fill_between(self.msub, myy1, myy2, facecolor=color, alpha=alpha) else: ax.plot(self.msub, myy1, color) ax.plot(self.msub, myy2, color) ## how do we fill between two curves instead. ax.set_xscale('log') return ff, ax
def plothodsubsample(self,ax=None,popt=0,rebinsize=10,fillopt=0,color='k',renormalize=False,MFwgt=False,flist=[0.954499736104],nsubsample=1000, whichbox=1,cenopt=2,satopt=2,bosswdir='/home/howdiedoo/boss/',whichPB=0,COMVopt=0,alpha=0.5,fsatrescale=1.): """ Computes if necessary the subsample. popt = 0: Ncen popt = 1: Nsat popt = 2: Ntot popt = 3: Nsat/fsatrescale; only makes sense on a MFwgt plot. """ try: x = self.bNcen[0,0] x = self.bNcen[0,0] x = self.bNcen[0,0] wgt = np.zeros(len(self.msub))+1. if MFwgt == True: hh = hod.hodfromchain(self.chain[0],whichbox=whichbox,cenopt=cenopt,satopt=satopt,bosswdir=bosswdir,whichPB=whichPB,COMVopt=COMVopt) wgt = hh.mf.Nofm if rebinsize > 1: Nrebin = BRutils.rebin(hh.mf.Nofm,rebinsize=rebinsize) wgt = Nrebin except: ## need to run subsample. hh = hod.hodfromchain(self.chain[0],whichbox=whichbox,cenopt=cenopt,satopt=satopt,bosswdir=bosswdir,whichPB=whichPB,COMVopt=COMVopt) Mlist = hh.mf.m wgt = np.zeros(len(Mlist))+1. if MFwgt == True: wgt = hh.mf.Nofm if rebinsize > 1: Mlist = np.exp(BRutils.rebin(np.log(hh.mf.m),rebinsize=rebinsize)) wgt = np.zeros(len(Mlist))+1. tmpo = np.log10(Mlist[1:]/Mlist[:-1]).mean() assert (np.fabs(np.log10(Mlist[1:]) - np.log10(Mlist[:-1]) - tmpo) < 0.001*tmpo).all() if MFwgt == True: Nrebin = BRutils.rebin(hh.mf.Nofm,rebinsize=rebinsize) wgt = Nrebin self.hodsubsample(Mlist,flist=flist,nsubsample=nsubsample,whichbox=whichbox,cenopt=cenopt,satopt=satopt,bosswdir=bosswdir,whichPB=whichPB,COMVopt=COMVopt) if ax is None: ff = plt.figure(figsize=[6,6]) ax = ff.add_subplot(1,1,1) else: ff = None if popt == 0: myy1 = wgt*self.bNcen[1] myy2 = wgt*self.bNcen[2] if popt == 1: myy1 = wgt*self.bNsat[1] myy2 = wgt*self.bNsat[2] if popt == 2: myy1 = wgt*self.bNtot[1] myy2 = wgt*self.bNtot[2] if popt == 3: myy1 = wgt*self.bNsat[1]/fsatrescale myy2 = wgt*self.bNsat[2]/fsatrescale if renormalize == True: myy1 = myy1/float(myy1.sum()) myy2 = myy2/float(myy2.sum()) if fillopt == 1: ax.fill_between(self.msub,myy1,myy2,facecolor=color,alpha=alpha) else: ax.plot(self.msub,myy1,color) ax.plot(self.msub,myy2,color) ## how do we fill between two curves instead. ax.set_xscale('log') return ff, ax