Skip to content

Commit

Permalink
Fix arguments and test
Browse files Browse the repository at this point in the history
  • Loading branch information
rowleya committed Oct 10, 2024
1 parent 6ef66bd commit 645f211
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 17 deletions.
10 changes: 3 additions & 7 deletions spynnaker/pyNN/models/spike_source/spike_source_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from pacman.model.partitioner_splitters import AbstractSplitterCommon
from spynnaker.pyNN.models.abstract_pynn_model import AbstractPyNNModel
from spynnaker.pyNN.models.common.types import Spikes
from spynnaker.pyNN.utilities.constants import SPIKE_PARTITION_ID
from .spike_source_array_vertex import SpikeSourceArrayVertex


Expand All @@ -26,8 +25,7 @@ class SpikeSourceArray(AbstractPyNNModel):
Model that creates a Spike Source Array Vertex
"""
default_population_parameters = {
"splitter": None, "n_colour_bits": None,
"partition_id": SPIKE_PARTITION_ID}
"splitter": None, "n_colour_bits": None}

def __init__(self, spike_times: Optional[Spikes] = None):
if spike_times is None:
Expand All @@ -39,20 +37,18 @@ def __init__(self, spike_times: Optional[Spikes] = None):
def create_vertex(
self, n_neurons: int, label: str, *,
splitter: Optional[AbstractSplitterCommon] = None,
n_colour_bits: Optional[int] = None,
partition_id: str = SPIKE_PARTITION_ID) -> SpikeSourceArrayVertex:
n_colour_bits: Optional[int] = None) -> SpikeSourceArrayVertex:
"""
:param splitter:
:type splitter:
~pacman.model.partitioner_splitters.AbstractSplitterCommon or None
:param int n_colour_bits:
:param str partition_id:
"""
# pylint: disable=arguments-differ
max_atoms = self.get_model_max_atoms_per_dimension_per_core()
return SpikeSourceArrayVertex(
n_neurons, self.__spike_times, label, max_atoms, self, splitter,
n_colour_bits, partition_id)
n_colour_bits)

@property
def _spike_times(self) -> Spikes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
"port": None,
"virtual_key": None,
"reserve_reverse_ip_tag": False,
"splitter": None,
"partition_id": SPIKE_PARTITION_ID
"splitter": None
}


Expand All @@ -42,19 +41,18 @@ def create_vertex(
self, n_neurons: int, label: str, *,
port: Optional[int] = None, virtual_key: Optional[int] = None,
reserve_reverse_ip_tag: bool = False,
splitter: Optional[AbstractSplitterCommon] = None,
partition_id: str = SPIKE_PARTITION_ID) -> SpikeInjectorVertex:
splitter: Optional[AbstractSplitterCommon] = None) \
-> SpikeInjectorVertex:
"""
:param int port:
:param int virtual_key:
:param bool reserve_reverse_ip_tag:
:param splitter:
:type splitter:
~pacman.model.partitioner_splitters.AbstractSplitterCommon or None
:param str partition_id:
"""
# pylint: disable=arguments-differ
max_atoms_per_core = self.get_model_max_atoms_per_dimension_per_core()
return SpikeInjectorVertex(
n_neurons, label, port, virtual_key,
reserve_reverse_ip_tag, splitter, max_atoms_per_core, partition_id)
reserve_reverse_ip_tag, splitter, max_atoms_per_core)
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,18 @@ def do_run(self):
sim.setup(1.0)
source_1 = sim.Population(1, sim.SpikeSourceArray(spike_times=[0]))
source_2 = sim.Population(
1, sim.SpikeSourceArray(spike_times=[5]), partition_id="Test")
1, sim.SpikeSourceArray(spike_times=[5]))
injector = sim.Population(
1, sim.external_devices.SpikeInjector(
database_notify_port_num=conn.local_port), label="Inject",
partition_id="Inject")
database_notify_port_num=conn.local_port), label="Inject")
target = sim.Population(3, sim.IF_curr_exp())
target.record("spikes")
proj_1 = sim.Projection(
source_1, target, sim.FromListConnector([(0, 0)]),
synapse_type=sim.StaticSynapse(weight=5.0))
proj_2 = sim.Projection(
source_2, target, sim.FromListConnector([(0, 1)]),
synapse_type=sim.StaticSynapse(weight=5.0), partition_id="Bacon")
synapse_type=sim.StaticSynapse(weight=5.0), partition_id="Test")
proj_3 = sim.Projection(
injector, target, sim.FromListConnector([(0, 2)]),
synapse_type=sim.StaticSynapse(weight=5.0), partition_id="Inject")
Expand Down

0 comments on commit 645f211

Please sign in to comment.