19
19
# You should have received a copy of the GNU General Public License
20
20
# along with NEST. If not, see <http://www.gnu.org/licenses/>.
21
21
22
- """
23
- This test creates a multisynapse neuron and first checks if time constants
24
- can be set correctly.
25
-
26
- Afterwards, it simulates the mutisynapse neuron with n (n=4) different time
27
- constants and records the neuron's synaptic current. At the same time, it simulates
28
- n (n=4) single synapse neurons with according parameters.
29
- At the end, it compares the multisynapse neuron currents with each according single
30
- synapse current.
31
- """
32
-
33
22
import nest
34
23
import numpy as np
35
24
import pytest
36
25
37
26
38
27
@pytest .mark .skipif_missing_gsl
39
28
class TestAeifCondAlphaMultisynapse :
40
- def test_single_multi_synapse_equivalence (self , have_plotting ):
41
- simulation_t = 2500.0 # ms
29
+ r"""
30
+ This test creates a multisynapse neuron and first checks if time constants
31
+ can be set correctly.
32
+
33
+ Afterwards, it simulates the mutisynapse neuron with n (n=4) different time
34
+ constants and records the neuron's synaptic current. At the same time, it simulates
35
+ n (n=4) single synapse neurons with according parameters.
36
+ At the end, it compares the multisynapse neuron currents with each according single
37
+ synapse current.
38
+ """
42
39
43
- dt = 0.1
40
+ def test_single_multi_synapse_equivalence (self , have_plotting , report_dir ):
41
+ simulation_t = 2500.0 # total simulation time [ms]
44
42
45
- E_ex = 0.0 # mV
46
- E_in = - 85.0 # mV
47
- V_peak = 0.0
43
+ dt = 0.1 # time step [ms]
44
+
45
+ E_ex = 0.0 # excitatory reversal potential [mV]
46
+ E_in = - 85.0 # inhibitory reversal potential [mV]
47
+ V_peak = 0.0 # spike detection threshold [mV]
48
48
a = 4.0
49
49
b = 80.5
50
- tau_syn = [0.2 , 0.5 , 1.0 , 10.0 ]
51
- weight = [1.0 , 5.0 , 1.0 , - 1.0 ]
52
- E_rev = [E_ex , E_ex , E_ex , E_in ]
53
- spike_time = 1.0
50
+ tau_syn = [0.2 , 0.5 , 1.0 , 10.0 ] # synaptic times [ms]
51
+ weight = [1.0 , 5.0 , 1.0 , - 1.0 ] # synaptic weights
52
+ E_rev = [E_ex , E_ex , E_ex , E_in ] # synaptic reversal potentials [mV]
53
+ spike_time = 1.0 # time at which the single spike occurs [ms]
54
54
55
55
# The delays have to be ordered and needs enough space between them to avoid one PSC from affecting the next
56
56
delays = [1.0 , 500.0 , 1500.0 , 2250.0 ] # ms
@@ -147,12 +147,14 @@ def test_single_multi_synapse_equivalence(self, have_plotting):
147
147
_ax .legend ()
148
148
149
149
ax [- 1 ].semilogy (multisynapse_neuron_vm .get ("events" )["times" ], error , label = "errror" )
150
- fig .savefig ("test_aeif_cond_alpha_multisynapse.png" )
150
+
151
+ fig .savefig (report_dir / "test_aeif_cond_alpha_multisynapse.png" )
151
152
152
153
# compare with a large tolerance because previous PSPs affect subsequent PSPs in the multisynapse neuron
153
154
np .testing .assert_allclose (error , 0 , atol = 1e-6 )
154
155
155
156
def test_recordables (self ):
157
+ r"""Test that the right number of recordables are created when setting ``record_from``."""
156
158
nest .ResetKernel ()
157
159
158
160
nrn = nest .Create ("aeif_cond_alpha_multisynapse" )
@@ -166,7 +168,7 @@ def test_recordables(self):
166
168
assert len (nrn .recordables ) == 3
167
169
168
170
def test_resize_recordables (self ):
169
- """Test that the recordable g's change when changing the number of receptor ports"""
171
+ r """Test that the recordable g's change when changing the number of receptor ports"""
170
172
nest .ResetKernel ()
171
173
172
174
E_rev1 = [0.0 , 0.0 , - 85.0 ]
@@ -185,8 +187,8 @@ def test_resize_recordables(self):
185
187
nrn .set ({"E_rev" : E_rev3 , "tau_syn" : tau_syn3 })
186
188
assert len (nrn .recordables ) == 6
187
189
188
- def test_g_alpha_dynamics (self , have_plotting ):
189
- """Test that g has alpha function dynamics"""
190
+ def test_g_alpha_dynamics (self , have_plotting , report_dir ):
191
+ r """Test that g has alpha function dynamics"""
190
192
191
193
dt = 0.1 # time step
192
194
@@ -196,7 +198,7 @@ def test_g_alpha_dynamics(self, have_plotting):
196
198
E_rev = [0.0 , 0.0 , - 85.0 , 20.0 ] # synaptic reversal potentials
197
199
tau_syn = [40.0 , 20.0 , 30.0 , 25.0 ] # synaptic time constants
198
200
weight = [1.0 , 0.5 , 2.0 , 1.0 ] # synaptic weights
199
- delays = [1.0 , 3.0 , 10.0 , 10.0 ] # ms - synaptic delays
201
+ delays = [1.0 , 3.0 , 10.0 , 10.0 ] # synaptic delays [ms]
200
202
spike_time = 10.0 # time at which the single spike occurs
201
203
total_t = 500.0 # total simulation time
202
204
@@ -258,6 +260,6 @@ def alpha_function(t, W=1.0, tau=1.0, t0=0.0):
258
260
for _ax in ax :
259
261
_ax .legend ()
260
262
261
- fig .savefig ("test_aeif_cond_alpha_multisynapse_psc_shape_ " + str ( i ) + " .png" )
263
+ fig .savefig (report_dir / f"test_aeif_cond_alpha_multisynapse_psc_shape_ { i } .png" )
262
264
263
265
np .testing .assert_allclose (sim_g , theo_g )
0 commit comments