diff --git a/paper-2015/Fig6_NetMultiscale/ReducedModel.py b/paper-2015/Fig6_NetMultiscale/ReducedModel.py index 3f151cb3f6c5e8fad454c98c956cb1b6ed003a9e..d7314107ba810361a1a63adf89c189bfaa223da1 100644 --- a/paper-2015/Fig6_NetMultiscale/ReducedModel.py +++ b/paper-2015/Fig6_NetMultiscale/ReducedModel.py @@ -885,4 +885,7 @@ if __name__=='__main__': plt.show() plt.savefig( fname + '.svg', bbox_inches='tight') print( "Hit 'enter' to exit" ) - input() + try: + raw_input() + except Exception as e: + input( ) diff --git a/snippets/IntegrateFireZoo.py b/snippets/IntegrateFireZoo.py index 0fe761a09a8909f97339c0ffe329670c7bd75801..dc40a584ffcae3ea81f463121d68abf9dda53d1f 100644 --- a/snippets/IntegrateFireZoo.py +++ b/snippets/IntegrateFireZoo.py @@ -120,7 +120,13 @@ def main(): #choiceKey = 'LIF' #### No need, am inputting it from the user on the terminal choiceKeys = list(neuronChoices.keys()) # keys() does not retain the order in dict defn above! - choiceIndex = eval(str(input('Choose a number corresponding to your desired neuron: '+str([(i,key) for (i,key) in enumerate(choiceKeys)])+' -- '))) + + try: + v = raw_input('Choose a number corresponding to your desired neuron: '+str([(i,key) for (i,key) in enumerate(choiceKeys)])+' -- ') + except NameError as e: + v = input('Choose a number corresponding to your desired neuron: '+str([(i,key) for (i,key) in enumerate(choiceKeys)])+' -- ') + + choiceIndex = eval(v) choiceKey = choiceKeys[choiceIndex] neuronChoice = neuronChoices[choiceKey] diff --git a/snippets/cylinderDiffusion.py b/snippets/cylinderDiffusion.py index a2c215704222b4434a70d0cc946ae71183a1798b..f7c5095a58d90dd98d47b06477643161c29a608e 100644 --- a/snippets/cylinderDiffusion.py +++ b/snippets/cylinderDiffusion.py @@ -184,11 +184,12 @@ def main(): print((atot2/atot, btot2/btot, ctot2/ctot, dtot2/dtot)) print(('Initial to final (b+c)=', (btot2 + ctot2) / (btot + ctot ))) print("\nHit '0' to exit") - eval(str(input())) - + try: + raw_input( ) + except NameError as e: # python3 + input( ) quit() - # Run the 'main' if this script is executed standalone. if __name__ == '__main__': main() diff --git a/snippets/diffSpinyNeuron.py b/snippets/diffSpinyNeuron.py index 5749b95ef5f4a341ac7165050bc42fcf1e3081d4..06ae26d3f85f6090893037f52afaee103b7252a5 100644 --- a/snippets/diffSpinyNeuron.py +++ b/snippets/diffSpinyNeuron.py @@ -103,7 +103,7 @@ def makeModel(): stoich2.filterXreacs() Ca_input_dend = moose.vec( '/model/chem/compt0/Ca_input' ) - print((len( Ca_input_dend ))) + print(len( Ca_input_dend )) for i in range( 60 ): Ca_input_dend[ 3 + i * 3 ].conc = 2.0 @@ -197,8 +197,12 @@ def finalizeDisplay( plotlist, cPlotDt ): pos = numpy.arange( 0, x.vector.size, 1 ) * cPlotDt line1, = plotlist[0].plot( pos, x.vector, label=x.name ) plotlist[4].canvas.draw() + print( "Hit '0' to exit" ) - raw_input() + try: + raw_input() + except NameError as e: #python3 + input( ) def makeChemModel( compt, doInput ): """ diff --git a/snippets/gssaRDspiny.py b/snippets/gssaRDspiny.py index 6308e5bc6e4c3c0f2b6cdc5c2e89a09b26fcc00c..8b3269ad97e1832ae627a700fa14dfd44bc640c4 100644 --- a/snippets/gssaRDspiny.py +++ b/snippets/gssaRDspiny.py @@ -180,8 +180,11 @@ def finalizeDisplay( plotlist, cPlotDt ): pos = numpy.arange( 0, x.vector.size, 1 ) * cPlotDt line1, = plotlist[0].plot( pos, x.vector, label=x.name ) plotlist[4].canvas.draw() - print( "Hit '0' to exit" ) - eval(str(input())) + print( "Hit any key to exit" ) + try: + raw_input( ) + except NameError as e: + input( ) def makeChemModel( compt ): """ diff --git a/snippets/reacDiffBranchingNeuron.py b/snippets/reacDiffBranchingNeuron.py index 96ddc14532edc50f164e40c596059c7963409b96..018717d2831ce0601bf412372cd7c0cc8ed47ed7 100644 --- a/snippets/reacDiffBranchingNeuron.py +++ b/snippets/reacDiffBranchingNeuron.py @@ -112,28 +112,22 @@ def finalizeDisplay( plotlist, cPlotDt ): line1, = plotlist[0].plot( pos, x.vector, label=x.name ) plt.legend() plotlist[1].canvas.draw() - print( "Hit '0' to exit" ) - eval(str(input())) + print( "Hit any key to exit" ) + try: + a = raw_input( ) + except NameError as e: + a = input( ) def makeChemModel( compt ): """ This function sets up a simple oscillatory chemical system within the script. The reaction system is:: -<<<<<<< HEAD s ---a---> a // s goes to a, catalyzed by a. s ---a---> b // s goes to b, catalyzed by a. a ---b---> s // a goes to s, catalyzed by b. b -------> s // b is degraded irreversibly to s. -======= - - s ---a---> a // s goes to a, catalyzed by a. - s ---a---> b // s goes to b, catalyzed by a. - a ---b---> s // a goes to s, catalyzed by b. - b -------> s // b is degraded irreversibly to s. - ->>>>>>> 0e491aa41584cf7a66c0e242374d8ee61660eb7b in sum, **a** has a positive feedback onto itself and also forms **b**. **b** has a negative feedback onto **a**. Finally, the diffusion constant for **a** is 1/10 that of **b**. diff --git a/tutorials/ChemicalBistables/propagationBis.py b/tutorials/ChemicalBistables/propagationBis.py index add79df3e7f84303055ecbb9ec778b3514e625ef..8b982c63fa80ac2f5d88c4a370788cfe67bbe4fe 100644 --- a/tutorials/ChemicalBistables/propagationBis.py +++ b/tutorials/ChemicalBistables/propagationBis.py @@ -159,7 +159,10 @@ def main(): fig.canvas.draw() print( "Hit 'enter' to exit" ) - eval(input()) + try: + raw_input( ) + except NameError as e: # python3 + input( ) diff --git a/tutorials/ChemicalBistables/scaleVolumes.py b/tutorials/ChemicalBistables/scaleVolumes.py index 66b869ff67ba7e6f12b76e54c582bc91401b39d3..49bf206ec2ab34db65cf580b29b83d1ee9074c85 100644 --- a/tutorials/ChemicalBistables/scaleVolumes.py +++ b/tutorials/ChemicalBistables/scaleVolumes.py @@ -153,9 +153,11 @@ def main(): # Iterate through all plots, dump their contents to data.plot. displayPlots() pylab.show( block=False ) - print(('vol = ', vol, 'hit enter to go to next plot')) - input() - + print( 'vol = %f . hit enter to go to next plot' % vol ) + try: + raw_input() + except NameError as e: + input( ) quit() # Run the 'main' if this script is executed standalone. diff --git a/tutorials/ChemicalBistables/simpleBis.py b/tutorials/ChemicalBistables/simpleBis.py index 4c577f5541d5401596bf1d253169e11d2ac13abc..3bbfc7001f684e672fd93218f4b23eec91d9ffb4 100644 --- a/tutorials/ChemicalBistables/simpleBis.py +++ b/tutorials/ChemicalBistables/simpleBis.py @@ -134,7 +134,10 @@ def main(): # Iterate through all plots, dump their contents to data.plot. displayPlots() - raw_input( 'Press any key to quit' ) + try: + raw_input( 'Press any key to quit' ) + except NameError as e: + input( 'Press any key to quit' ) # Run the 'main' if this script is executed standalone. diff --git a/tutorials/ChemicalOscillators/TuringOneDim.py b/tutorials/ChemicalOscillators/TuringOneDim.py index e755d257a3f471c7078811636f1e5b8013629a1f..bc27761a951f1b251d91d5dd5f2ef1dad3e664bb 100644 --- a/tutorials/ChemicalOscillators/TuringOneDim.py +++ b/tutorials/ChemicalOscillators/TuringOneDim.py @@ -160,7 +160,10 @@ def main(): fig.canvas.draw() print( "Hit 'enter' to exit" ) - raw_input( ) + try: + raw_input( ) + except NameError as e: # python3 + input( )