"DynamicLib and Python"

Usage of Python

The usage of Python is straight forward. In general there exist direct correspondences between Python and C++ objects. If a Python version of a C++ object can not be instantiated, report this to Miind-general@lists.sourceforge.net.

Here we give the Python equivalent of the Wilson-Cowan code on the DynamicLib main page.

 #!/usr/bin/python
 import Populist
 import sys
 from Populist import *

 if len(sys.argv) > 1 and sys.argv[1] == "graph":
   canvas = 1
 else:
   canvas = 0
 #
 #  define a Wilson-Cowan algorithm
 #
 TAU_MEMBRANE = 10e-3 #(s) Population time constant
 RATE_MAX     = 20.0
 PAR_SIGMOID  = 1.0

 par_alg = WilsonCowanParameter(TAU_MEMBRANE,RATE_MAX,PAR_SIGMOID)
          
 alg = WilsonCowanAlgorithm(par_alg)
 #
 #  add it to the network
 #
 net=D_DynamicNetwork()
 id_exc = net.AddNode(alg,EXCITATORY)
 #
 #  Create an input node
 #
 INPUT_RATE = 40000.0
 alg_in=D_RateAlgorithm(INPUT_RATE)
 id_in = net.AddNode(alg_in,EXCITATORY)
 #
 # Connect them
 #
 EFFICACY = 1e-2
 net.MakeFirstInputOfSecond(id_in,id_exc,EFFICACY)
 #
 # Configure the simulation
 #
 T_BEGIN          = 0.0     # (s) Start time of simulation
 T_END            = 0.04    # (s) End time of simulation
 MAX_ITERATIONS   = 1000000 # Maximum number of iterations
 T_REPORT         = 1e-3    # (s) Report Time
 T_UPDATE         = 1e-3    # (s) Update time
 T_NETWORK        = 1e-4    # (s) Network step time
 #
 handler=RootReportHandler("wilson.root",canvas,1)
 handler.AddNodeToCanvas(id_exc)
 par_run = SimulationRunParameter(handler, MAX_ITERATIONS,T_BEGIN,T_END,T_REPORT,T_UPDATE,T_NETWORK,"wilson.log")
 #
 # perform the actual simulation
 #
 net.ConfigureSimulation(par_run)
 net.Evolve()

Generated on Fri Jul 17 18:57:18 2009 by  doxygen 1.5.6