From b5ec7b3c82c0e59d0390efcc5dde7d98eacd4cf9 Mon Sep 17 00:00:00 2001 From: Dilawar Singh <dilawars@ncbs.res.in> Date: Tue, 31 Oct 2017 18:39:37 +0530 Subject: [PATCH] Squashed 'moose-examples/' changes from 6e8a629e3..bd41d0688 bd41d0688 Wait for user to press button before quiting displaying plots. Use matplotlib.pyplot instead of pylab. git-subtree-dir: moose-examples git-subtree-split: bd41d068806ceba8e0ded0c73da536415aaeebd4 --- tutorials/ChemicalBistables/simpleBis.py | 12 +++++++----- tutorials/Rdesigneur/rdes_ex2.py | 3 +-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/tutorials/ChemicalBistables/simpleBis.py b/tutorials/ChemicalBistables/simpleBis.py index 34e2510a..4c577f55 100644 --- a/tutorials/ChemicalBistables/simpleBis.py +++ b/tutorials/ChemicalBistables/simpleBis.py @@ -19,7 +19,7 @@ # You may also find in interesting to change the volume. import math -import pylab +import matplotlib.pyplot as plt import numpy import moose import sys @@ -87,12 +87,14 @@ def makeModel(): moose.useClock( 4, '/model/compartment/##', 'process' ) moose.useClock( 8, '/model/graphs/#', 'process' ) + def displayPlots(): + print( 'Displaying plots' ) for x in moose.wildcardFind( '/model/graphs/conc#' ): t = numpy.arange( 0, x.vector.size, 1 ) #sec - pylab.plot( t, x.vector, label=x.name ) - pylab.legend() - pylab.show() + plt.plot( t, x.vector, label=x.name ) + plt.legend() + plt.show() def main(): solver = "gsl" @@ -132,8 +134,8 @@ def main(): # Iterate through all plots, dump their contents to data.plot. displayPlots() + raw_input( 'Press any key to quit' ) - quit() # Run the 'main' if this script is executed standalone. if __name__ == '__main__': diff --git a/tutorials/Rdesigneur/rdes_ex2.py b/tutorials/Rdesigneur/rdes_ex2.py index 76901ae9..9f72fe87 100644 --- a/tutorials/Rdesigneur/rdes_ex2.py +++ b/tutorials/Rdesigneur/rdes_ex2.py @@ -8,5 +8,4 @@ rdes.buildModel() moose.reinit() moose.start( 0.3 ) -rdes.display() - +rdes.display() \ No newline at end of file -- GitLab