def getData( consts, cname, cvalue ): printConsts(consts, "consts2.txt") call("./applebeat eulerPAR %s %s consts2.txt > /dev/null" % (MODEL, CONFIG_PATH), shell=True) call("avconv -r 60 -i full%4d.bmp -loglevel warning -b:v 1500k -y " + cname + str(cvalue) + "_f.mp4", shell=True) call("avconv -r 60 -i mask%4d.bmp -loglevel warning -b:v 1500k -y " + cname + str(cvalue) + "_m.mp4", shell=True) tres = getWaveChars(FRAMES, CONFIG_SIZE, DT, TIMESPERFRAME) #tres = {'speed':2, 'width':10, 't0':0, 'tf':100, 'err':"OK"} res = (cname, cvalue, tres) call("rm -rf *.bmp", shell=True) return res
def run(): ref_width = 2.1; ref_speed = 0.157; consts = []; modvalues = [0.5, 2]; results = {}; os.chdir(".."); f = open('nums.txt', 'r'); for line in f: l = line.split(); if (len(l) > 1): consts = consts + [(l[0], l[1])]; f.close() for i in range(9): tmp = []; for x in modvalues: printModifiedConsts(consts, i, x, "consts2.txt"); call("./applebeat eulerPAR sawai_wave config.txt consts2.txt", shell=True); name = consts[i][0]+"_"+str(x); call("avconv -r 100 -i full%4d.bmp -b:v 1500k "+name+"_f.mp4 -y", shell=True); call("avconv -r 100 -i mask%4d.bmp -b:v 1500k "+name+"_m.mp4 -y", shell=True); tres = getWaveChars(800); call("rm -f *.bmp", shell=True); tmp = tmp + [(x, (tres['width'], tres['speed']))]; results[consts[i][0]] = tmp; pp = pprint.pprint(results); return results;
modeW = True continue print("-w:%5f, s:%5f" % (w, s) ) print(string) printConsts(cs, "consts2.txt") call("./applebeat eulerPAR sawai_wave %s consts2.txt > /dev/null" % (CONFIG_PATH), shell=True) call("avconv -r 90 -i full%4d.bmp -loglevel warning -b:v 1500k -y " + cname + str(count + scount) + "_f.mp4", shell=True) call("avconv -r 90 -i mask%4d.bmp -loglevel warning -b:v 1500k -y " + cname + str(count + scount) + "_m.mp4", shell=True) tres = getWaveChars(800, 200) if tres['err'] != 'OK': print(">Errors computing wave chars: '%s'" % tres['longerr']) if tres['err'] != 'WARN': break w = tres['width'] s = tres['speed'] call("rm -rf *.bmp", shell=True) if ( cs[cname] / consts[cname] > LIMIT_DIST or consts[cname] / cs[cname] > LIMIT_DIST ): print(">NON-CONVERGENCE (ratio on %s too big)" % cname) break if ( cs['Dv'] / consts['Dv'] > LIMIT_DIST or consts['Dv'] / cs['Dv'] > LIMIT_DIST ): print(">NON-CONVERGENCE (ratio on Dv too big)") break