Esempio n. 1
0
Bmin,Bmax=0.0,0.9
nMbh=((Mbhmax-Mbhmin)/dM)+1.0
nMdon=((Mdonmax-Mdonmin)/dM)+1.0
nP=((Permax-Permin)/dP)+1.0
nB=((Bmax-Bmin)/dBeta)+1.0
#############################
#########create block#############

Beta=linspace(Bmin,Bmax,nB)
Mbh0=linspace(Mbhmin,Mbhmax,nMbh)
Mdon0=linspace(Mdonmin,Mdonmax,nMdon)
P0=linspace(Permin,Permax,nP)
#############################
Fails={'Failed Spin Test':[],'Failed >P Test':[],'Failed Main Sequence Test':[],'Failed Mass Ratio Test':[],'Failed Pcurr Test':[]}
obs_mbh = linspace(cstr.Mbh[0]-cstr.Mbh[1],cstr.Mbh[0]+cstr.Mbh[1],1000)
obs_mdonlims=h.getMdonRange(obs_mbh)
GRID=[]
npoints=0
for beta in Beta:
      print beta
      B=[]
      for key in Fails.keys():
            Fails[key].append([])
      
      for mbh0 in Mbh0:
            MBH=[]
            Pmin=h.getP_RL(mbh0,RLmrange,RLzams)
            Pmax=h.getP_RL(mbh0,RLmrange,RLterminal)
            Pmax_i=interp1d(RLmrange,Pmax)
            Pmin_i=interp1d(RLmrange,Pmin)
            for key in Fails.keys():
Esempio n. 2
0
def checkWins(runpath):
	edd=0
	if not BINHIST in os.listdir(pth(runpath)):
		return [['DNF'],[]]
	
	rundata=loadtxt(pth(runpath,BINHIST))
	atPCross=[]
	for k in range(len(rundata)):
		
		
		edd=max(10.0**rundata[k][v.logMdot_bh]/h.getMeddingtonH(rundata[k][v.Mbh],rundata[k][v.surf_h]),edd)
			
		if rundata[k][v.P]>cstr.P[0]-cstr.P[1] and rundata[k][v.P]<cstr.P[0]+cstr.P[1]:
			atPCross.append(rundata[k])
		elif k>0 and rundata[k-1][v.P]<cstr.P[0]-cstr.P[1] and rundata[k][v.P]>cstr.P[0]-cstr.P[1]:
			atPCross.append(rundata[k-1])
			atPCross.append(rundata[k])
		elif k>0 and rundata[k-1][v.P]<cstr.P[0]+cstr.P[1] and rundata[k][v.P]>cstr.P[0]+cstr.P[1]:
			atPCross.append(rundata[k])
	if len(atPCross)==0:
		return [['P Fail'],array(transpose(rundata))]
   
	intervars=[[] for i in range(len(rundata[0]))]
	varlist=[v.logTeff,v.logg,v.Mbh,v.Mdon,v.logMdot_bh]
	per=[point[v.P] for point in atPCross]


	
	for i in varlist:
		
		val=[point[i] for point in atPCross]
	    
     
		intervars[i]=interp1d(per,val)
	
	P=linspace(max(cstr.P[0]-cstr.P[1],per[0]),cstr.P[0]+cstr.P[1],num=100,endpoint=True)
	Labels=[]
	Mbh_at_Plist=[]
	Mdon_at_Plist=[]
	for p in P:
		pscore=[]
		Mbh_at_Plist.append(intervars[v.Mbh](p))
		Mdon_at_Plist.append(intervars[v.Mdon](p))
		if h.getKerr_Param(rundata[0][v.Mbh],intervars[v.Mbh](p))<spinmax:pass
		else:pscore.append('Spin Fail')
		if intervars[v.Mbh](p)>Mbhmin and intervars[v.Mbh](p)<Mbhmax:pass
		else:pscore.append('Mbh Fail')
		MdonRange=h.getMdonRange(intervars[v.Mbh](p))
		if intervars[v.Mdon](p)>MdonRange[0] and intervars[v.Mdon](p)<MdonRange[1]:pass
		else:pscore.append('Mdon Fail')
		if pow(10.0,intervars[v.logTeff](p))>Tmin and pow(10.0,intervars[v.logTeff](p))<Tmax:pass
		else:pscore.append('Teff Fail')
		if pow(10.0,intervars[v.logg](p))>gmin and pow(10.0,intervars[v.logg](p))<gmax:pass
		else:pscore.append('g Fail')
		if pow(10.0,intervars[v.logMdot_bh](p))<h.getMdotCrit(intervars[v.Mdon](p),intervars[v.Mbh](p),p):pass
		else:pscore.append('Mdot Fail')
		if len(pscore)==0:
			Labels=['Win']
			
			break
		elif len(pscore)>len(Labels):Labels=pscore
	print edd                            
	return [Labels,array(transpose(rundata)),mean(Mbh_at_Plist),mean(Mdon_at_Plist),edd]