Beispiel #1
0
def FuncFitting_alignTwoVar(x, gen, ann): #this function finds the optimal value of gen and ann to minimize the residuals
	#For the user's inspection:
	print("Guessing gen=", gen)
	print("Guessing ann=", ann)
	
	Su.rewriteInput_TwoVar(gen, ann)

	incr()#increase the counter, ready to start the .exe.
	
	#Wait for the executable to run,
	orderToEndAt = 7
	folderName = "VaryingTwoVariables/"
	
	Su.runExecutable(folderName, orderToEndAt)

	Chi = np.zeros(6)
	
	#calculate the residual of the file retrieved from the same folder
	Chi[0] = np.sqrt(Fi.Residual(1000, 'slow', str("./calibration_fixed/"+folderName)))
	Chi[1] = np.sqrt(Fi.Residual( 900, 'slow', str("./calibration_fixed/"+folderName)))
	Chi[2] = np.sqrt(Fi.Residual( 800, 'slow', str("./calibration_fixed/"+folderName)))
	Chi[3] = np.sqrt(Fi.Residual( 700, 'slow', str("./calibration_fixed/"+folderName)))
	Chi[4] = np.sqrt(Fi.Residual(1000, 'fast', str("./calibration_fixed/"+folderName)))
	Chi[5] = np.sqrt(Fi.Residual( 900, 'fast', str("./calibration_fixed/"+folderName)))
	return Chi