From 616722e6567ac398a943aceedf91e2bf4d58de30 Mon Sep 17 00:00:00 2001 From: Maximilian Schmidt Date: Wed, 15 Mar 2017 11:16:43 +0900 Subject: [PATCH 1/2] Fix quantal_stdp_test to make it run with numpy 1.12.0 Convert float variables to integers when using them as indices to numpy arrays and make reshaping of voltmeter more general --- pynest/nest/tests/test_quantal_stp_synapse.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pynest/nest/tests/test_quantal_stp_synapse.py b/pynest/nest/tests/test_quantal_stp_synapse.py index 9e1643b23a..17af0459b3 100644 --- a/pynest/nest/tests/test_quantal_stp_synapse.py +++ b/pynest/nest/tests/test_quantal_stp_synapse.py @@ -101,15 +101,16 @@ def test_QuantalSTPSynapse(self): vm_reference = numpy.array(nest.GetStatus( [voltmeter[0]], 'events')[0]['V_m']) - vm.shape = (n_trials, t_tot) - vm_reference.shape = (n_trials, t_tot) + assert(len(vm) % n_trials == 0) + n_steps = int(len(vm) / n_trials) + vm.shape = (n_trials, n_steps) + vm_reference.shape = (n_trials, n_steps) - vm_mean = numpy.array([numpy.mean(vm[:, i]) - for i in range(int(t_tot))]) - vm_ref_mean = numpy.array( - [numpy.mean(vm_reference[:, i]) for i in range(int(t_tot))]) + vm_mean = numpy.mean(vm, axis=0) + vm_ref_mean = numpy.mean(vm_reference, axis=0) - error = numpy.sqrt((vm_ref_mean[:t_plot] - vm_mean[:t_plot])**2) + error = numpy.sqrt((vm_ref_mean[:int(t_plot)] - + vm_mean[:int(t_plot)])**2) self.assertTrue(numpy.max(error) < 4.0e-4) From c4dfd2491e56bb9038e60239a96c5c3d77a916c4 Mon Sep 17 00:00:00 2001 From: Maximilian Schmidt Date: Thu, 16 Mar 2017 22:02:58 +0900 Subject: [PATCH 2/2] Remove deprecated parameters from test_quantal_stdp_synapse --- pynest/nest/tests/test_quantal_stp_synapse.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/pynest/nest/tests/test_quantal_stp_synapse.py b/pynest/nest/tests/test_quantal_stp_synapse.py index 17af0459b3..bb8a88cbb5 100644 --- a/pynest/nest/tests/test_quantal_stp_synapse.py +++ b/pynest/nest/tests/test_quantal_stp_synapse.py @@ -40,10 +40,6 @@ def test_QuantalSTPSynapse(self): # parameter set for facilitation fac_params = {"U": 0.03, "u": 0.03, "tau_fac": 500., "tau_rec": 200., "weight": 1.} - dep_params = {"U": 0.5, "u": 0.5, "tau_fac": 15., - "tau_rec": 670., "weight": 1.} - lin_params = {"U": 0.3, "u": 0.3, "tau_fac": 330., - "tau_rec": 330., "weight": 1.} # Here we assign the parameter set to the synapse models t1_params = fac_params # for tsodyks2_synapse @@ -78,7 +74,6 @@ def test_QuantalSTPSynapse(self): voltmeter = nest.Create("voltmeter", 2) nest.SetStatus(voltmeter, {"withgid": False, "withtime": True}) - t_plot = 1000. t_tot = 1500. # the following is a dry run trial so that the synapse dynamics is @@ -109,8 +104,7 @@ def test_QuantalSTPSynapse(self): vm_mean = numpy.mean(vm, axis=0) vm_ref_mean = numpy.mean(vm_reference, axis=0) - error = numpy.sqrt((vm_ref_mean[:int(t_plot)] - - vm_mean[:int(t_plot)])**2) + error = numpy.sqrt((vm_ref_mean - vm_mean)**2) self.assertTrue(numpy.max(error) < 4.0e-4)