diff --git a/examples/opf/clients/hotgym/prediction/one_gym/nupic_output.py b/examples/opf/clients/hotgym/prediction/one_gym/nupic_output.py index 0f7528f20f..c6ca8665e0 100644 --- a/examples/opf/clients/hotgym/prediction/one_gym/nupic_output.py +++ b/examples/opf/clients/hotgym/prediction/one_gym/nupic_output.py @@ -187,6 +187,11 @@ def write(self, timestamps, actualValues, predictedValues, plt.legend(('actual','predicted'), loc=3) + def refreshGUI(self): + """Give plot a pause, so data is drawn and GUI's event loop can run. + """ + plt.pause(0.0001) + def close(self): plt.ioff() diff --git a/examples/opf/clients/hotgym/prediction/one_gym/run.py b/examples/opf/clients/hotgym/prediction/one_gym/run.py index 8a79d59b1b..f713e15ffe 100755 --- a/examples/opf/clients/hotgym/prediction/one_gym/run.py +++ b/examples/opf/clients/hotgym/prediction/one_gym/run.py @@ -127,6 +127,9 @@ def runIoThroughNupic(inputData, model, gymName, plot): prediction = result.inferences["multiStepBestPredictions"][1] output.write([timestamp], [consumption], [prediction]) + if plot and counter % 20 == 0: + output.refreshGUI() + inputFile.close() output.close()