def C2(x): "This is the new version" return 100000 * myCostFunction(x) def C3(x): "Cost function constructed by hand" from test_mogi2 import cost_function return cost_function(x) def test(): "call me to see if the functions return the same thing" rp = F.getRandomParams() print "C2: ", C2(rp) print "C3: ", C3(rp) test() import pylab plot_noisy_data() desol, dstepmon = de_solve(C2) print "desol: ", desol # plot_sol(dstepmon.x[-100],'k-') plot_sol(desol, "r-") getch() # end of file
myCostFunction = F.getCostFunction(evalpts = stations, observations = data_z) print F def C2(x): "This is the new version" return 100000 * myCostFunction(x) def C3(x): "Cost function constructed by hand" from test_mogi2 import cost_function return cost_function(x) def test(): "call me to see if the functions return the same thing" rp = F.getRandomParams() print "C2: ", C2(rp) print "C3: ", C3(rp) test() import pylab plot_noisy_data() desol, dstepmon = de_solve(C2) print "desol: ", desol #plot_sol(dstepmon.x[-100],'k-') plot_sol(desol,'r-') getch() # end of file
myCostFunction = F.getCostFunction(evalpts = stations, observations = data_z) print(F) def C2(x): "This is the new version" return 100000 * myCostFunction(x) def C3(x): "Cost function constructed by hand" from test_mogi2 import cost_function return cost_function(x) def test(): "call me to see if the functions return the same thing" rp = F.getRandomParams() print("C2: %s" % C2(rp)) print("C3: %s" % C3(rp)) test() import pylab plot_noisy_data() desol, dstepmon = de_solve(C2) print("desol: %s" % desol) #plot_sol(dstepmon.x[-100],'k-') plot_sol(desol,'r-') getch() # end of file