Changeset 3275

Show
Ignore:
Timestamp:
07/31/12 13:27:08 (10 months ago)
Author:
romainbrette
Message:

Cleaned Synapses examples

Location:
trunk
Files:
24 modified

Legend:

Unmodified
Added
Removed
  • trunk/dev/Brian meeting 30 Jul 2012

    r3270 r3275  
    55[DONE]* Examples from the twister (Romain) 
    66* Synapses 
    7         - clean examples (Romain) 
    8         - move from experimental (Romain) 
     7        [DONE]- clean examples (Romain) 
     8        [DONE]- move from experimental (Romain) 
    99        - some tests? (Marcel) 
    1010        - 2.5 compatibility (Marcel) 
  • trunk/examples/synapses/CUBA.py

    r3274 r3275  
    1212from brian import * 
    1313import time 
    14 #log_level_debug() 
    15 #set_global_preferences(useweave=False) 
    1614 
    1715start_time = time.time() 
     
    3937wi = (-20 * 4.5 / 10) * mV # inhibitory synaptic weight 
    4038 
    41 if True: 
    42 ########### NEW SYNAPSE CODE 
    43     Se = Synapses(Pe, P, model = 'w : 1', pre = 'ge += we') 
    44     Si = Synapses(Pi, P, model = 'w : 1', pre = 'gi += wi') 
    45     Se[:,:]=0.02 
    46     Si[:,:]=0.02 
    47     Se.delay='rand()*ms' 
    48     Si.delay='rand()*ms' 
    49 else: 
    50 ########### OLD CODE 
    51     Ce = Connection(Pe, P, 'ge', weight=we, sparseness=0.02, delay=(0*ms,1*ms)) 
    52     Ci = Connection(Pi, P, 'gi', weight=wi, sparseness=0.02, delay=(0*ms,1*ms)) 
     39Se = Synapses(Pe, P, model = 'w : 1', pre = 'ge += we') 
     40Si = Synapses(Pi, P, model = 'w : 1', pre = 'gi += wi') 
     41Se[:,:]=0.02 
     42Si[:,:]=0.02 
     43Se.delay='rand()*ms' 
     44Si.delay='rand()*ms' 
    5345 
    5446P.v = Vr + rand(len(P)) * (Vt - Vr) 
  • trunk/examples/synapses/Diesmann_et_al_1999.py

    r3025 r3275  
    66''' 
    77from brian import * 
    8 from brian.experimental.synapses import * 
    98 
    109# Neuron model parameters 
  • trunk/examples/synapses/README.txt

    r3020 r3275  
    77* probabilistic synapses 
    88* multiple synapses for a given neuron pair 
    9  
    10 The syntax is described in BEP-21 (dev/BEPS/) and in the docstrings. 
    11 The code is in experimental/synapses. 
    12  
    13 Please report any bug to the mailing list! 
    14  
  • trunk/examples/synapses/STDP1.py

    r3092 r3275  
    44 
    55This simulation takes a long time! 
    6  
    7 Works! 
    8  
    9 Original time: 278 s 
    10 with DelayConnection: 478 s 
    11  
    12 * New time: 479 s 
    13 * with precomputed offsets: 444 s 
    14 * with fixed delays: 454 s (?) 
    156''' 
    167from brian import * 
    17 from brian.experimental.synapses import * 
    188from time import time 
    199 
  • trunk/examples/synapses/STDP1_bis.py

    r3092 r3275  
    1010''' 
    1111from brian import * 
    12 from brian.experimental.synapses import * 
    1312from time import time 
    14 set_global_preferences(useweave=False) 
    1513 
    1614N = 1000 
  • trunk/examples/synapses/barrelcortex.py

    r2995 r3275  
    1515from brian import * 
    1616import time 
    17 from brian.experimental.synapses import * 
    1817 
    1918# Uncomment if you have a C compiler 
  • trunk/examples/synapses/delayed_stdp.py

    r3092 r3275  
    44from brian import * 
    55import time 
    6 from brian.experimental.synapses import * 
    76 
    87N = 1 
  • trunk/examples/synapses/gapjunctions.py

    r2995 r3275  
    33''' 
    44from brian import * 
    5 from brian.experimental.synapses import * 
    65 
    76N = 10 
  • trunk/examples/synapses/jeffress.py

    r3030 r3275  
    99''' 
    1010from brian import * 
    11 from brian.experimental.synapses import * 
    1211from time import time 
    13 set_global_preferences(usecodegen = False) 
    1412 
    1513defaultclock.dt = .02 * ms 
     
    4644neurons = NeuronGroup(N, model=eqs_neurons, threshold=1, reset=0) 
    4745 
    48 if True: #20.3 s 
    49     synapses = Synapses(ears,neurons,model='w:1',pre='v+=w') 
    50     synapses[:,:]=True 
    51     synapses.w=.5 
    52     synapses.delay[0, :] = linspace(0 * ms, 1.1 * max_delay, N) 
    53     synapses.delay[1, :] = linspace(0 * ms, 1.1 * max_delay, N)[::-1]     
    54 else: #19.7 s 
    55     synapses = Connection(ears, neurons, 'v', structure='dense', delay=True, max_delay=1.1 * max_delay) 
    56     synapses.connect_full(ears, neurons, weight=.5) 
    57     synapses.delay[0, :] = linspace(0 * ms, 1.1 * max_delay, N) 
    58     synapses.delay[1, :] = linspace(0 * ms, 1.1 * max_delay, N)[::-1] 
     46synapses = Synapses(ears,neurons,model='w:1',pre='v+=w') 
     47synapses[:,:]=True 
     48synapses.w=.5 
     49synapses.delay[0, :] = linspace(0 * ms, 1.1 * max_delay, N) 
     50synapses.delay[1, :] = linspace(0 * ms, 1.1 * max_delay, N)[::-1]     
    5951 
    6052spikes = SpikeMonitor(neurons) 
  • trunk/examples/synapses/multiple_delays.py

    r2995 r3275  
    33''' 
    44from brian import * 
    5 from brian.experimental.synapses import * 
    65 
    76P=NeuronGroup(1,model='dv/dt=1/(20*ms):1',threshold=1,reset=0) 
  • trunk/examples/synapses/noisy_ring.py

    r2995 r3275  
    33''' 
    44from brian import * 
    5 from brian.experimental.synapses import * 
    65 
    76tau = 10 * ms 
  • trunk/examples/synapses/nonlinear_synapses.py

    r2995 r3275  
    44from brian import * 
    55import time 
    6 from brian.experimental.synapses import * 
    76 
    87a=1/(10*ms) 
  • trunk/examples/synapses/one_synapse.py

    r2995 r3275  
    33''' 
    44from brian import * 
    5 from brian.experimental.synapses import * 
    65 
    76P=NeuronGroup(1,model='dv/dt=1/(10*ms):1',threshold=1,reset=0) 
  • trunk/examples/synapses/one_synapse_bis.py

    r2995 r3275  
    44''' 
    55from brian import * 
    6 from brian.experimental.synapses import * 
    7  
    8 #log_level_debug() 
    96 
    107P=NeuronGroup(5,model='dv/dt=1/(10*ms):1',threshold=1,reset=0) 
     
    129S=Synapses(P,Q,model='w:1',pre='v+=w') 
    1310M=StateMonitor(Q,'v',record=True) 
    14 #P.v[2]=.5 
    1511 
    1612S[2,3]=True 
  • trunk/examples/synapses/poisson_synapses.py

    r3053 r3275  
    88''' 
    99from brian import * 
    10 from brian.experimental.synapses import Synapses 
    1110 
    1211# Poisson inputs 
  • trunk/examples/synapses/probabilistic_synapses.py

    r2995 r3275  
    55""" 
    66from brian import * 
    7 from brian.experimental.synapses import * 
    8  
    9 #log_level_debug() 
    107 
    118N=20 
  • trunk/examples/synapses/probabilistic_synapses2.py

    r2995 r3275  
    44from brian import * 
    55from numpy.random import binomial 
    6 from brian.experimental.synapses import * 
    76         
    87Nin=1000 
     
    2019S.p='rand()' 
    2120 
    22 #S=StateMonitor(neuron,'v',record=0) 
    2321S=SpikeMonitor(neurons) 
    2422 
    2523run(1000*ms) 
    2624 
    27 #S.plot() 
    2825raster_plot(S) 
    2926show() 
  • trunk/examples/synapses/short_term_plasticity.py

    r2995 r3275  
    33""" 
    44from brian import * 
    5 from brian.experimental.synapses import * 
    65 
    76tau_e = 3 * ms 
     
    4140                  u+=U*(1-u)''') 
    4241S[:,:]='i==j' # one to one connection 
    43 #S.connect_one_to_one(input,neuron) # equivalent instruction 
    4442S.w=A_SE 
    4543# Initialization of STP variables 
  • trunk/examples/synapses/short_term_plasticity2.py

    r2995 r3275  
    44""" 
    55from brian import * 
    6 from brian.experimental.synapses import * 
    7  
    8 #log_level_debug() 
    96 
    107tau_e = 3 * ms 
  • trunk/examples/synapses/synapse_construction.py

    r3002 r3275  
    55from brian import * 
    66import time 
    7 from brian.experimental.synapses import * 
    87 
    98N=10 
  • trunk/examples/synapses/transient_sync.py

    r2995 r3275  
    55from brian import * 
    66import time 
    7 from brian.experimental.synapses import * 
    87 
    98tau = 10 * ms 
  • trunk/examples/synapses/two_synapses.py

    r3030 r3275  
    44''' 
    55from brian import * 
    6 from brian.experimental.synapses import * 
    7  
    8 #log_level_debug() 
    96 
    107P=NeuronGroup(2,model='dv/dt=1/(10*ms):1',threshold=1,reset=0) 
  • trunk/examples/synapses/weightmonitor.py

    r2995 r3275  
    44""" 
    55from brian import * 
    6 from brian.experimental.synapses import * 
    76from time import time 
    87