Show
Ignore:
Timestamp:
02/12/10 16:02:09 (2 years ago)
Author:
apdavison
Message:

Various fixes from running doctests

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/examples/VAbenchmarks.py

    r705 r708  
    144144    connections['ext2i'] = Projection(ext_stim, inh_cells, ext_conn, target='excitatory') 
    145145 
    146 for prj in connections.keys(): 
    147     connections[prj].saveConnections('Results/VAbenchmark_%s_%s_%s_np%d.conn' % (benchmark, prj, simulator_name, np)) 
    148  
    149146# === Setup recording ========================================================== 
    150147print "%s Setting up recording..." % node_id 
     
    154151exc_cells.record_v(vrecord_list) 
    155152 
    156 buildCPUTime = timer.elapsedTime() 
     153buildCPUTime = timer.diff() 
     154 
     155# === Save connections to file ================================================= 
     156 
     157for prj in connections.keys(): 
     158    connections[prj].saveConnections('Results/VAbenchmark_%s_%s_%s_np%d.conn' % (benchmark, prj, simulator_name, np)) 
     159saveCPUTime = timer.diff() 
    157160 
    158161# === Run simulation =========================================================== 
    159162print "%d Running simulation..." % node_id 
    160 timer.reset() 
    161163 
    162164run(tstop) 
    163165 
    164 simCPUTime = timer.elapsedTime() 
    165  
    166 E_rate = exc_cells.meanSpikeCount()*1000./tstop 
    167 I_rate = inh_cells.meanSpikeCount()*1000./tstop 
     166simCPUTime = timer.diff() 
     167 
     168E_count = exc_cells.meanSpikeCount() 
     169I_count = inh_cells.meanSpikeCount() 
    168170 
    169171# === Print results to file ==================================================== 
    170172 
    171173print "%d Writing data to file..." % node_id 
    172 timer.reset() 
    173174 
    174175if not(os.path.isdir('Results')): 
     
    178179inh_cells.printSpikes("Results/VAbenchmark_%s_inh_%s_np%d.ras" % (benchmark, simulator_name, np)) 
    179180exc_cells.print_v("Results/VAbenchmark_%s_exc_%s_np%d.v" % (benchmark, simulator_name, np)) 
    180 writeCPUTime = timer.elapsedTime() 
    181  
    182 tmp_string = "%d e→e  %d e→i  %d i→e  %d i→i" % (connections['e2e'].size(), 
    183                                                  connections['e2i'].size(), 
    184                                                  connections['i2e'].size(), 
    185                                                  connections['i2i'].size()) 
    186  
    187 def nprint(s): 
    188     """Small function to display information only on node 0.""" 
    189     if (node_id == 0): 
    190         print s 
    191  
    192 nprint("\n--- Vogels-Abbott Network Simulation ---") 
    193 nprint("Nodes                  : %d" % np) 
    194 nprint("Simulation type        : %s" % benchmark) 
    195 nprint("Number of Neurons      : %d" % n) 
    196 nprint("Number of Synapses     : %s" % tmp_string) 
    197 nprint("Excitatory conductance : %g nS" % Gexc) 
    198 nprint("Inhibitory conductance : %g nS" % Ginh) 
    199 nprint("Excitatory rate        : %g Hz" % E_rate) 
    200 nprint("Inhibitory rate        : %g Hz" % I_rate) 
    201 nprint("Build time             : %g s" % buildCPUTime)  
    202 nprint("Simulation time        : %g s" % simCPUTime) 
    203 nprint("Writing time           : %g s" % writeCPUTime) 
     181writeCPUTime = timer.diff() 
     182 
     183connections = "%d e→e  %d e→i  %d i→e  %d i→i" % (connections['e2e'].size(), 
     184                                                  connections['e2i'].size(), 
     185                                                  connections['i2e'].size(), 
     186                                                  connections['i2i'].size()) 
     187 
     188if node_id == 0: 
     189    print "\n--- Vogels-Abbott Network Simulation ---" 
     190    print "Nodes                  : %d" % np 
     191    print "Simulation type        : %s" % benchmark 
     192    print "Number of Neurons      : %d" % n 
     193    print "Number of Synapses     : %s" % connections 
     194    print "Excitatory conductance : %g nS" % Gexc 
     195    print "Inhibitory conductance : %g nS" % Ginh 
     196    print "Excitatory rate        : %g Hz" % (E_count*1000.0/tstop,) 
     197    print "Inhibitory rate        : %g Hz" % (I_count*1000.0/tstop,) 
     198    print "Build time             : %g s" % buildCPUTime 
     199    print "Save connections time  : %g s" % saveCPUTime 
     200    print "Simulation time        : %g s" % simCPUTime 
     201    print "Writing time           : %g s" % writeCPUTime 
    204202 
    205203