minor: bugfix for my progressbar addition

This commit is contained in:
Stephen McQuay 2011-03-28 22:35:45 -06:00
parent fad88725e3
commit bcbf751b4b

View File

@ -67,6 +67,7 @@ if __name__ == '__main__':
sys.exit(1) sys.exit(1)
input_file, count = args input_file, count = args
count = int(count)
if options.meshtype == 'gmsh': if options.meshtype == 'gmsh':
g = ggrid(input_file, options.dimension) g = ggrid(input_file, options.dimension)
@ -83,7 +84,7 @@ if __name__ == '__main__':
i = 0 i = 0
outside = 0 outside = 0
pbar = progressbar.ProgressBar().start() pbar = progressbar.ProgressBar().start()
while i < int(count): while i < count:
try: try:
X = np.random.random((1,options.dimension))[0] X = np.random.random((1,options.dimension))[0]
@ -91,13 +92,14 @@ if __name__ == '__main__':
e = get_right_exact_func(options)(X) e = get_right_exact_func(options)(X)
results[improved_answer(a, e)] += 1 results[improved_answer(a, e)] += 1
pbar.update(i / count) update = i/float(count) * 100
pbar.update(update)
i += 1 i += 1
except Exception as e: except Exception as e:
# print e # print e
# print X, i, count # print X, i, count
outside += 1 outside += 1
pbar.finis() pbar.finish()
print "total skipped points: %d" % outside print "total skipped points: %d" % outside
print results print results