-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1110 from SpiNNakerManchester/get_weight_in_from_…
…list Make return value from projection.get(.., 'list') usable in FromListConnector
- Loading branch information
Showing
6 changed files
with
119 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
spynnaker_integration_tests/test_connectors/test_use_projection_get_in_from_list.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Copyright (c) 2017-2019 The University of Manchester | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
import spynnaker8 as sim | ||
from spinnaker_testbase import BaseTestCase | ||
|
||
|
||
class TestUseProjectionGetInFromList(BaseTestCase): | ||
|
||
def do_run(self): | ||
sim.setup(timestep=1.0) | ||
sim.set_number_of_neurons_per_core(sim.IF_curr_exp, 5) | ||
|
||
n_neurons = 10 | ||
weights = 0.5 | ||
delays = 7 | ||
n_pre = 2 | ||
|
||
p1 = sim.Population(n_neurons, sim.IF_curr_exp, {}, label='pop1_1') | ||
p2 = sim.Population(n_neurons, sim.IF_curr_exp, {}, label='pop1_2') | ||
|
||
connector_pre = sim.FixedNumberPreConnector(n_pre) | ||
|
||
proj_pre = sim.Projection(p1, p2, connector_pre, | ||
synapse_type=sim.StaticSynapse( | ||
weight=weights, delay=delays)) | ||
|
||
sim.run(10) | ||
|
||
weights_delays_pre = proj_pre.get(["weight", "delay"], "list") | ||
|
||
sim.end() | ||
|
||
sim.setup(timestep=1.0, min_delay=1.0, max_delay=144.0) | ||
sim.set_number_of_neurons_per_core(sim.IF_curr_exp, 5) | ||
|
||
p11 = sim.Population(n_neurons, sim.IF_curr_exp, {}, label='pop2_1') | ||
p22 = sim.Population(n_neurons, sim.IF_curr_exp, {}, label='pop2_2') | ||
|
||
fromlist_conn = sim.FromListConnector(weights_delays_pre) | ||
|
||
proj_new = sim.Projection(p11, p22, fromlist_conn) | ||
|
||
sim.run(10) | ||
|
||
weights_delays_out = proj_new.get(["weight", "delay"], "list") | ||
|
||
sim.end() | ||
|
||
self.assertCountEqual(weights_delays_pre, weights_delays_out) | ||
|
||
def test_use_projection_get_in_from_list(self): | ||
self.runsafe(self.do_run) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters