Changeset 473 for trunk

Show
Ignore:
Timestamp:
10/30/10 21:49:11 (19 months ago)
Author:
emuller
Message:

Updated stgen examples

Location:
trunk/examples/stgen
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/examples/stgen/inh_2Dmarkov_psth.py

    r405 r473  
    99 
    1010 
    11 import numpy 
     11import numpy,sys 
    1212from NeuroTools import stgen 
    1313from pylab import zeros_like, plot 
     
    3535t_stop = 1000.0 
    3636 
    37 trials = 10000 
     37trials = 5000 
     38print "Running %d trials of %.2f milliseconds" % (trials, t_stop) 
     39for i in xrange(trials): 
     40    if i%100==0: 
     41        print "%d" % i, 
     42        sys.stdout.flush() 
     43    st = stg.inh_2Dadaptingmarkov_generator(a,bq,tau_s,tau_r,qrqs,t,t_stop,array=True) 
     44    psth[1:]+=numpy.histogram(st,t)[0] 
    3845 
    39 for i in xrange(trials): 
    40     st = stg.inh_2Dadaptingmarkov_generator(a,bq,tau_s,tau_r,qrqs,t,t_stop,array=True) 
    41     psth+=numpy.histogram(st,t, new=False)[0] 
     46print "\n" 
    4247 
    4348# normalize 
     
    4651psth/= dt*float(trials)/1000.0 
    4752 
     53# this is for correct 'steps' plotting only 
     54psth[0] = psth[1] 
     55 
    4856plot(t,psth,linestyle='steps') 
    4957 
  • trunk/examples/stgen/inh_gamma_psth.py

    r435 r473  
    77from NeuroTools import stgen 
    88from pylab import zeros_like, plot 
    9  
     9import sys 
    1010 
    1111dt = 10.0 
     
    2727stg = stgen.StGen() 
    2828 
    29 for i in xrange(10000): 
     29trials = 5000 
     30tsim = 1000.0 
     31print "Running %d trials of %.2f milliseconds" % (trials, tsim) 
     32for i in xrange(trials): 
     33    if i%100==0: 
     34        print "%d" % i, 
     35        sys.stdout.flush() 
    3036    st = stg.inh_gamma_generator(a,b,t,1000.0,array=True) 
    31     psth+=numpy.histogram(st,t,new=False)[0] 
     37    psth[1:]+=numpy.histogram(st,t)[0] 
     38 
     39print "\n" 
    3240 
    3341# normalize 
     
    3644psth/= dt*10000.0/1000.0 
    3745 
     46# this is for plotting only 
     47psth[0] = psth[1] 
     48 
    3849plot(t,psth,linestyle='steps') 
    3950