File: examples-frompapers-computing with neural synchrony-hearing_Fig7B_Licklider.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 (68 lines) | stat: -rw-r--r-- 2,409 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
.. currentmodule:: brian

.. index::
   pair: example usage; NeuronGroup
   pair: example usage; run
   pair: example usage; log
   pair: example usage; show
   pair: example usage; raster_plot
   pair: example usage; yticks
   pair: example usage; Connection
   pair: example usage; SpikeMonitor
   pair: example usage; linspace
   pair: example usage; exp
   pair: example usage; ylabel
   pair: example usage; StateMonitor

.. _example-frompapers-computing with neural synchrony-hearing_Fig7B_Licklider:

Example: Fig7B_Licklider (frompapers/computing with neural synchrony/hearing)
=============================================================================

Brette R (2012). Computing with neural synchrony. PLoS Comp Biol. 8(6): e1002561. doi:10.1371/journal.pcbi.1002561
------------------------------------------------------------------------------------------------------------------
Figure 12B. Spike-based adaptation of Licklider's model of pitch processing (autocorrelation with
delay lines).

::

    from brian import *
    
    defaultclock.dt = .02 * ms
    
    # Ear and sound
    max_delay = 20 * ms # 50 Hz
    tau_ear = 1 * ms
    sigma_ear = .1
    eqs_ear = '''
    dx/dt=(sound-x)/tau_ear+sigma_ear*(2./tau_ear)**.5*xi : 1
    sound=5*sin(2*pi*frequency*t)**3 : 1 # nonlinear distorsion
    #sound=5*(sin(4*pi*frequency*t)+.5*sin(6*pi*frequency*t)) : 1 # missing fundamental
    frequency=(200+200*t*Hz)*Hz : Hz # increasing pitch
    '''
    receptors = NeuronGroup(2, model=eqs_ear, threshold=1, reset=0, refractory=2 * ms)
    traces = StateMonitor(receptors, 'x', record=True)
    sound = StateMonitor(receptors, 'sound', record=0)
    
    # Coincidence detectors
    min_freq = 50 * Hz
    max_freq = 1000 * Hz
    N = 300
    tau = 1 * ms
    sigma = .1
    eqs_neurons = '''
    dv/dt=-v/tau+sigma*(2./tau)**.5*xi : 1
    '''
    neurons = NeuronGroup(N, model=eqs_neurons, threshold=1, reset=0)
    synapses = Connection(receptors, neurons, 'v', structure='dense', max_delay=1.1 * max_delay, delay=True)
    synapses.connect_full(receptors, neurons, weight=.5)
    synapses.delay[1, :] = 1. / exp(linspace(log(min_freq / Hz), log(max_freq / Hz), N))
    spikes = SpikeMonitor(neurons)
    
    run(500 * ms)
    raster_plot(spikes)
    ylabel('Frequency')
    yticks([0, 99, 199, 299], array(1. / synapses.delay.todense()[1, [0, 99, 199, 299]], dtype=int))
    show()