13
13
#
14
14
# NEST is distributed in the hope that it will be useful,
15
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ 0 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
17
# GNU General Public License for more details.
18
18
#
19
19
# You should have received a copy of the GNU General Public License
22
22
import nest
23
23
import pytest
24
24
25
+ # Models to skip to do given reasons
26
+ skip_list = [
27
+ "correlospinmatrix_detector" , # not a neuron
28
+ "eprop_iaf_bsshslm_2020" , # no ArchivingNode, thus no t_spike
29
+ "eprop_iaf_adapt_bsshslm_2020" , # no ArchivingNode, thus no t_spike
30
+ "eprop_readout_bsshslm_2020" , # no ArchivingNode, thus no t_spike
31
+ "eprop_iaf" , # no ArchivingNode, thus no t_spike
32
+ "eprop_iaf_adapt" , # no ArchivingNode, thus no t_spike
33
+ "eprop_iaf_psc_delta" , # no ArchivingNode, thus no t_spike
34
+ "eprop_iaf_psc_delta_adapt" , # no ArchivingNode, thus no t_spike
35
+ "eprop_readout" , # no ArchivingNode, thus no t_spike
36
+ "iaf_chxk_2008" , # non-standard spiking conditions
37
+ "izhikevich" , # generating output spike not reliably suppressed even for subthreshold V_m
38
+ ]
25
39
26
- def test_ticket_310 ():
40
+
41
+ def has_Vm_and_Vth (model ):
42
+ params = nest .GetDefaults (model )
43
+ return "V_m" in params and "V_th" in params
44
+
45
+
46
+ relevant_models = [model for model in nest .node_models if model not in skip_list and has_Vm_and_Vth (model )]
47
+
48
+
49
+ @pytest .mark .parametrize ("model" , relevant_models )
50
+ def test_ticket_310 (model ):
27
51
"""
28
52
Regression test for Ticket #310.
29
53
@@ -34,43 +58,14 @@ def test_ticket_310():
34
58
Author: Hans Ekkehard Plesser, 2009-02-11
35
59
"""
36
60
37
- # Use power-of-two resolution to avoid round-off problems
38
- res = 2 ** - 3
39
-
40
- skip_list = [
41
- "iaf_chxk_2008" , # non-standard spiking conditions
42
- "correlospinmatrix_detector" , # not a neuron
43
- "eprop_iaf_bsshslm_2020" , # no ArchivingNode, thus no t_spike
44
- "eprop_iaf_adapt_bsshslm_2020" , # no ArchivingNode, thus no t_spike
45
- "eprop_readout_bsshslm_2020" , # no ArchivingNode, thus no t_spike
46
- "eprop_iaf" , # no ArchivingNode, thus no t_spike
47
- "eprop_iaf_adapt" , # no ArchivingNode, thus no t_spike
48
- "eprop_iaf_psc_delta" , # no ArchivingNode, thus no t_spike
49
- "eprop_iaf_psc_delta_adapt" , # no ArchivingNode, thus no t_spike
50
- "eprop_readout" , # no ArchivingNode, thus no t_spike
51
- ]
52
-
53
- node_models = nest .node_models
61
+ time_resolution = 2 ** - 3 # Use power-of-two resolution to avoid round-off problems
54
62
55
- results = []
63
+ nest .ResetKernel ()
64
+ nest .resolution = time_resolution
56
65
57
- for model in node_models :
58
- if model not in skip_list :
59
- nest .ResetKernel ()
60
- nest .SetKernelStatus ({"resolution" : res })
61
- n = nest .Create (model )
66
+ nrn = nest .Create (model )
67
+ nrn .V_m = nrn .V_th + 15
62
68
63
- # Check if V_m and V_th exist in the model's status
64
- status = nest .GetStatus (n )[0 ]
65
- if "V_m" in status and "V_th" in status :
66
- nest .SetStatus (n , {"V_m" : status ["V_th" ] + 15.0 })
67
- nest .Simulate (res )
68
- t_spike = nest .GetStatus (n , "t_spike" )[0 ]
69
- results .append (t_spike <= res )
70
- else :
71
- results .append (True )
72
- else :
73
- results .append (True )
69
+ nest .Simulate (time_resolution )
74
70
75
- # Check if all entries are true
76
- assert all (results ), "Test failed for one or more models"
71
+ assert 0 < nrn .t_spike <= time_resolution # for precise neurons, < is possible; -1 if never spiked
0 commit comments