Skip to content
This repository has been archived by the owner on Sep 1, 2023. It is now read-only.

Commit

Permalink
When running with plot, adding a pause to activate GUI's event loop
Browse files Browse the repository at this point in the history
  • Loading branch information
SchulteMarkus committed Sep 14, 2016
1 parent 3d427e9 commit 79b08ab
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Expand Up @@ -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()
Expand Down
3 changes: 3 additions & 0 deletions examples/opf/clients/hotgym/prediction/one_gym/run.py
Expand Up @@ -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()

Expand Down

0 comments on commit 79b08ab

Please sign in to comment.