File: examples-misc_correlated_inputs.txt

package info (click to toggle)
brian 1.4.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, stretch
  • size: 23,436 kB
  • sloc: python: 68,707; cpp: 29,040; ansic: 5,182; sh: 111; makefile: 61
file content (50 lines) | stat: -rw-r--r-- 1,259 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
.. currentmodule:: brian

.. index::
   pair: example usage; run
   pair: example usage; SpikeGeneratorGroup
   pair: example usage; show
   pair: example usage; raster_plot
   pair: example usage; reshape
   pair: example usage; mixture_process
   pair: example usage; SpikeMonitor
   pair: example usage; linspace
   pair: example usage; mean

.. _example-misc_correlated_inputs:

Example: correlated_inputs (misc)
=================================

An example with correlated spike trains
From: Brette, R. (2007). Generation of correlated spike trains.

::

    from brian import *
    
    N = 100
    #input = HomogeneousCorrelatedSpikeTrains(N, r=10 * Hz, c=0.1, tauc=10 * ms)
    
    c = .2
    nu = linspace(1*Hz, 10*Hz, N)
    P = c*dot(nu.reshape((N,1)), nu.reshape((1,N)))/mean(nu**2)
    tauc = 5*ms
    
    spikes = mixture_process(nu, P, tauc, 1*second)
    #spikes = [(i,t*second) for i,t in spikes]
    input = SpikeGeneratorGroup(N, spikes)
    
    S = SpikeMonitor(input)
    #S2 = PopulationRateMonitor(input)
    #M = StateMonitor(input, 'rate', record=0)
    run(1000 * ms)
    
    #subplot(211)
    raster_plot(S)
    #subplot(212)
    #plot(S2.times / ms, S2.smooth_rate(5 * ms))
    #plot(M.times / ms, M[0] / Hz)
    show()