From d5292d09d44580c56460f766459b3d2aa6ad4480 Mon Sep 17 00:00:00 2001 From: Dilawar Singh <dilawars@ncbs.res.in> Date: Fri, 2 Mar 2018 16:17:54 +0530 Subject: [PATCH] Squashed 'moose-examples/' changes from bd41d06..7f3d27f 7f3d27f Merge branch 'master' into chennapoda 3047477 python3/python2 compatible call to raw_input. d314d4c Documentation update #1 (#225) cd494a6 Merge commit 'b5ec7b3c82c0e59d0390efcc5dde7d98eacd4cf9' 8032817 Merge commit 'd07f7ea6c3357b98b62e1abe9d133be39a797de8' 17cf9ef Merge commit 'f27ad43950c241570675ceb06273217f03905859' ad1dcdc Merge commit 'b0021958d104e020f5d0c441e2f4b81bf84508fb' a6f09fc Merge commit 'b3c864062a4b50ac942a8fdcb0cb6c1df6a456c7' as 'moose-examples' e699bcd moose-examples keep creating troble. May be I don't know how to handle git subtree. 6c967df Merge commit '0014d8268ef8184db15745884208636c1f05e76a' 0014d82 Squashed 'moose-core/' changes from 2c3fe7516..052318cb4 45411b6 Follow up fixes to calcium-hsolve (#221) 98ae1a9 Merge commit '378bf23c784397b37f2c58212d3a3d16aa0ebee5' as 'moose-examples' 378bf23 Squashed 'moose-examples/' content from commit 3a960983fe 82043db Dirty commit in moose-examples as well. f2a691b Merge commit '60c5802aead9b0f4cbc639511ad1b9038b0cd178' 60c5802 Squashed 'moose-examples/' changes from 0c5527e77d..3a960983fe 53206f8 Squashed 'moose-core/' changes from fe77059f98..2c3fe7516a 0e36128 Merge commit '53206f84b69d3127a34a915b1580dcd73a593bd8' d38e324 Merge branch 'master' into asiaszmek 82ee30f Merge commit '37cdf0cc44f9a8b73b536c4a3a91cdcbd59eada0' 37cdf0c Squashed 'moose-gui/' changes from 49779ba730..38da92b048 dfa3249 Squashed 'moose-examples/' changes from 80169bcc5c..0c5527e77d b960aed Merge commit 'dfa32490a149f41e14a364403f57b08c40bcd3ef' e6e83b7 Squashed 'moose-core/' content from commit fe77059f98 3404d0b Merge commit 'e6e83b761e93923f3853512e1814a412296927a7' as 'moose-core' be87aea Deleted moose-core due to dirty history in upstream moose-core. 48fc973 Squashed 'moose-examples/' changes from 2eb5fa888f..80169bcc5c 1051706 Merge commit '48fc9733220a09f3b5899c999226e664ae5188bc' 304173c Merge commit 'd27e942f2f8c0b1a3be34da0058ab374ac843400' d27e942 Squashed 'moose-core/' changes from 69e0354705..b096503233 0f74138 Calcium hsolve (#218) fbf9dbd Fixes to bad-merging. 2ea8560 Travis required changes after yesterday upgrade. 849103d Merge commit '320e525a5a34fbd3f1cb572b6de38eca0c0876f0' 320e525 Squashed 'moose-gui/' changes from d282884250..49779ba730 7fe1c2e Squashed 'moose-core/' changes from 2ecab963b2..69e0354705 faf993a Merge commit '7fe1c2e7fe0b0d1cbe153cefb10618f62fe107cb' edd901d Squashed 'moose-examples/' content from commit 2eb5fa888 be2d4ec Merge commit 'edd901da062503717c40cddad23d69bf51782f08' as 'moose-examples' git-subtree-dir: moose-examples git-subtree-split: 7f3d27fa0f2b5c5f2ace0e8cfddae2b5944b9186 --- paper-2015/Fig6_NetMultiscale/ReducedModel.py | 5 ++++- snippets/IntegrateFireZoo.py | 8 +++++++- snippets/compartment_net.py | 5 +++++ snippets/cylinderDiffusion.py | 7 ++++--- snippets/diffSpinyNeuron.py | 8 ++++++-- snippets/gssaRDspiny.py | 7 +++++-- snippets/reacDiffBranchingNeuron.py | 16 +++++----------- snippets/wildcard.py | 6 ++++-- tutorials/ChemicalBistables/propagationBis.py | 5 ++++- tutorials/ChemicalBistables/scaleVolumes.py | 8 +++++--- tutorials/ChemicalBistables/simpleBis.py | 5 ++++- tutorials/ChemicalOscillators/TuringOneDim.py | 5 ++++- 12 files changed, 57 insertions(+), 28 deletions(-) diff --git a/paper-2015/Fig6_NetMultiscale/ReducedModel.py b/paper-2015/Fig6_NetMultiscale/ReducedModel.py index 3f151cb3..d7314107 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 0fe761a0..dc40a584 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/compartment_net.py b/snippets/compartment_net.py index 55b95f54..b77b25db 100644 --- a/snippets/compartment_net.py +++ b/snippets/compartment_net.py @@ -177,5 +177,10 @@ def main(): plt.show() + +if __name__ == '__main__': + main() + + # # compartment_net.py ends here diff --git a/snippets/cylinderDiffusion.py b/snippets/cylinderDiffusion.py index a2c21570..f7c5095a 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 5749b95e..06ae26d3 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 6308e5bc..8b3269ad 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 96ddc145..018717d2 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/snippets/wildcard.py b/snippets/wildcard.py index ee2aee82..ba2712e4 100644 --- a/snippets/wildcard.py +++ b/snippets/wildcard.py @@ -91,13 +91,15 @@ def wildcard_test(): for element in moose.wildcardFind(wildcard): print(('\t', element.path)) - # `#` can be used only once and matches all subsequent characters in name + + # `?` can be used any number of times but substitutes a single character wildcard = '/alfa/bravo/charl?e' print(('\nElements Matching:', wildcard)) for element in moose.wildcardFind(wildcard): print(('\t', element.path)) - # `?` can be used any number of times but substitutes a single character + + # `#` can be used only once and matches all subsequent characters in name wildcard = '/alfa/bravo/fox#' print(('\nElements Matching:', wildcard)) for element in moose.wildcardFind(wildcard): diff --git a/tutorials/ChemicalBistables/propagationBis.py b/tutorials/ChemicalBistables/propagationBis.py index add79df3..8b982c63 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 66b869ff..49bf206e 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 4c577f55..3bbfc700 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 e755d257..bc27761a 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( ) -- GitLab