/*
 *  test_compare_delta.sli
 *
 *  This file is part of NEST.
 *
 *  Copyright (C) 2004 The NEST Initiative
 *
 *  NEST is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  NEST is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with NEST.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

(unittest) run
/unittest using

ResetKernel

% compare iaf_psc_delta and iaf_psc_delta_canon
% neurons are driven by spike_generator firing at
%
%  1.0 2.0 3.0 4.0 5.0 10.5 12.0
%
% both neurons fire at 4.0, spike at 5.0 arrives during
% the refractory period

 
<<
  /E_L 49.0 neg      % resting membrane potential [mV]
  /V_m 60.0 neg
  /V_th 50.0 neg     % Threshold [mV] WRONG!!
  /V_reset 60.0 neg  % Reset Potential [mV] WRONG!!
  /C_m 200.0         % Capacity of the membrane [pF]
  /tau_m 20.0        % Membrane time constant [ms]
 
 /t_ref 5.0          % duration of refractory period [ms]
>> /neuron_params Set


0 << /resolution 0.1 >> SetStatus

/iaf_psc_delta        Create /plain Set
/iaf_psc_delta_canon  Create /canon Set

plain neuron_params SetStatus
canon neuron_params SetStatus

/spike_generator     Create /gen Set
/spike_detector      Create /det Set


gen << /precise_times false /spike_times [ 1.0 2.0 3.0 4.0 5.0 10.5 12.0 ] >> SetStatus


/static_synapse
<< /delay  0.1       % synaptic delay, all connections [ms] 
   /weight 2.5       % [pA], excitatory  
>> SetDefaults

[ plain canon ]
{
  /nrn Set

  gen nrn Connect
  nrn det Connect

} forall


20.0
%50
%200.0 
Simulate

{
  det [/events [/senders /times]] get cva Transpose
  [[2 4.1] [1 4.1]] eq
} assert_or_die
