Changeset 348
- Timestamp:
- 11/16/08 00:47:40 (2 months ago)
- Files:
-
- trunk/examples/sfn2008/sfn_example_stgen.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/examples/sfn2008/sfn_example_stgen.py
r347 r348 5 5 and the SpikeTrain class. 6 6 7 - Creates two poisson spike trains with approx. rate of 100 Hz. 8 - Calculates rate, coefficient of variance and fano factor using the 9 functions form SpikeTrain. 10 - Calculates cross correlation between the two SpikeTrains. 11 - generates a third SpikeTrain with rate ~10Hz and merges it into the 12 previous two, effectively injecting correlation. 13 - Plots the cross correlation for the correlated and uncorrelated SpikeTrains. 14 - Generates shot noise from one SpikeTrain using the StGEn class and plots it. 15 - Calculates spike triggered average from shot noise to reconstruct the initial 16 shot noise kernel. 17 7 18 Performed at the NeuroTools demo session, INCF booth, 8 19 SfN annual meeting 2008, Washington. DC. 9 20 """ 10 21 import NeuroTools.stgen as stgen 22 import pylab 11 23 sg = stgen.StGen() 12 24 duration = 10000. … … 32 44 mode = 'same') 33 45 34 import pylab 35 pylab.plot(cc) 46 pylab.plot(cc, label = 'no correlation') 36 47 37 # inject correlation into st1 and st2 (only if correlation is > 0)48 # inject correlation into st1 and st2 38 49 st3 = sg.poisson_generator(rate=rate_shared, t_stop = duration) 39 50 st1.merge(st3) … … 44 55 mode = 'same') 45 56 46 import pylab 47 pylab.plot(cc2) 57 pylab.plot(cc2, label = '10% correlation') 58 pylab.legend() 59 pylab.show() 48 60 49 61 #generate shot noise from st1 … … 53 65 t_start = st1.t_start, 54 66 t_stop = st1.t_stop) 55 pylab.figure()67 f = pylab.figure() 56 68 pylab.plot(st1_shot.signal) 69 f.gca().set_title('shot noise') 70 f.gca().set_xlabel('time [ms]') 57 71 58 72 # spike triggered average reveals the original shot-noise kernel

