diff --git a/snippets/RandSpikeStats.py b/snippets/RandSpikeStats.py index dfe288f91441a02da4d5e62ad4df04c82b3fe6fc..1b494da48e7b17d51b17cfb7ead49d11078ca680 100644 --- a/snippets/RandSpikeStats.py +++ b/snippets/RandSpikeStats.py @@ -67,13 +67,14 @@ def make_model(): moose.connect( plotf, 'requestOut', fire, 'getVm' ) def main(): + """ - This snippet shows the use of several objects. - This snippet sets up a StimulusTable to control a RandSpike which - sends its outputs to two places: to a SimpleSynHandler on an IntFire, - which is used to monitor spike arrival, and to various Stats objects. - Each of these are recorded and plotted. - The StimulusTable has a sine-wave waveform. + This snippet shows the use of several objects. + This snippet sets up a StimulusTable to control a RandSpike which + sends its outputs to two places: to a SimpleSynHandler on an IntFire, + which is used to monitor spike arrival, and to various Stats objects. + Each of these are recorded and plotted. + The StimulusTable has a sine-wave waveform. """ make_model() @@ -91,6 +92,7 @@ def main(): pylab.legend() pylab.show() + ''' moose.useClock( 0, '/stim', 'process' ) moose.useClock( 1, '/spike', 'process' ) diff --git a/snippets/analogStimTable.py b/snippets/analogStimTable.py index 006f47f8f4a9bd34ded56d9f8cbecaf58a0202b2..e6b7602cd5107f40735055142162e1281045f01c 100644 --- a/snippets/analogStimTable.py +++ b/snippets/analogStimTable.py @@ -92,5 +92,6 @@ if __name__ == '__main__': main() + # # stimtable.py ends here diff --git a/snippets/cspaceSteadyState.py b/snippets/cspaceSteadyState.py index 713e157bc3ea258b0682d65a544c05f592b9b695..7cd2f012fa2b0b359d8f6aa3e515c9fc0976d0d1 100644 --- a/snippets/cspaceSteadyState.py +++ b/snippets/cspaceSteadyState.py @@ -40,6 +40,15 @@ def main(): It looks for the fixed points 100 times, as follows: - Set up the random initial condition that fits the conservation laws - Run for 2 seconds. This should not be mathematically necessary, but +<<<<<<< HEAD + for obscure numerical reasons it makes it much more likely that the + steady state solver will succeed in finding a state. + - Find the fixed point + - Print out the fixed point vector and various diagnostics. + - Run for 10 seconds. This is completely unnecessary, and is done here + just so that the resultant graph will show what kind of state has been + found. +======= for obscure numerical reasons it makes it much more likely that the steady state solver will succeed in finding a state. - Find the fixed point @@ -47,6 +56,7 @@ def main(): - Run for 10 seconds. This is completely unnecessary, and is done here just so that the resultant graph will show what kind of state has been found. +>>>>>>> 0e491aa41584cf7a66c0e242374d8ee61660eb7b After it does all this, the program runs for 100 more seconds on the last found fixed point (which turns out to be a saddle node), then is hard-switched in the script to the first attractor basin from which @@ -55,6 +65,15 @@ def main(): seconds. Looking at the output you will see many features of note: - the first attractor (stable point) and the saddle point +<<<<<<< HEAD + (unstable fixed point) are both found quite often. But the second + attractor is found just once. Has a very small basin of attraction. + - The values found for each of the fixed points match well with the + values found by running the system to steady-state at the end. + - There are a large number of failures to find a fixed point. These are + found and reported in the diagnostics. They show up on the plot + as cases where the 10-second runs are not flat. +======= (unstable fixed point) are both found quite often. But the second attractor is found just once. Has a very small basin of attraction. - The values found for each of the fixed points match well with the @@ -62,6 +81,7 @@ def main(): - There are a large number of failures to find a fixed point. These are found and reported in the diagnostics. They show up on the plot as cases where the 10-second runs are not flat. +>>>>>>> 0e491aa41584cf7a66c0e242374d8ee61660eb7b If you wanted to find fixed points in a production model, you would not need to do the 10-second runs, and you would need to eliminate the diff --git a/snippets/funcInputToPools.py b/snippets/funcInputToPools.py index b6f8f0b31d4531d50c04421b14fb8d877ddf8769..52978b4cad06fecb1a11e121db057eeacb2dede8 100644 --- a/snippets/funcInputToPools.py +++ b/snippets/funcInputToPools.py @@ -13,6 +13,7 @@ import numpy import moose import sys + def makeModel(): if len( sys.argv ) == 1: useGsolve = True @@ -65,6 +66,9 @@ def makeModel(): stoich.compartment = compartment stoich.ksolve = gsolve stoich.path = '/model/compartment/##' + ''' + ''' + # We need a finer timestep than the default 0.1 seconds, # in order to get numerical accuracy. for i in range (10, 19 ): @@ -88,11 +92,11 @@ so try to use a table to control a pool instead. To run in stochastic mode:: - ''python funcInputToPools'' + ''python funcInputToPools'' To run in deterministic mode:: - ''python funcInputToPools false'' + ''python funcInputToPools false'' """ @@ -100,6 +104,7 @@ To run in deterministic mode:: moose.seed() moose.reinit() + moose.start( 50.0 ) # Run the model for 100 seconds. a = moose.element( '/model/compartment/a' ) @@ -107,12 +112,11 @@ To run in deterministic mode:: # Iterate through all plots, dump their contents to data.plot. for x in moose.wildcardFind( '/model/graphs/n#' ): - #x.xplot( 'scriptKineticModel.plot', x.name ) + #x.xplot( 'scriptKineticModel.plot', x.name ) t = numpy.arange( 0, x.vector.size, 1 ) * x.dt # sec pylab.plot( t, x.vector, label=x.name ) pylab.legend() pylab.show() - quit() # Run the 'main' if this script is executed standalone. diff --git a/snippets/intfire.py b/snippets/intfire.py index 7cd93d3c35a92d3f28a4640cdcf94dc05367fe2e..8426052e245176f27458852cda4bc68bfcfa8e24 100644 --- a/snippets/intfire.py +++ b/snippets/intfire.py @@ -49,8 +49,8 @@ import moose def connect_two_intfires(): """ - Connect two IntFire neurons so that spike events in one gets - transmitted to synapse of the other. +Connect two IntFire neurons so that spike events in one gets +transmitted to synapse of the other. """ if1 = moose.IntFire('if1') if2 = moose.IntFire('if2') @@ -63,11 +63,13 @@ def connect_two_intfires(): def connect_spikegen(): """ - Connect a SpikeGen object to an IntFire neuron such that spike - events in spikegen get transmitted to the synapse of the IntFire - neuron. - """ +Connect a SpikeGen object to an IntFire neuron such that spike +events in spikegen get transmitted to the synapse of the IntFire +neuron. +""" + if3 = moose.IntFire('if3') + sf3 = moose.SimpleSynHandler( 'if3/sh' ) moose.connect( sf3, 'activationOut', if3, 'activation' ) sf3.synapse.num = 1 @@ -77,7 +79,8 @@ def connect_spikegen(): def setup_synapse(): """ - Create an intfire object and create two synapses on it. +Create an intfire object and create two synapses on it. + """ if4 = moose.IntFire('if4') sf4 = moose.SimpleSynHandler( 'if4/sh' ) @@ -93,8 +96,9 @@ def setup_synapse(): def main(): """ - Demonstrates connection between 2 IntFire neurons to observe - spike generation. +Demonstrates connection between 2 IntFire neurons to observe +spike generation. + """ connect_two_intfires() connect_spikegen() diff --git a/snippets/loadKineticModel.py b/snippets/loadKineticModel.py index ad71c67a94451d6276dfbab3efd49bf947467e8b..25c3f69e5144bc7419ca827e16314e41d1b4c0cb 100644 --- a/snippets/loadKineticModel.py +++ b/snippets/loadKineticModel.py @@ -54,7 +54,13 @@ def main(): This example illustrates loading, running, and saving a kinetic model defined in kkit format. It uses a default kkit model but you can specify another using the command line +<<<<<<< HEAD + ``python filename runtime solver``. + +======= + ``python filename runtime solver``. +>>>>>>> 0e491aa41584cf7a66c0e242374d8ee61660eb7b We use the gsl solver here. The model already defines a couple of plots and sets the runtime 20 secs. diff --git a/snippets/loadSbmlmodel.py b/snippets/loadSbmlmodel.py index 6288215d586b0767d17e8157d737dc31e569869e..744c723933686e32c5c095de1949cfacd10a3483 100644 --- a/snippets/loadSbmlmodel.py +++ b/snippets/loadSbmlmodel.py @@ -43,7 +43,7 @@ import pylab import moose from moose.SBML import * -#from moose.chemUtil.add_Delete_ChemicalSolver import * +from moose.chemUtil.add_Delete_ChemicalSolver import * def main(): """ diff --git a/snippets/multiComptSigNeur.py b/snippets/multiComptSigNeur.py index bb964baf2e27fc021677298e6147ad1df665f66e..613249cbda288e14f3572b6a151f6b7c76e4af72 100644 --- a/snippets/multiComptSigNeur.py +++ b/snippets/multiComptSigNeur.py @@ -222,9 +222,9 @@ def dumpPlots( fname,runtime ): for x in moose.wildcardFind( '/graphs/##[ISA=Table]' ): x.xplot( fname, x.name ) t = numpy.linspace( 0, runtime, x.vector.size ) # sec - plt.plot( t, x.vector, label=x.name ) - plt.legend() - plt.show() + plt.plot( t, x.vector, label=x.name ) + plt.legend() + plt.show() quit() def makeSpinyCompt(): comptLength = 30e-6 diff --git a/snippets/scaleVolumes.py b/snippets/scaleVolumes.py index 965a8562f28d6b0c2b01825a2977df5064a854b5..02fec606d38dc27207785b1a75752740c30d244e 100644 --- a/snippets/scaleVolumes.py +++ b/snippets/scaleVolumes.py @@ -155,14 +155,9 @@ def main(): # Iterate through all plots, dump their contents to data.plot. displayPlots() pylab.show( block=False ) -<<<<<<< HEAD - print(('vol = ', vol, 'hit 0 to go to next plot')) - eval(str(input())) - -======= print( 'vol = %f ' % vol ) response = input( "Press enter to go to next plot... " ) ->>>>>>> 0e491aa41584cf7a66c0e242374d8ee61660eb7b + quit() # Run the 'main' if this script is executed standalone.