from diff import getDiff from math import log def order(e2h, eh): return [log(e2h[0]/eh[0])/log(2), log(e2h[1]/eh[1])/log(2)] nTest=9 nStepsRef=5*(2**nTest) refFile="heat_sdc_M-3_P-2_nStep-%d-00001.vtu" % nStepsRef #refFile="../ros2/heat_ros2_40960-00001.vtu" dFile="heat_sdc_M-3_P-2_nStep-%d-00001.vtu" % (5) e2h=getDiff(refFile, dFile) print e2h, "-", "-" dFile1="heat_sdc_M-3_P-2_nStep-%d-00001.vtu" % (5*2) res=getDiff(refFile, dFile1) e2h2=getDiff(dFile, dFile1) print res, order(e2h, res), "-" #order(e2h2, res2) e2h=res dFile=dFile1 for n in range(2, nTest): dFile1="heat_sdc_M-3_P-2_nStep-%d-00001.vtu" % (5*(2**n)) res=getDiff(refFile, dFile1) res2=getDiff(dFile, dFile1) print res, order(e2h, res), order(e2h2, res2) e2h=res e2h2=res2 dFile=dFile1
from diff import getDiff from math import log def order(e2h, eh): return [log(e2h[0] / eh[0]) / log(2), log(e2h[1] / eh[1]) / log(2)] nStep = map(lambda x: 25 * (2**x), range(0, 10)) baseN = "T_ros2_%d_fixed_1.vtu" refFile = baseN % 25600 dFile = baseN % (nStep[0]) e2h = getDiff(refFile, dFile) print e2h, "-", "-" dFile1 = baseN % (nStep[1]) res = getDiff(refFile, dFile1) e2h2 = getDiff(dFile, dFile1) print res, order(e2h, res), "-" #order(e2h2, res2) e2h = res dFile = dFile1 for i in range(2, len(nStep)): n = nStep[i] dFile1 = baseN % (n) res = getDiff(refFile, dFile1) res2 = getDiff(dFile, dFile1) print res, order(e2h, res), order(e2h2, res2) e2h = res e2h2 = res2 dFile = dFile1
from diff import getDiff from math import log from tail import * te=20.0 nTest=9 nStepsRef=5*(2**nTest) P_vec=[2,3,6,8] refFile="../kiter_5/heat_sdc_M-3_P-8_nStep-%d-00001.vtu" % nStepsRef #refFile="../ros2/heat_ros2_40960-00001.vtu" M=2 for P in P_vec: acname="accuracy_M_%d_P_%d.dat" %(M,P) f=open(acname,'w') f.write("#h l2 max nstep runtime[ms]\n") for n in range(0, nTest): nstep=(5*(2**n)) dFile1="heat_sdc_M-%d_P-%d_nStep-%d-00001.vtu" % (M,P,nstep) res=getDiff(refFile, dFile1) h=te/nstep log="log_%d_%d_%d"%(nstep,M,P) logf=open(log) lastLine=tail(logf, 1) logf.close() data=str(h)+" " +str(res[0])+" " +str(res[1]) +" "+str(nstep)+" " +str(lastLine[0].split(':')[1].split()[0]) f.write(data+"\n") f.close()
from diff import getDiff from math import log from tail import * te = 20.0 nTest = 7 #tests=[1,2] tests = [] for d in range(nTest): tests.append(5 * 2**d) #refFile="../kiter_5/heat_sdc_standard_M-3_nStep-5120-00001.vtu" Mv = [2, 3] refFile = "../../ros2/heat_ros2_40960-00001.vtu" for M in Mv: acname = "accuracy_M_%d.dat" % (M) f = open(acname, 'w') f.write("#h l2 max nstep runtime[ms]\n") for nstep in tests: dFile1 = "heat_sdc_standard_M-%d_nStep-%d-00001.vtu" % (M, nstep) res = getDiff(refFile, dFile1) h = te / nstep log = "log_%d_%d" % (nstep, M) logf = open(log) lastLine = tail(logf, 1) logf.close() data = str(h) + " " + str(res[0]) + " " + str( res[1]) + " " + str(nstep) + " " + str( lastLine[0].split(':')[1].split()[0]) f.write(data + "\n") f.close()
def getData(): threading.Timer(20.0, getData).start() print ("Hello, World!") global outputDict outputDict = diff.getDiff() print (outputDict['prices']['BTC'])