anon-iclr-submission/benchname-bug-localization huggingface dataset:
Repository: scaleoutsystems/fedn
Issue: If client has a dash in the name , the status is incorrectly set  to offline in the db 

**Severity**
- [ ] Critical/Blocker (select if the issue makes the application unusable or causes serious data loss)
- [ ] High (select if the issue affects a major feature and there is no workaround or the available workaround is very complex)
- [ ] Medium (select if the issue affects a minor feature or affects a major feature but has an easy enough workaround to not cause any major inconvenience)
- [x] Low (select if the issue doesn't significantly affect the user experience, like minor visual bugs)

**Describe the bug**
A clear and concise description of what the bug is.

**Environment:**
 - OS: [e.g. mac OS]
 - Version: [e.g. macOS Catalina]
 - Browser [e.g. chrome, safari]
 - Version [e.g. 22]

**Reproduction Steps**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Contact Details**
An e-mail address in case we need to contact you for further details regarding this issue.


Changed files:
fedn/fedn/clients/reducer/restservice.py

diff --git a/fedn/fedn/clients/reducer/restservice.py b/fedn/fedn/clients/reducer/restservice.py
index 0c51206..cc04e49 100644
--- a/fedn/fedn/clients/reducer/restservice.py
+++ b/fedn/fedn/clients/reducer/restservice.py
@@ -539,8 +539,8 @@ class ReducerRestService:
                 for client in combiner_info:
                     active_trainers_str = client['active_trainers']
                     active_validators_str = client['active_validators']
-                    active_trainers_str = re.sub('[^a-zA-Z0-9:\\n\\.]', '', active_trainers_str).replace('name:', ' ')
-                    active_validators_str = re.sub('[^a-zA-Z0-9:\\n\\.]', '', active_validators_str).replace('name:', ' ')
+                    active_trainers_str = re.sub('[^a-zA-Z0-9-:\\n\\.]', '', active_trainers_str).replace('name:', ' ')
+                    active_validators_str = re.sub('[^a-zA-Z0-9-:\\n\\.]', '', active_validators_str).replace('name:', ' ')
                     all_active_trainers.extend(' '.join(active_trainers_str.split(" ")).split())
                     all_active_validators.extend(' '.join(active_validators_str.split(" ")).split())
Repository: spinnakermanchester/spynnaker
Issue: get_global_parameters is it dead?

Defined in NeuronRecorder and MyNeuronModelInclInputAndThreshold

Only use found was in a test.

Nuke?

Changed files:
spynnaker/pyNN/models/common/neuron_recorder.py, unittests/model_tests/neuron/test_neuron_recorder.py

diff --git a/spynnaker/pyNN/models/common/neuron_recorder.py b/spynnaker/pyNN/models/common/neuron_recorder.py
index e9815362e9..e91ed0a7cf 100644
--- a/spynnaker/pyNN/models/common/neuron_recorder.py
+++ b/spynnaker/pyNN/models/common/neuron_recorder.py
@@ -30,7 +30,6 @@ from spinn_front_end_common.utilities.constants import (
     BYTES_PER_WORD, MICRO_TO_MILLISECOND_CONVERSION, BITS_PER_WORD)
 from spinn_front_end_common.interface.buffer_management import \\
     recording_utilities
-from spynnaker.pyNN.models.neural_properties import NeuronParameter
 import itertools
 
 logger = FormatAdapter(logging.getLogger(__name__))
@@ -772,17 +771,6 @@ class NeuronRecorder(object):
 
         return numpy.concatenate(data)
 
-    def get_global_parameters(self, vertex_slice):
-        params = []
-        for variable in self.__sampling_rates:
-            params.append(NeuronParameter(
-                self.__sampling_rates[variable], DataType.UINT32))
-        for variable in self.__sampling_rates:
-            n_recording = self._count_recording_per_slice(
-                variable, vertex_slice)
-            params.append(NeuronParameter(n_recording, DataType.UINT8))
-        return params
-
     @property
     def _indexes(self):  # for testing only
         return _ReadOnlyDict(self.__indexes)
diff --git a/unittests/model_tests/neuron/test_neuron_recorder.py b/unittests/model_tests/neuron/test_neuron_recorder.py
index de6af66330..2edf3d8a67 100644
--- a/unittests/model_tests/neuron/test_neuron_recorder.py
+++ b/unittests/model_tests/neuron/test_neuron_recorder.py
@@ -14,7 +14,6 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 from data_specification.enums import DataType
 from unittests.mocks import MockSimulator
-from pacman.model.graphs.common import Slice
 from spinn_front_end_common.utilities import globals_variables
 from spynnaker.pyNN.models.common import NeuronRecorder
 from spynnaker.pyNN.utilities.spynnaker_failed_state import (
@@ -40,12 +39,6 @@ def test_simple_record():
     assert([] == nr.recording_variables)
     nr.set_recording("v", True)
     assert(["v"] == nr.recording_variables)
-    _slice = Slice(0, 50)
-    gps = nr.get_global_parameters(_slice)
-    # 3 rates (index "0" is v)
-    assert (gps[0].get_value() == 1)
-    # 3 n_neurons  (index "3" is v)
-    assert (gps[3].get_value() == _slice.n_atoms)
 
 
 def test_recording_variables():
Repository: spinnakermanchester/spynnaker
Issue: spynnaker or spynakker?

I noticed the ranged dictionaries and lists use spynakker as a prefix instead of spynnaker, is this OK?

https://github.com/SpiNNakerManchester/sPyNNaker/tree/master/spynnaker/pyNN/utilities/ranged

Changed files:
spynnaker/pyNN/models/pynn_population_common.py, spynnaker/pyNN/abstract_spinnaker_common.py, unittests/mocks.py, spynnaker/pyNN/spynnaker_external_device_plugin_manager.py

diff --git a/spynnaker/pyNN/abstract_spinnaker_common.py b/spynnaker/pyNN/abstract_spinnaker_common.py
index 630a0c881e..7555aeff58 100644
--- a/spynnaker/pyNN/abstract_spinnaker_common.py
+++ b/spynnaker/pyNN/abstract_spinnaker_common.py
@@ -273,11 +273,11 @@ class AbstractSpiNNakerCommon(with_metaclass(
         """
         return self.__max_delay
 
-    def add_application_vertex(self, vertex, prefix=None):
+    def add_application_vertex(self, vertex):
         if isinstance(vertex, CommandSender):
             self._command_sender = vertex
 
-        AbstractSpinnakerBase.add_application_vertex(self, vertex, prefix)
+        AbstractSpinnakerBase.add_application_vertex(self, vertex)
 
     @staticmethod
     def _count_unique_keys(commands):
diff --git a/spynnaker/pyNN/models/pynn_population_common.py b/spynnaker/pyNN/models/pynn_population_common.py
index 9c0fec3042..bbe227e7c2 100644
--- a/spynnaker/pyNN/models/pynn_population_common.py
+++ b/spynnaker/pyNN/models/pynn_population_common.py
@@ -120,7 +120,7 @@ class PyNNPopulationCommon(object):
         # add objects to the SpiNNaker control class
         self.__spinnaker_control.add_population(self)
         self.__spinnaker_control.add_application_vertex(
-            self.__vertex, "Population ")
+            self.__vertex)
 
         # initialise common stuff
         self._size = size
diff --git a/spynnaker/pyNN/spynnaker_external_device_plugin_manager.py b/spynnaker/pyNN/spynnaker_external_device_plugin_manager.py
index ad5f442e45..7acbcd20fb 100644
--- a/spynnaker/pyNN/spynnaker_external_device_plugin_manager.py
+++ b/spynnaker/pyNN/spynnaker_external_device_plugin_manager.py
@@ -282,8 +282,8 @@ class SpynnakerExternalDevicePluginManager(object):
         _spinnaker.add_application_edge(edge, partition_id)
 
     @staticmethod
-    def add_application_vertex(vertex, prefix=None):
-        get_simulator().add_application_vertex(vertex, prefix)
+    def add_application_vertex(vertex):
+        get_simulator().add_application_vertex(vertex)
 
     @staticmethod
     def machine_time_step():
diff --git a/unittests/mocks.py b/unittests/mocks.py
index 9491b0d146..035e221421 100644
--- a/unittests/mocks.py
+++ b/unittests/mocks.py
@@ -91,7 +91,7 @@ class MockSimulator(object):
     def add_population(self, pop):
         pass
 
-    def add_application_vertex(self, vertex, prefix=None):
+    def add_application_vertex(self, vertex):
         pass
 
     def verify_not_running(self):
Repository: spinnakermanchester/spynnaker
Issue: SpikeSourceArray with no spikes on a core not recordable

if you have a SpikeSourceArray core with an empty spike list you get a weird error:

 File ".../spynnaker/pyNN/models/common/eieio_spike_recorder.py", line 110, in _process_spike_data
    raise Exception("Can only read spikes as keys")

script:
import spynnaker8 as sim


sim.setup(timestep=1.0)
sim.set_number_of_neurons_per_core(sim.SpikeSourceArray, 1)
input1 = sim.Population(
    3, sim.SpikeSourceArray(spike_times=[[1], [], [3]]), label="input1")
input1.record("spikes")
sim.run(50)

neo = input1.get_data(variables=["spikes"])
spikes = neo.segments[0].spiketrains
print(spikes)

sim.end()


Same happens without the split over cores if the whole array is just []


Changed files:
spynnaker/pyNN/models/common/eieio_spike_recorder.py

diff --git a/spynnaker/pyNN/models/common/eieio_spike_recorder.py b/spynnaker/pyNN/models/common/eieio_spike_recorder.py
index 7afbc02d84..5cdbdf9c81 100644
--- a/spynnaker/pyNN/models/common/eieio_spike_recorder.py
+++ b/spynnaker/pyNN/models/common/eieio_spike_recorder.py
@@ -75,14 +75,16 @@ class EIEIOSpikeRecorder(object):
             placement = placements.get_placement_of_vertex(vertex)
             vertex_slice = graph_mapper.get_slice(vertex)
 
+            n_buffer_times = sum(len(i) for i in vertex.send_buffer_times)
             # Read the spikes
-            raw_spike_data, data_missing = \\
-                buffer_manager.get_data_by_placement(placement, region)
-            if data_missing:
-                missing.append(placement)
-            self._process_spike_data(
-                vertex_slice, raw_spike_data, ms_per_tick,
-                base_key_function(vertex), results)
+            if (n_buffer_times > 0):
+                raw_spike_data, data_missing = \\
+                    buffer_manager.get_data_by_placement(placement, region)
+                if data_missing:
+                    missing.append(placement)
+                self._process_spike_data(
+                    vertex_slice, raw_spike_data, ms_per_tick,
+                    base_key_function(vertex), results)
 
         if missing:
             missing_str = recording_utils.make_missing_string(missing)
Repository: spinnakermanchester/spynnaker
Issue: SpikeSourceArray with no spikes on a core not recordable

if you have a SpikeSourceArray core with an empty spike list you get a weird error:

 File ".../spynnaker/pyNN/models/common/eieio_spike_recorder.py", line 110, in _process_spike_data
    raise Exception("Can only read spikes as keys")

script:
import spynnaker8 as sim


sim.setup(timestep=1.0)
sim.set_number_of_neurons_per_core(sim.SpikeSourceArray, 1)
input1 = sim.Population(
    3, sim.SpikeSourceArray(spike_times=[[1], [], [3]]), label="input1")
input1.record("spikes")
sim.run(50)

neo = input1.get_data(variables=["spikes"])
spikes = neo.segments[0].spiketrains
print(spikes)

sim.end()


Same happens without the split over cores if the whole array is just []


Changed files:
spynnaker/pyNN/models/common/eieio_spike_recorder.py

diff --git a/spynnaker/pyNN/models/common/eieio_spike_recorder.py b/spynnaker/pyNN/models/common/eieio_spike_recorder.py
index 7afbc02d84..2b1ab1b4f6 100644
--- a/spynnaker/pyNN/models/common/eieio_spike_recorder.py
+++ b/spynnaker/pyNN/models/common/eieio_spike_recorder.py
@@ -76,13 +76,23 @@ class EIEIOSpikeRecorder(object):
             vertex_slice = graph_mapper.get_slice(vertex)
 
             # Read the spikes
-            raw_spike_data, data_missing = \\
-                buffer_manager.get_data_by_placement(placement, region)
-            if data_missing:
-                missing.append(placement)
-            self._process_spike_data(
-                vertex_slice, raw_spike_data, ms_per_tick,
-                base_key_function(vertex), results)
+            n_buffer_times = 0
+            if vertex.send_buffer_times is not None:
+                for i in vertex.send_buffer_times:
+                    if hasattr(i, "__len__"):
+                        n_buffer_times += len(i)
+                    else:
+                        # assuming this must be a single integer
+                        n_buffer_times += 1
+
+            if (n_buffer_times > 0):
+                raw_spike_data, data_missing = \\
+                    buffer_manager.get_data_by_placement(placement, region)
+                if data_missing:
+                    missing.append(placement)
+                self._process_spike_data(
+                    vertex_slice, raw_spike_data, ms_per_tick,
+                    base_key_function(vertex), results)
 
         if missing:
             missing_str = recording_utils.make_missing_string(missing)
Repository: spinnakermanchester/spynnaker
Issue: Maximum delay is not checked for random distribution

The maximum delay value doesn't seem to be checked when using a RandomDistribution for delays.  The following fails by crashing the delay extension, but it should fail earlier as the high value provided is already out-of-range.

```
import spynnaker8 as sim
sim.setup(0.1)
pop_a = sim.Population(100, sim.IF_curr_exp(i_offset=5.0))
pop_b = sim.Population(100, sim.IF_curr_exp())
exc_delays = sim.RandomDistribution("normal_clipped", mu=1.5*15, sigma=0.75*15, low=0.1*15, high=14.4*15)
proj = sim.Projection(pop_a, pop_b, sim.AllToAllConnector(), sim.StaticSynapse(delay=exc_delays))
sim.run(1000)
sim.end()
```


Changed files:
spynnaker/pyNN/models/pynn_projection_common.py

diff --git a/spynnaker/pyNN/models/pynn_projection_common.py b/spynnaker/pyNN/models/pynn_projection_common.py
index 480d5670df..ace1280345 100644
--- a/spynnaker/pyNN/models/pynn_projection_common.py
+++ b/spynnaker/pyNN/models/pynn_projection_common.py
@@ -119,11 +119,13 @@ class PyNNProjectionCommon(object):
         post_vertex_max_supported_delay_ms = \\
             post_synaptic_population._get_vertex \\
             .get_maximum_delay_supported_in_ms(machine_time_step)
-        if max_delay > (post_vertex_max_supported_delay_ms +
-                        _delay_extension_max_supported_delay):
+        max_supported_delay_ms = post_vertex_max_supported_delay_ms + \\
+            _delay_extension_max_supported_delay * (machine_time_step / 1000.0)
+        if max_delay > max_supported_delay_ms:
             raise ConfigurationException(
-                "The maximum delay {} for projection is not supported".format(
-                    max_delay))
+                "The maximum delay {} for projection is not supported "
+                "(max supported delay is {})".format(max_delay,
+                                                     max_supported_delay_ms))
 
         if max_delay > user_max_delay / (machine_time_step / 1000.0):
             logger.warning("The end user entered a max delay"
Repository: spinnakermanchester/spynnaker
Issue: additional params should be ingored. not force a blow up

the additional params on populations are meant to be for backends to have whatever they need. if the end user has added one we don't recognise (aka say a nest param) our code will currently blow about incorrect params for create vertex etc. 

the reason it was exposed was draft work for splitter objects
https://github.com/SpiNNakerManchester/sPyNNaker/pull/864

we should be able to just ignore them fully though. making the unexpected stuff redundant. 

Changed files:
spynnaker/pyNN/models/pynn_population_common.py

diff --git a/spynnaker/pyNN/models/pynn_population_common.py b/spynnaker/pyNN/models/pynn_population_common.py
index de06723c12..4f8be9be49 100644
--- a/spynnaker/pyNN/models/pynn_population_common.py
+++ b/spynnaker/pyNN/models/pynn_population_common.py
@@ -100,7 +100,10 @@ class PyNNPopulationCommon(object):
                     "A population cannot have a negative or zero size.")
             population_parameters = dict(model.default_population_parameters)
             if additional_parameters is not None:
-                population_parameters.update(additional_parameters)
+                # check that the additions are suitable. report wrong ones
+                # and ignore
+                population_parameters = self._process_additional_params(
+                    additional_parameters, population_parameters)
             self.__vertex = model.create_vertex(
                 size, label, constraints, **population_parameters)
 
@@ -179,6 +182,17 @@ class PyNNPopulationCommon(object):
             for variable, value in iteritems(initial_values):
                 self._initialize(variable, value)
 
+    @staticmethod
+    def _process_additional_params(
+            additional_parameters, population_parameters):
+        for key in additional_parameters.keys():
+            if key in population_parameters:
+                population_parameters[key] = additional_parameters[key]
+            else:
+                logger.warning(
+                    "additional_parameter {} will be ignored".format(key))
+        return population_parameters
+
     @property
     def first_id(self):
         """ The ID of the first member of the population.
Repository: spinnakermanchester/spynnaker
Issue: FixedProbabilityConnector sometimes overflow

found with 
https://github.com/SpiNNakerManchester/sPyNNaker/blob/master/unittests/model_tests/test_connectors.py
 
in rare but not zero case the asserts 
            assert max(source_histogram) <= max_row_length
            assert max(target_histogram) <= max_col_length
Fail.

Passing a constant seed into FixedProbabilityConnector is NOT a FIX!

We need to decide between
1. have an actual max 
2. Capping to the utility_calls.get_probable_maximum_selected value
3.Capping to the higher of utility_calls.get_probable_maximum_selected or some user specified value.
a. in a config
b. as an extra parameter to the connector

Could be related to:
https://github.com/SpiNNakerManchester/sPyNNaker/issues/585



Changed files:
spynnaker/pyNN/models/neural_projections/connectors/fixed_number_post_connector.py
unittests/model_tests/test_connectors.py

diff --git a/spynnaker/pyNN/models/neural_projections/connectors/fixed_number_post_connector.py b/spynnaker/pyNN/models/neural_projections/connectors/fixed_number_post_connector.py
index c2f1df1e22..4200d5ea4d 100644
--- a/spynnaker/pyNN/models/neural_projections/connectors/fixed_number_post_connector.py
+++ b/spynnaker/pyNN/models/neural_projections/connectors/fixed_number_post_connector.py
@@ -184,7 +184,7 @@ class FixedNumberPostConnector(AbstractGenerateConnectorOnMachine):
         selection_prob = 1.0 / float(synapse_info.n_post_neurons)
         n_connections = utility_calls.get_probable_maximum_selected(
             synapse_info.n_pre_neurons * synapse_info.n_post_neurons,
-            self.__n_post, selection_prob,
+            self.__n_post * synapse_info.n_pre_neurons, selection_prob,
             chance=1.0/100000.0)
         return int(math.ceil(n_connections))
 
diff --git a/unittests/model_tests/test_connectors.py b/unittests/model_tests/test_connectors.py
index b78cc6ab39..2753693ad5 100644
--- a/unittests/model_tests/test_connectors.py
+++ b/unittests/model_tests/test_connectors.py
@@ -22,7 +22,6 @@ from spynnaker.pyNN.models.neural_projections.connectors import (
     FixedNumberPreConnector, FixedNumberPostConnector,
     FixedProbabilityConnector, IndexBasedProbabilityConnector)
 from unittests.mocks import MockSimulator, MockPopulation, MockSynapseInfo
-from unittest import SkipTest
 
 
 @pytest.fixture(scope="module", params=[10, 100])
@@ -176,7 +175,5 @@ def test_connectors(
             print(max_col_length, max(target_histogram), target_histogram)
             print(max_weight, matrix_max_weight, synaptic_block["weight"])
             print(max_delay, matrix_max_delay, synaptic_block["delay"])
-            raise SkipTest(
-                "https://github.com/SpiNNakerManchester/sPyNNaker/issues/587")
     print(connector, n_pre, n_post, n_in_slice, max_row_length,
           max_source, max_col_length, max_target)
Repository: spinnakermanchester/spynnaker
Issue: No checking for round to zero or too big for int16 when scaling STDP parameters

Hi this is an issue that has bitten me a few times in the past so I suggest a fix be added to master.

https://github.com/SpiNNakerManchester/sPyNNaker/blob/ac1d2d2d3eeaab17c1b261ad4bae0d8b11a59bc8/spynnaker/pyNN/models/neuron/plasticity/stdp/weight_dependence/weight_dependence_additive.py#L49-L69

for certain large weight scales (w) and chosen STDP parameters we can produce data spec parameter values that are either rounded to 0 or overflow the range of an int16. Without any warning...

This is a problem as it can lead to very strange simulation results without any reasonable explanations to the PyNN user.

I have implemented a potential fix for an additive weight dependence in:

https://github.com/SpiNNakerManchester/sPyNNaker/blob/644afd8ee7d422541a2920ce3bb0d25777dabd47/spynnaker/pyNN/models/neuron/plasticity/stdp/weight_dependence/weight_dependence_additive.py#L49-L91




Changed files:
spynnaker/pyNN/models/spike_source/spike_source_array_vertex.py

diff --git a/spynnaker/pyNN/models/spike_source/spike_source_array_vertex.py b/spynnaker/pyNN/models/spike_source/spike_source_array_vertex.py
index 3eb8ff2051..a857b18b76 100644
--- a/spynnaker/pyNN/models/spike_source/spike_source_array_vertex.py
+++ b/spynnaker/pyNN/models/spike_source/spike_source_array_vertex.py
@@ -98,6 +98,15 @@ class SpikeSourceArrayVertex(
 
         """
         time_step = self.get_spikes_sampling_interval()
+        current_time = globals_variables.get_simulator().get_current_time()
+        # warn the user if they are asking for a spike time out of range
+        for n in range(len(spike_times)):
+            if spike_times[n] < current_time:
+                logger.warning("A spike time of {} was specified for the "
+                               "SpikeSourceArray {} that is "
+                               "lower than the current time {} - this "
+                               "will be ignored.".format(
+                                   float(spike_times[n]), self, current_time))
         self.send_buffer_times = _send_buffer_times(spike_times, time_step)
         self._spike_times = spike_times
Repository: spinnakermanchester/spynnaker
Issue: master pop table sdram requirements are wrong. 

the fudge factor is applied to the exact cost model in the following lines:

https://github.com/SpiNNakerManchester/sPyNNaker/blob/master/spynnaker/pyNN/models/neuron/master_pop_table.py#L173-L177

But as this is meant to be the EXACT sdram, a fudge factor here makes no sense. 

But when it is removed the DSE errors on the master pop region for not having enough space. So there is obviously some other SDRAM cost that's not being taken into account that this fudge factor is hiding. 

It was found when augmenting the master pop table for self partition splitter objects. But is showable in master as well. 

Changed files:
spynnaker/pyNN/models/neuron/master_pop_table.py, spynnaker/pyNN/models/neuron/synaptic_matrices.py

diff --git a/spynnaker/pyNN/models/neuron/master_pop_table.py b/spynnaker/pyNN/models/neuron/master_pop_table.py
index 3f0294e23f..c2b9c5f6fa 100644
--- a/spynnaker/pyNN/models/neuron/master_pop_table.py
+++ b/spynnaker/pyNN/models/neuron/master_pop_table.py
@@ -153,9 +153,6 @@ _EXTRA_INFO_ENTRY_SIZE_BYTES = ctypes.sizeof(_ExtraInfoCType)
 # Base size - 2 words for size of table and address list
 _BASE_SIZE_BYTES = 8
 
-# Over-scale of estimate for safety
-_OVERSCALE = 2
-
 # A ctypes pointer to a uint32
 _UINT32_PTR = ctypes.POINTER(ctypes.c_uint32)
 
diff --git a/spynnaker/pyNN/models/neuron/synaptic_matrices.py b/spynnaker/pyNN/models/neuron/synaptic_matrices.py
index 8f1bb102da..d68e7ff698 100644
--- a/spynnaker/pyNN/models/neuron/synaptic_matrices.py
+++ b/spynnaker/pyNN/models/neuron/synaptic_matrices.py
@@ -33,9 +33,6 @@ from .key_space_tracker import KeySpaceTracker
 from .synaptic_matrix_app import SynapticMatrixApp
 
 
-# Amount to scale synapse SDRAM estimate by to make sure the synapses fit
-_SYNAPSE_SDRAM_OVERSCALE = 1.1
-
 # 1 for n_edges
 # 2 for post_vertex_slice.lo_atom, post_vertex_slice.n_atoms
 # 1 for n_synapse_types
Repository: spinnakermanchester/spynnaker
Issue: Allow python lists/arrays in KernelConnector

Currently the arrays passed in to a KernelConnector need to be converted into a numpy array by the user first, see https://github.com/SpiNNakerManchester/sPyNNaker/blob/e2c3d66ca2831e2e4ef239eca07d00cc88a17c35/spynnaker/pyNN/models/neural_projections/connectors/kernel_connector.py#L229  
This seems unnecessary so I suggest it gets fixed so that an array (of arrays) can be passed in as well.

Changed files:
spynnaker_integration_tests/test_connectors/test_kernel_connector.py, spynnaker/pyNN/models/neural_projections/connectors/kernel_connector.py

diff --git a/spynnaker/pyNN/models/neural_projections/connectors/kernel_connector.py b/spynnaker/pyNN/models/neural_projections/connectors/kernel_connector.py
index bf42de30c3..86980664de 100644
--- a/spynnaker/pyNN/models/neural_projections/connectors/kernel_connector.py
+++ b/spynnaker/pyNN/models/neural_projections/connectors/kernel_connector.py
@@ -221,6 +221,8 @@ class KernelConnector(AbstractGenerateConnectorOnMachine,
         """
         if vals is None:
             return None
+        if isinstance(vals, list):
+            vals = numpy.asarray(vals)
         krn_size = self._kernel_h * self._kernel_w
         krn_shape = (self._kernel_h, self._kernel_w)
         if isinstance(vals, RandomDistribution):
@@ -232,11 +234,11 @@ class KernelConnector(AbstractGenerateConnectorOnMachine,
                 vals.shape[HEIGHT] == self._kernel_h and
                 vals.shape[WIDTH] == self._kernel_w):
             return vals.view(ConvolutionKernel)
-        # TODO: make this error more descriptive?
         raise SpynnakerException(
             "Error generating KernelConnector values; if you have supplied "
             "weight and/or delay kernel then ensure they are the same size "
-            "as specified by the shape kernel values.")
+            "as specified by the shape kernel values (height: "
+            f"{self._kernel_h} and width: {self._kernel_w}).")
 
     def __compute_statistics(
             self, weights, delays, post_vertex_slice, n_pre_neurons):
diff --git a/spynnaker_integration_tests/test_connectors/test_kernel_connector.py b/spynnaker_integration_tests/test_connectors/test_kernel_connector.py
index 6114a2d614..1659a06d2a 100644
--- a/spynnaker_integration_tests/test_connectors/test_kernel_connector.py
+++ b/spynnaker_integration_tests/test_connectors/test_kernel_connector.py
@@ -45,11 +45,10 @@ class TestKernelConnector(BaseTestCase):
         delay_list = [[20.0 if ((a + b) % 2 == 1) else 10.0
                        for a in range(ksw)] for b in range(ksh)]
         weight_kernel = np.asarray(weight_list)
-        delay_kernel = np.asarray(delay_list)
 
         kernel_connector = sim.KernelConnector(
             shape_pre, shape_post, shape_kernel,
-            weight_kernel=weight_kernel, delay_kernel=delay_kernel,
+            weight_kernel=weight_kernel, delay_kernel=delay_list,
             pre_sample_steps_in_post=pre_step,
             post_sample_steps_in_pre=post_step,
             pre_start_coords_in_post=pre_start,
Repository: spinnakermanchester/spynnaker
Issue: Problem with injection context when using set after run with IZK_cond_exp

There seems to be an issue when using e.g. pop.set('i_offset', 1) when pop uses the IZK_cond_exp model.

Changed files:
spynnaker/pyNN/models/neuron/neuron_models/abstract_neuron_model.py

diff --git a/spynnaker/pyNN/models/neuron/neuron_models/abstract_neuron_model.py b/spynnaker/pyNN/models/neuron/neuron_models/abstract_neuron_model.py
index cd9e384897..08d32c67dc 100644
--- a/spynnaker/pyNN/models/neuron/neuron_models/abstract_neuron_model.py
+++ b/spynnaker/pyNN/models/neuron/neuron_models/abstract_neuron_model.py
@@ -2,7 +2,7 @@ from six import add_metaclass
 
 from spinn_utilities.abstract_base import AbstractBase, abstractmethod
 
-from spynnaker.pyNN.utilities import utility_calls
+_BYTES_PER_PARAMETER = 4
 
 
 @add_metaclass(AbstractBase)
@@ -77,7 +77,7 @@ class AbstractNeuronModel(object):
         :return: The SDRAM usage
         :rtype: int
         """
-        return self.get_n_neural_parameters() * 4
+        return self.get_n_neural_parameters() * _BYTES_PER_PARAMETER
 
     def get_dtcm_usage_per_neuron_in_bytes(self):
         """ Get the DTCM usage of this neuron model in bytes
@@ -85,7 +85,7 @@ class AbstractNeuronModel(object):
         :return: The DTCM usage
         :rtype: int
         """
-        return self.get_n_neural_parameters() * 4
+        return self.get_n_neural_parameters() * _BYTES_PER_PARAMETER
 
     def get_sdram_usage_for_global_parameters_in_bytes(self):
         """ Get the SDRAM usage of the global parameters in bytes
@@ -93,8 +93,7 @@ class AbstractNeuronModel(object):
         :return: The SDRAM usage
         :rtype: int
         """
-        global_parameters = self.get_global_parameters()
-        return utility_calls.get_parameters_size_in_bytes(global_parameters)
+        return self.get_n_global_parameters() * _BYTES_PER_PARAMETER
 
     def set_global_parameters(self, parameters):
         """ Sets any global parameters.  Override if there are changing\\