Changeset 472 for trunk

Show
Ignore:
Timestamp:
10/30/10 17:23:55 (19 months ago)
Author:
emuller
Message:

stgen._gen_g_add ... got working again ... an alternative to shotnoise_fromspike which can be faster if the number of spikes is small ...

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/stgen.py

    r463 r472  
    10581058 
    10591059 
    1060 def _gen_g_add(spikes,tau,q,t,eps = 1.0e-8): 
     1060def _gen_g_add(spikes,q,tau,t,eps = 1.0e-8): 
     1061    """ 
     1062 
     1063    spikes is a SpikeTrain object 
     1064 
     1065    """ 
    10611066 
    10621067    #spikes = poisson_generator(rate,t[-1]) 
    10631068 
    1064     gd_s = zeros(shape(t),Float) 
     1069    gd_s = numpy.zeros(t.shape,float) 
    10651070 
    10661071    dt = t[1]-t[0] 
    10671072 
    10681073    # time of vanishing significance 
    1069     vs_t = -tau*log(eps/q) 
    1070     kern = q*exp(-arrayrange(0.0,vs_t,dt)/tau) 
     1074    vs_t = -tau*numpy.log(eps/q) 
     1075    kern = q*numpy.exp(-numpy.arange(0.0,vs_t,dt)/tau) 
    10711076 
    10721077    vs_idx = len(kern) 
    10731078 
    1074     idx = clip(searchsorted(t,spikes),0,len(t)-1) 
    1075     idx2 = clip(idx+vs_idx,0,len(gd_s)) 
     1079    idx = numpy.clip(numpy.searchsorted(t,spikes.spike_times),0,len(t)-1) 
     1080    idx2 = numpy.clip(idx+vs_idx,0,len(gd_s)) 
    10761081    idx3 = idx2-idx 
    10771082