Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix quantal stdp test for numpy #681

Merged
merged 2 commits into from Mar 30, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 7 additions & 12 deletions pynest/nest/tests/test_quantal_stp_synapse.py
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -101,15 +96,15 @@ 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 - vm_mean)**2)
self.assertTrue(numpy.max(error) < 4.0e-4)


Expand Down