예제 #1
0
파일: PBoptimizer.py 프로젝트: DmB/AGNmodel
def objF(x):
	global NofFuncCalls
	F = model.averaging(random.randint(0,5275500),int(round(x[0])),int(round(x[1])),
            x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10])
	#print command
	#print F
	NofFuncCalls = NofFuncCalls + 1
	if math.fmod(NofFuncCalls,5)==0.0:
		print NofFuncCalls
		fop = open("curres",'a')
		fop.write(str(NofFuncCalls)+ " Chi="+ str(F) + " ")
		fop.write(str(int(round(x[0])))+" ")
		fop.write(str(int(round(x[1])))+" ")
		fop.write(str(round(x[2],2))+" ")
		fop.write(str(round(x[3],2))+" ")
		fop.write(str(round(x[4],2))+" ")
		fop.write(str(round(x[5],2))+" ")
		fop.write(str(round(x[6],2))+" ")
		fop.write(str(round(x[7],2))+" ")
		fop.write(str(round(x[8],2))+" ")
		fop.write(str(round(x[9],2))+" ")
		fop.write(str(round(x[10],2))+"\n")
		fop.close()
		print NofFuncCalls,F.strip("\n"),round(x[0]),round(x[1]),round(x[2],2),round(x[3],2),round(x[4],2),round(x[5],2),round(x[6],2),round(x[7],2),round(x[8],2),round(x[9],2),round(x[10],2)
	return float(F)
예제 #2
0
파일: optimizer.py 프로젝트: DmB/AGNmodel
def Func(n_mean,n_sigma,I_mean,I_sigma,mean_Px,sigma_Px,mean_Py,sigma_Py,pcx,pcy,Ic):
	global NofFuncCalls
	F = model.averaging(random.randint(0,5275500),n_mean,n_sigma,I_mean,I_sigma,mean_Px,sigma_Px,mean_Py,sigma_Py,pcx,pcy,Ic)
	#print command
	#print F
	NofFuncCalls = NofFuncCalls + 1
	if math.fmod(NofFuncCalls,1000)==0.0:
		
		print NofFuncCalls
		fop = open("curres",'a')
		fop.write(str(NofFuncCalls)+"\n")
		fop.close()
	return float(F)