-
Notifications
You must be signed in to change notification settings - Fork 370
/
issue-77.sli
222 lines (197 loc) · 7.33 KB
/
issue-77.sli
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
/*
* issue-77.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/>.
*
*/
/*
* Regression test for Ticket #77 (GitHub).
*
* Ensure that all neuron models register outgoing
* spikes with archiving node. The test sends a very
* high-rate Poisson spike train into the neuron that
* should make any type of model neuron fire and checks
* both `t_spike` entry of the neuron (>0 if neuron has
* spiked) and checks that the connection weight differs
* from the initial value 1.0.
*
* Hans Ekkehard Plesser, 2015-08-14
*
*/
(unittest) run
/unittest using
M_ERROR setverbosity
/* We first need to test the parrot_neuron_ps, since we should use that in tests below.
*/
{
/sg /spike_generator << /spike_times [ 10.0 ] /precise_times true >> Create def
/pn /parrot_neuron_ps Create def
sg pn Connect
20 Simulate
pn /t_spike get 11.0 eq
} assert_or_die
% The following models will not be tested:
/skip_list [
/ginzburg_neuron % binary neuron
/mcculloch_pitts_neuron % binary neuron
/erfc_neuron % binary neuron
/gif_pop_psc_exp % population model, not suitable for STDP
/lin_rate_ipn % rate neuron
/lin_rate_opn % rate neuron
/tanh_rate_ipn % rate neuron
/tanh_rate_opn % rate neuron
/threshold_lin_rate_ipn % rate neuron
/threshold_lin_rate_opn % rate neuron
/siegert_neuron % rate neuron
/gauss_rate_ipn % rate neuron
/sigmoid_rate_gg_1998_ipn % rate neuron
/sigmoid_rate_ipn % rate neuron
/rate_transformer_lin % rate transformer
/rate_transformer_tanh % rate transformer
/rate_transformer_threshold_lin % rate transformer
/rate_transformer_gauss % rate transformer
/rate_transformer_sigmoid % rate transformer
/rate_transformer_sigmoid_gg_1998 % rate transformer
/music_event_out_proxy % MUSIC port
/music_event_in_proxy % MUSIC port
/music_message_in_proxy % MUSIC port
/music_cont_out_proxy % MUSIC port
/music_cont_in_proxy % MUSIC port
/music_rate_out_proxy % MUSIC port
/music_rate_in_proxy % MUSIC port
] def
% The following models require connections to rport 1 or other specific parameters:
/extra_params <<
/aeif_psc_alpha << /initial_weight 80.0 >>
/aeif_psc_exp << /initial_weight 80.0 >>
/aeif_psc_delta << /initial_weight 80.0 >>
/gif_psc_exp_multisynapse << /params << /tau_syn [ 1.0 ] >>
/receptor_type 1 >>
/gif_cond_exp_multisynapse << /params << /tau_syn [ 1.0 ] >>
/receptor_type 1 >>
/glif_cond << /params << /tau_syn [ 0.2 ] /E_rev [ 0.0 ] >>
/receptor_type 1 >>
/glif_psc << /params << /tau_syn [ 1.0 ] >>
/receptor_type 1 >>
/iaf_psc_alpha_multisynapse << /params << /tau_syn [ 1.0 ] >>
/receptor_type 1 >>
/iaf_psc_exp_multisynapse << /params << /tau_syn [ 1.0 ] >>
/receptor_type 1 >>
/aeif_cond_alpha_multisynapse << /params << /tau_syn [ 2.0 ] >>
/receptor_type 1 >>
/aeif_cond_beta_multisynapse << /params << /E_rev [ 0.0 ]
/tau_rise [ 1.0 ]
/tau_decay [ 2.0 ] >>
/receptor_type 1 >>
/iaf_cond_alpha_mc << /receptor_type 1 >>
/pp_cond_exp_mc_urbanczik << /receptor_type 1 >>
/ht_neuron << /receptor_type 1 >>
>>
def
{
% apply to all models of element_type neuron
GetKernelStatus /node_models get
{
/model Set
model skip_list exch MemberQ not
model GetDefaults /element_type get /neuron eq and
{
ResetKernel
/n model Create def
extra_params model known
{
extra_params model get /params known
{
extra_params model get /params get
n exch
SetStatus
} if
} if
% if the model is a compartmental model,
% we need to add at least a root compartment
model GetDefaults dup
/compartments known
{
n
<<
/compartments << /parent_idx -1 >>
/receptors << /comp_idx 0 /receptor_type (AMPA) >>
>> SetStatus
}
if
/pg /poisson_generator << /rate 1e5 >> Create def
/parrot /parrot_neuron_ps Create def
/sr /spike_recorder Create def
pg parrot Connect % need to connect via parrot since generators cannot connect with
% plastic synapses.
/initial_weight 10.0 def
/syn_spec << /synapse_model /stdp_synapse
/weight
extra_params model known
{
extra_params model get /initial_weight known
{
extra_params model get /initial_weight get
}
{
initial_weight
} ifelse
}
{
initial_weight
} ifelse
/receptor_type
extra_params model known
{
extra_params model get /receptor_type known
{
extra_params model get /receptor_type get
}
{
0
} ifelse
}
{
0
} ifelse
>> def
parrot n /one_to_one syn_spec Connect
n sr Connect
100 Simulate
/neuron_spiked sr /n_events get 0 gt def
/t_spike_set n /t_spike get 0 gt def
/weight_changed
<< /source parrot >> GetConnections 0 get /weight get
initial_weight neq def
neuron_spiked t_spike_set weight_changed and and
dup not {
(FAILED: ) model cvs join ==
( events ) =only sr /n_events get =
( tspike ) =only n /t_spike get =
( weight ) =only << /source parrot >> GetConnections 0 get /weight get ==
} if
}
{ true }
ifelse
}
Map
% see if all entries are true
true exch { and } Fold
}
assert_or_die
endusing