From bcbf751b4b99174adfafbdf452c4e2717c1acb01 Mon Sep 17 00:00:00 2001 From: Stephen Mardson McQuay Date: Mon, 28 Mar 2011 22:35:45 -0600 Subject: [PATCH] minor: bugfix for my progressbar addition --- bin/gbench.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/gbench.py b/bin/gbench.py index 7a1ff03..72d7f91 100644 --- a/bin/gbench.py +++ b/bin/gbench.py @@ -67,6 +67,7 @@ if __name__ == '__main__': sys.exit(1) input_file, count = args + count = int(count) if options.meshtype == 'gmsh': g = ggrid(input_file, options.dimension) @@ -83,7 +84,7 @@ if __name__ == '__main__': i = 0 outside = 0 pbar = progressbar.ProgressBar().start() - while i < int(count): + while i < count: try: X = np.random.random((1,options.dimension))[0] @@ -91,13 +92,14 @@ if __name__ == '__main__': e = get_right_exact_func(options)(X) results[improved_answer(a, e)] += 1 - pbar.update(i / count) + update = i/float(count) * 100 + pbar.update(update) i += 1 except Exception as e: # print e # print X, i, count outside += 1 - pbar.finis() + pbar.finish() print "total skipped points: %d" % outside print results