/CSIM/CSIM_benchmark_2_cuba_circuit.m

https://bitbucket.org/apdavison/spiking-network-benchmarks · Objective C · 83 lines · 69 code · 14 blank · 0 comment · 2 complexity · 5502230220001170a06321a002862139 MD5 · raw file

  1. %================================================================================
  2. %
  3. % CSIM implementation of a benchmark simulation described in the paper
  4. % "Simulation of networks of spiking neurons: A review of tools and strategies"
  5. % using the "Circuit Tools" available from www.lsm.tugraz.at.
  6. %
  7. % Benchmark 2: Current-based (CUBA) IF network. This benchmark consists of a
  8. % network of intefrate-and-fire neurons connected with
  9. % current-based synapses.
  10. %
  11. % The "Circuit Tools" and CSIM are freely available from www.lsm.tugraz.at
  12. %
  13. % Authors: Dejan Pecevski, dejan@igi.tugraz.at
  14. % Thomas Natschlaeger, thomas.natschlaeger@scch.at
  15. %
  16. % Date: April 2006
  17. %
  18. %================================================================================
  19. close all; clear csim;
  20. % Global parameter values
  21. ConnP = 0.02; % connectivity probability
  22. Tsim = 0.4; % duration of the simulation [sec]
  23. DTsim = 0.1e-3; % simulation time step [sec]
  24. Tinp = 50e-3; % length of the initial stimulus [sec]
  25. nInputNeurons = 10 ; % number of neurons which provide initial input (for a time span of Tinp)
  26. inpConnP = 0.01 ; % connectivity from input neurons to network neurons
  27. inputFiringRate = 80; % firing rate of the input neurons during the initial input
  28. % initialize an empty neural microcircuit object
  29. nmc = neural_microcircuit('dt_sim', DTsim);
  30. % Add a pool of conductance based neurons to the circuit
  31. [nmc, pool] = add(nmc, 'pool', 'type', 'LifNeuron', ...
  32. 'size', [20 20 10], 'origin', [20 1 1], 'frac_EXC', 0.8, ...
  33. 'Neuron.Cm', 2e-10, 'Neuron.Rm', 1e8, ...
  34. 'Neuron.Vthresh', -50e-3, 'Neuron.Vreset', -60e-3, 'Neuron.Trefract', 5e-3, ...
  35. 'Neuron.Vresting', -49e-3, 'Neuron.Vinit', -60e-3, 'Neuron.Iinject', [0 0] ) ;
  36. % Create the connections in the network
  37. Erev_exc = 0 ;
  38. Erev_inh = -80e-3 ;
  39. Vmean = -60e-3 ;
  40. Winh = (Erev_inh-Vmean)*4.5e-9;
  41. Wexc = (Erev_exc-Vmean)*0.27e-9;
  42. [nmc, cn] = add( nmc, 'Conn', 'dest', pool, 'src', pool, 'type', ... % connect pool with itself
  43. 'StaticSpikingSynapse', 'lambda', Inf, 'C', ConnP * ones(1,4), ... % connectivity does not depend on distance
  44. 'SH_W', 0, 'SH_delay', 0, 'rescale', 0, 'constW', 0, 'Synapse.delay', 0, ... % no synaptic heterogeneity (SH)
  45. 'Synapse([EE IE]).W', Wexc, 'Synapse([EE IE]).tau', 5e-3, ... % excitatory synapses
  46. 'Synapse([EI II]).W', Winh, 'Synapse([EI II]).tau', 10e-3 ); % inhibitory synapses
  47. % Create the input neurons for the inital stimulation
  48. [nmc, inp] = add(nmc, 'pool', 'origin', [1 nInputNeurons 1], 'size', [1 nInputNeurons 1], ...
  49. 'type', 'SpikingInputNeuron', 'frac_EXC', 1);
  50. % Connect the input neurons to the network
  51. [nmc, cinp] = add( nmc, 'Conn', 'src', inp, 'dest', pool, ...
  52. 'type', 'StaticSpikingSynapse', 'lambda', Inf, 'C', inpConnP*ones(1,4), ...
  53. 'SH_W', 0, 'SH_delay', 0, 'rescale', 0, 'constW', 0, ...
  54. 'Synapse.W', Wexc, 'Synapse.tau', 5e-3, 'Synapse.delay', 0);
  55. % Create the stimulus
  56. S = generate( constant_rate('nChannels', nInputNeurons, 'f', inputFiringRate, 'Tstim', Tinp) );
  57. % Record the spikings of some random neurons
  58. nmc = record(nmc, 'Volume', [20 1 1 ; 30 20 1 ], 'Field', 'spikes', 'dt', DTsim);
  59. % Record also the membrane potential of two neurons
  60. nmc = record(nmc, 'Volume', [30 10 5 ; 30 10 5], 'Field', 'Vm', 'dt', DTsim);
  61. nmc = record(nmc, 'Volume', [25 15 5 ; 25 15 5], 'Field', 'Vm', 'dt', DTsim);
  62. % Simulate the network
  63. tic; fprintf('Running simulation: ');
  64. reset(nmc);
  65. R = simulate(nmc, Tsim, S);
  66. fprintf('Done. %gsec CPU time for %gms simulation time\n', round(toc), Tsim*1000 );
  67. % Finally make some plots
  68. % note that plot_response is part of the circuit tools
  69. plot_response(R);