|
| 1 | +# -*- coding: utf-8 -*- |
| 2 | +# |
| 3 | +# test_issue_708.py |
| 4 | +# |
| 5 | +# This file is part of NEST. |
| 6 | +# |
| 7 | +# Copyright (C) 2004 The NEST Initiative |
| 8 | +# |
| 9 | +# NEST is free software: you can redistribute it and/or modify |
| 10 | +# it under the terms of the GNU General Public License as published by |
| 11 | +# the Free Software Foundation, either version 2 of the License, or |
| 12 | +# (at your option) any later version. |
| 13 | +# |
| 14 | +# NEST is distributed in the hope that it will be useful, |
| 15 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | +# GNU General Public License for more details. |
| 18 | +# |
| 19 | +# You should have received a copy of the GNU General Public License |
| 20 | +# along with NEST. If not, see <http://www.gnu.org/licenses/>. |
| 21 | +""" |
| 22 | +Regression test for Issue #708 (GitHub). |
| 23 | +
|
| 24 | +This test ensures that CopyModel works with connection types that use secondary events. |
| 25 | +""" |
| 26 | + |
| 27 | +import nest |
| 28 | +import pytest |
| 29 | + |
| 30 | + |
| 31 | +@pytest.mark.skipif_without_gsl |
| 32 | +def test_copymodel_with_secondary_events(): |
| 33 | + """ |
| 34 | + Test that CopyModel works with connection types that use secondary events. |
| 35 | + """ |
| 36 | + nest.ResetKernel() |
| 37 | + |
| 38 | + neuron_in = nest.Create("hh_psc_alpha_gap") |
| 39 | + neuron_out1 = nest.Create("hh_psc_alpha_gap") |
| 40 | + neuron_out2 = nest.Create("hh_psc_alpha_gap") |
| 41 | + vm1 = nest.Create("voltmeter") |
| 42 | + vm2 = nest.Create("voltmeter") |
| 43 | + |
| 44 | + nest.CopyModel("gap_junction", "syn0") |
| 45 | + nest.CopyModel("gap_junction", "syn1") |
| 46 | + |
| 47 | + nest.SetStatus(neuron_in, {"I_e": 200.0}) |
| 48 | + nest.SetStatus(vm1, {"interval": 1.0}) |
| 49 | + nest.SetStatus(vm2, {"interval": 1.0}) |
| 50 | + |
| 51 | + nest.Connect( |
| 52 | + neuron_in, |
| 53 | + neuron_out1, |
| 54 | + conn_spec={"rule": "one_to_one", "make_symmetric": True}, |
| 55 | + syn_spec={"synapse_model": "syn0", "weight": 10.0}, |
| 56 | + ) |
| 57 | + |
| 58 | + nest.Connect( |
| 59 | + neuron_in, |
| 60 | + neuron_out2, |
| 61 | + conn_spec={"rule": "one_to_one", "make_symmetric": True}, |
| 62 | + syn_spec={"synapse_model": "syn1", "weight": 10.0}, |
| 63 | + ) |
| 64 | + |
| 65 | + nest.Connect(vm1, neuron_out1) |
| 66 | + nest.Connect(vm2, neuron_out2) |
| 67 | + |
| 68 | + nest.Simulate(10.0) |
| 69 | + |
| 70 | + # Check that neuron_out1 received the input |
| 71 | + events_vm1 = nest.GetStatus(vm1, "events")[0] |
| 72 | + V_m_vm1 = events_vm1["V_m"] |
| 73 | + assert V_m_vm1[8] > -6.960401e01 |
| 74 | + |
| 75 | + # Check that neuron_out2 received the input |
| 76 | + events_vm2 = nest.GetStatus(vm2, "events")[0] |
| 77 | + V_m_vm2 = events_vm2["V_m"] |
| 78 | + assert V_m_vm2[8] > -6.960401e01 |
0 commit comments