From 615428944ad1057a3b814905c01bc44f61cb2e0c Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Thu, 13 Sep 2018 13:29:48 +0200 Subject: [PATCH] Add fancy schmancy progress bar --- photovoltaic_gruppe4.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/photovoltaic_gruppe4.py b/photovoltaic_gruppe4.py index 1285faf..bbcb24d 100644 --- a/photovoltaic_gruppe4.py +++ b/photovoltaic_gruppe4.py @@ -21,9 +21,26 @@ feature_col = [tf.feature_column.numeric_column(str(idx)) for idx in range(336)] n = pywatts.neural.Net(feature_cols=feature_col) predictions = [] -for query in queries: +total = len(queries) +for idx, query in enumerate(queries): + + percent = idx / total + sys.stdout.write("\r") + progress = "" + for i in range(20): + if i < int(20 * percent): + progress += "=" + else: + progress += " " + sys.stdout.write("[ %s ] %.2f%%" % (progress, percent * 100)) + sys.stdout.flush() + if oneH: predictions.extend(predict(n, query).astype('Float64').tolist()) else: predictions.append(predict24h(n, query)) + print(predictions, file=open("test_data_gruppe4.json", "w")) + +sys.stdout.write("\r") +print("Done!")