Repository: spinnakermanchester/spynnaker
Issue: Adding a projection with a OneToOneConnector to an edge with exisiting projections has incorrect weights

When investigating the issue reported at https://github.com/SpiNNakerManchester/sPyNNaker8/issues/217, I found a possibly more serious problem.

Example script:

```
import spynnaker8 as sim

sim.setup(timestep=1.0)

n_neurons = 2

input = sim.Population(n_neurons, sim.IF_curr_exp(), label='input')
receiver = sim.Population(n_neurons, sim.IF_curr_exp(), label='receiver')

conn = sim.AllToAllConnector()
conn2 = sim.OneToOneConnector()

syn = sim.StaticSynapse(weight=2.5, delay=5)
syn2 = sim.StaticSynapse(weight=2.0, delay=5)
proj = sim.Projection(input, receiver, conn, syn,
                      receptor_type="excitatory", label="proj1")
proj2 = sim.Projection(input, receiver, conn2, syn2,
                       receptor_type="inhibitory", label="proj2")

sim.run(200.0)

post_weights_delays = proj.get(["weight", "delay"], format="list")
post_weights_delays2 = proj2.get(["weight", "delay"], format="list")

sim.end()

print('proj', proj)
print('proj2', proj2)
print('post_weights_delays:', post_weights_delays)
print('post_weights_delays2:', post_weights_delays2)
```

The print statements give:

proj projection proj1
proj2 projection proj1
post_weights_delays: [(0, 0, 4., 5.) (1, 1, 4., 5.)]
post_weights_delays2: [(0, 0, 1.25, 5.) (0, 1, 1.25, 5.) (1, 0, 1.25, 5.) (1, 1, 1.25, 5.)]

If the connectors are specified in the other order (i.e. conn = OneToOne, conn2 = AllToAll), then the print statements are:

proj projection proj1
proj2 projection proj1
post_weights_delays: [(0, 0, 2.5, 5.) (1, 1, 2.5, 5.)]
post_weights_delays2: [(0, 0, 2., 5.) (0, 1, 2., 5.) (1, 0, 2., 5.) (1, 1, 2., 5.)]

Clearly something's not right!

Changed files:
spynnaker/pyNN/models/neuron/synaptic_manager.py

diff --git a/spynnaker/pyNN/models/neuron/synaptic_manager.py b/spynnaker/pyNN/models/neuron/synaptic_manager.py
index 953a63b5a0..29febc356b 100644
--- a/spynnaker/pyNN/models/neuron/synaptic_manager.py
+++ b/spynnaker/pyNN/models/neuron/synaptic_manager.py
@@ -587,6 +587,9 @@ class SynapticManager(object):
         # Store a list of synapse info to be generated on the machine
         generate_on_machine = list()
 
+        # Store a full list of synapse info in the order written to blocks
+        synapse_infos = list()
+
         # For each machine edge in the vertex, create a synaptic list
         for machine_edge in in_edges:
             app_edge = graph_mapper.get_application_edge(machine_edge)
@@ -631,6 +634,7 @@ class SynapticManager(object):
                             weight_scales, machine_time_step, rinfo,
                             all_syn_block_sz, block_addr, single_addr,
                             machine_edge=machine_edge)
+                        synapse_infos.append(synapse_info)
 
         # Skip blocks that will be written on the machine, but add them
         # to the master population table
@@ -646,6 +650,11 @@ class SynapticManager(object):
                 post_vertex_slice, master_pop_table_region, rinfo,
                 all_syn_block_sz, block_addr, machine_time_step, app_edge,
                 generator_data)
+            synapse_infos.append(synapse_info)
+
+        # Loop over synapse infos as collected above and assign index in order
+        for n in range(len(synapse_infos)):
+            synapse_infos[n].index = n
 
         self.__poptable_type.finish_master_pop_table(
             spec, master_pop_table_region)