From 4317a594c534432677c908b71cf658b7935d5ed9 Mon Sep 17 00:00:00 2001 From: Andrew Rowley Date: Fri, 1 May 2020 11:54:47 +0100 Subject: [PATCH 01/12] Fix for change of interface --- .../plasticity/stdp/weight_dependence/my_weight_impl.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/c_models/src/my_models/plasticity/stdp/weight_dependence/my_weight_impl.c b/c_models/src/my_models/plasticity/stdp/weight_dependence/my_weight_impl.c index dfe6eb4..d1a27c5 100644 --- a/c_models/src/my_models/plasticity/stdp/weight_dependence/my_weight_impl.c +++ b/c_models/src/my_models/plasticity/stdp/weight_dependence/my_weight_impl.c @@ -4,11 +4,10 @@ plasticity_weight_region_data_t *plasticity_weight_region_data; address_t weight_initialise( - address_t address, uint32_t n_synapse_types, - uint32_t *ring_buffer_to_input_buffer_left_shifts) { + address_t address, uint32_t n_synapse_types, REAL *min_weights) { // This can be used to indicate the scaling used on the weights - use(ring_buffer_to_input_buffer_left_shifts); + use(min_weights); log_info("weight_initialise: starting"); log_info("\tSTDP my weight dependence"); From 7174c0fc442171dbf57a192195ae2c6c5713e92a Mon Sep 17 00:00:00 2001 From: Andrew Gait Date: Fri, 31 Jul 2020 14:09:18 +0100 Subject: [PATCH 02/12] Update STDP timing and weight to include new scaling functions --- .../timing_dependence/my_timing_dependence.py | 24 ++++++++++++++++++- .../weight_dependence/my_weight_dependence.py | 6 +++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/python_models8/neuron/plasticity/stdp/timing_dependence/my_timing_dependence.py b/python_models8/neuron/plasticity/stdp/timing_dependence/my_timing_dependence.py index 4392c88..d607a44 100644 --- a/python_models8/neuron/plasticity/stdp/timing_dependence/my_timing_dependence.py +++ b/python_models8/neuron/plasticity/stdp/timing_dependence/my_timing_dependence.py @@ -1,10 +1,14 @@ from spinn_utilities.overrides import overrides from data_specification.enums import DataType -from spinn_front_end_common.utilities.constants import BYTES_PER_WORD +from spinn_front_end_common.utilities.constants import ( + BYTES_PER_WORD, MICRO_TO_MILLISECOND_CONVERSION) from spynnaker.pyNN.models.neuron.plasticity.stdp.timing_dependence import ( AbstractTimingDependence) from spynnaker.pyNN.models.neuron.plasticity.stdp.synapse_structure import ( SynapseStructureWeightOnly) +from spynnaker.pyNN.models.neuron.plasticity.stdp.common import ( + get_exp_lut_array, get_min_lut_value) +from spinn_front_end_common.utilities.globals_variables import get_simulator class MyTimingDependence(AbstractTimingDependence): @@ -13,6 +17,8 @@ class MyTimingDependence(AbstractTimingDependence): "_a_plus", "_my_depression_parameter", "_my_potentiation_parameter", + "_my_depression_data", + "_my_potentiation_data", "_synapse_structure"] NUM_PARAMETERS = 2 @@ -38,6 +44,13 @@ def __init__( self._a_plus = A_plus self._a_minus = A_minus + ts = get_simulator().machine_time_step + ts = ts / MICRO_TO_MILLISECOND_CONVERSION + self._my_potentiation_data = get_exp_lut_array( + ts, self._my_potentiation_parameter) + self._my_depression_data = get_exp_lut_array( + ts, self._my_depression_parameter) + # TODO: Add getters and setters for parameters @property @@ -112,6 +125,15 @@ def write_parameters(self, spec, machine_time_step, weight_scales): def get_parameter_names(self): return ['my_potentiation_parameter', 'my_depression_parameter'] + @overrides(AbstractTimingDependence.minimum_delta) + def minimum_delta(self, max_stdp_spike_delta): + ts = get_simulator().machine_time_step / 1000.0 + return [ + get_min_lut_value(self._my_potentiation_data, ts, + max_stdp_spike_delta), + get_min_lut_value(self._my_depression_data, ts, + max_stdp_spike_delta)] + @property def synaptic_structure(self): """ Get the synaptic structure of the plastic part of the rows diff --git a/python_models8/neuron/plasticity/stdp/weight_dependence/my_weight_dependence.py b/python_models8/neuron/plasticity/stdp/weight_dependence/my_weight_dependence.py index 9323c96..cdb2232 100644 --- a/python_models8/neuron/plasticity/stdp/weight_dependence/my_weight_dependence.py +++ b/python_models8/neuron/plasticity/stdp/weight_dependence/my_weight_dependence.py @@ -116,6 +116,12 @@ def weight_maximum(self): # give to a synapse return self._w_max + @overrides(AbstractWeightDependence.weight_change_minimum) + def weight_change_minimum(self, min_delta): + pot, dep = min_delta + return min(pot * self._my_weight_parameter, + dep * self._my_weight_parameter) + @overrides(AbstractWeightDependence.get_parameter_names) def get_parameter_names(self): return ['w_min', 'w_max', 'my_weight_parameter'] From 92a5e15112ce33c6c1df4b37eec2af11ec959d66 Mon Sep 17 00:00:00 2001 From: Andrew Gait Date: Fri, 31 Jul 2020 15:10:54 +0100 Subject: [PATCH 03/12] Update STDP integration test --- nmt_integration_tests/test_my_model_curr_exp_stdp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nmt_integration_tests/test_my_model_curr_exp_stdp.py b/nmt_integration_tests/test_my_model_curr_exp_stdp.py index 9392cde..8a6aa5c 100644 --- a/nmt_integration_tests/test_my_model_curr_exp_stdp.py +++ b/nmt_integration_tests/test_my_model_curr_exp_stdp.py @@ -55,7 +55,7 @@ def do_run(self): neo = test_pop.get_data('all') sim.end() for _, _, weight in weights: - self.assertEqual(weight, 0.5) + self.assertAlmostEqual(weight, 0.5, places=2) self.check_results(neo, [201, 402, 603, 804]) def test_do_run(self): From b8e32fe6a6475a8bebeedadea1a0c96dfc661c9b Mon Sep 17 00:00:00 2001 From: Andrew Gait Date: Tue, 12 Oct 2021 14:05:26 +0100 Subject: [PATCH 04/12] Add function to get minimum weight --- .../stdp/weight_dependence/my_weight_dependence.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/python_models8/neuron/plasticity/stdp/weight_dependence/my_weight_dependence.py b/python_models8/neuron/plasticity/stdp/weight_dependence/my_weight_dependence.py index caaba52..a95a7a6 100644 --- a/python_models8/neuron/plasticity/stdp/weight_dependence/my_weight_dependence.py +++ b/python_models8/neuron/plasticity/stdp/weight_dependence/my_weight_dependence.py @@ -116,6 +116,15 @@ def weight_maximum(self): # give to a synapse return self._w_max + @property + def weight_minimum(self): + """ The minimum weight that will ever be set in a synapse as a result\ + of this rule + """ + # TODO: update to return the minimum weight that this rule will ever + # give to a synapse + return self._w_min + @overrides(AbstractWeightDependence.weight_change_minimum) def weight_change_minimum(self, min_delta): pot, dep = min_delta From b6e72f324334c0ed4cc1333e23aca07b7aabfe26 Mon Sep 17 00:00:00 2001 From: Andrew Gait Date: Mon, 8 Nov 2021 12:12:39 +0000 Subject: [PATCH 05/12] Missed this when merging... --- .../plasticity/stdp/weight_dependence/my_weight_impl.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/c_models/src/my_models/plasticity/stdp/weight_dependence/my_weight_impl.c b/c_models/src/my_models/plasticity/stdp/weight_dependence/my_weight_impl.c index d1a27c5..3d20284 100644 --- a/c_models/src/my_models/plasticity/stdp/weight_dependence/my_weight_impl.c +++ b/c_models/src/my_models/plasticity/stdp/weight_dependence/my_weight_impl.c @@ -3,11 +3,7 @@ // Global plasticity parameter data plasticity_weight_region_data_t *plasticity_weight_region_data; -address_t weight_initialise( - address_t address, uint32_t n_synapse_types, REAL *min_weights) { - - // This can be used to indicate the scaling used on the weights - use(min_weights); +address_t weight_initialise(address_t address, uint32_t n_synapse_types) { log_info("weight_initialise: starting"); log_info("\tSTDP my weight dependence"); From c51d719049cb98fb4316e35dba0c6b27640df28b Mon Sep 17 00:00:00 2001 From: Andrew Gait Date: Wed, 10 Nov 2021 13:37:30 +0000 Subject: [PATCH 06/12] Update weight impl --- .../plasticity/stdp/weight_dependence/my_weight_impl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/c_models/src/my_models/plasticity/stdp/weight_dependence/my_weight_impl.c b/c_models/src/my_models/plasticity/stdp/weight_dependence/my_weight_impl.c index 3d20284..bb0e558 100644 --- a/c_models/src/my_models/plasticity/stdp/weight_dependence/my_weight_impl.c +++ b/c_models/src/my_models/plasticity/stdp/weight_dependence/my_weight_impl.c @@ -3,7 +3,8 @@ // Global plasticity parameter data plasticity_weight_region_data_t *plasticity_weight_region_data; -address_t weight_initialise(address_t address, uint32_t n_synapse_types) { +address_t weight_initialise( + address_t address, uint32_t n_synapse_types, UNUSED REAL *min_weights) { log_info("weight_initialise: starting"); log_info("\tSTDP my weight dependence"); From d5692594a7167c723df53465a4fc5e18fd1141c6 Mon Sep 17 00:00:00 2001 From: Andrew Gait Date: Fri, 22 Jul 2022 12:41:03 +0100 Subject: [PATCH 07/12] Missed in merge --- .../plasticity/stdp/timing_dependence/my_timing_dependence.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python_models8/neuron/plasticity/stdp/timing_dependence/my_timing_dependence.py b/python_models8/neuron/plasticity/stdp/timing_dependence/my_timing_dependence.py index e49a624..90d967c 100644 --- a/python_models8/neuron/plasticity/stdp/timing_dependence/my_timing_dependence.py +++ b/python_models8/neuron/plasticity/stdp/timing_dependence/my_timing_dependence.py @@ -8,7 +8,7 @@ SynapseStructureWeightOnly) from spynnaker.pyNN.models.neuron.plasticity.stdp.common import ( get_exp_lut_array, get_min_lut_value) -from spinn_front_end_common.utilities.globals_variables import get_simulator +from spynnaker.pyNN.data import SpynnakerDataView class MyTimingDependence(AbstractTimingDependence): @@ -44,7 +44,7 @@ def __init__( self._a_plus = A_plus self._a_minus = A_minus - ts = get_simulator().machine_time_step + ts = SpynnakerDataView.get_simulation_time_step_ms() ts = ts / MICRO_TO_MILLISECOND_CONVERSION self._my_potentiation_data = get_exp_lut_array( ts, self._my_potentiation_parameter) From efc178a5183f3d04465ebd796ef0643757160849 Mon Sep 17 00:00:00 2001 From: Andrew Gait Date: Fri, 22 Jul 2022 13:15:17 +0100 Subject: [PATCH 08/12] Missed this one too --- .../plasticity/stdp/timing_dependence/my_timing_dependence.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python_models8/neuron/plasticity/stdp/timing_dependence/my_timing_dependence.py b/python_models8/neuron/plasticity/stdp/timing_dependence/my_timing_dependence.py index 90d967c..34f7364 100644 --- a/python_models8/neuron/plasticity/stdp/timing_dependence/my_timing_dependence.py +++ b/python_models8/neuron/plasticity/stdp/timing_dependence/my_timing_dependence.py @@ -128,7 +128,7 @@ def get_parameter_names(self): @overrides(AbstractTimingDependence.minimum_delta) def minimum_delta(self, max_stdp_spike_delta): - ts = get_simulator().machine_time_step / 1000.0 + ts = SpynnakerDataView.get_simulation_time_step_ms() return [ get_min_lut_value(self._my_potentiation_data, ts, max_stdp_spike_delta), From caf8014736b7024475f61e522dca3e893fb0ac3a Mon Sep 17 00:00:00 2001 From: Andrew Gait Date: Tue, 22 Nov 2022 13:04:36 +0000 Subject: [PATCH 09/12] Match downstream change in sPyNNaker --- .../plasticity/stdp/weight_dependence/my_weight_impl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/c_models/src/my_models/plasticity/stdp/weight_dependence/my_weight_impl.c b/c_models/src/my_models/plasticity/stdp/weight_dependence/my_weight_impl.c index bb0e558..e294c77 100644 --- a/c_models/src/my_models/plasticity/stdp/weight_dependence/my_weight_impl.c +++ b/c_models/src/my_models/plasticity/stdp/weight_dependence/my_weight_impl.c @@ -4,7 +4,8 @@ plasticity_weight_region_data_t *plasticity_weight_region_data; address_t weight_initialise( - address_t address, uint32_t n_synapse_types, UNUSED REAL *min_weights) { + address_t address, uint32_t n_synapse_types, + UNUSED REAL *min_weights, UNUSED REAL *min_weights_recip) { log_info("weight_initialise: starting"); log_info("\tSTDP my weight dependence"); From ebdc2cbb3eed6864cc0ed21041d3f9934a64d7e6 Mon Sep 17 00:00:00 2001 From: Andrew Gait Date: Wed, 23 Nov 2022 15:06:47 +0000 Subject: [PATCH 10/12] Match change in sPyNNaker --- .../plasticity/stdp/weight_dependence/my_weight_impl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c_models/src/my_models/plasticity/stdp/weight_dependence/my_weight_impl.c b/c_models/src/my_models/plasticity/stdp/weight_dependence/my_weight_impl.c index e294c77..97ec298 100644 --- a/c_models/src/my_models/plasticity/stdp/weight_dependence/my_weight_impl.c +++ b/c_models/src/my_models/plasticity/stdp/weight_dependence/my_weight_impl.c @@ -5,7 +5,7 @@ plasticity_weight_region_data_t *plasticity_weight_region_data; address_t weight_initialise( address_t address, uint32_t n_synapse_types, - UNUSED REAL *min_weights, UNUSED REAL *min_weights_recip) { + UNUSED REAL *min_weights) { log_info("weight_initialise: starting"); log_info("\tSTDP my weight dependence"); From c9511f06742ce6de962a3f2e09ee47ec2dd8f504 Mon Sep 17 00:00:00 2001 From: Andrew Gait Date: Mon, 17 Jul 2023 14:48:31 +0100 Subject: [PATCH 11/12] This is already in milliseconds so no conversion needed --- .../plasticity/stdp/timing_dependence/my_timing_dependence.py | 1 - 1 file changed, 1 deletion(-) diff --git a/python_models8/neuron/plasticity/stdp/timing_dependence/my_timing_dependence.py b/python_models8/neuron/plasticity/stdp/timing_dependence/my_timing_dependence.py index acebcd7..505d394 100644 --- a/python_models8/neuron/plasticity/stdp/timing_dependence/my_timing_dependence.py +++ b/python_models8/neuron/plasticity/stdp/timing_dependence/my_timing_dependence.py @@ -45,7 +45,6 @@ def __init__( self._a_minus = A_minus ts = SpynnakerDataView.get_simulation_time_step_ms() - ts = ts / MICRO_TO_MILLISECOND_CONVERSION self._my_potentiation_data = get_exp_lut_array( ts, self._my_potentiation_parameter) self._my_depression_data = get_exp_lut_array( From 394e4464005a5c38860303e489294ad4001834b4 Mon Sep 17 00:00:00 2001 From: Andrew Gait Date: Mon, 17 Jul 2023 14:52:15 +0100 Subject: [PATCH 12/12] Unused import --- .../plasticity/stdp/timing_dependence/my_timing_dependence.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/python_models8/neuron/plasticity/stdp/timing_dependence/my_timing_dependence.py b/python_models8/neuron/plasticity/stdp/timing_dependence/my_timing_dependence.py index 505d394..6836dd2 100644 --- a/python_models8/neuron/plasticity/stdp/timing_dependence/my_timing_dependence.py +++ b/python_models8/neuron/plasticity/stdp/timing_dependence/my_timing_dependence.py @@ -1,7 +1,6 @@ from spinn_utilities.overrides import overrides from spinn_front_end_common.interface.ds import DataType -from spinn_front_end_common.utilities.constants import ( - BYTES_PER_WORD, MICRO_TO_MILLISECOND_CONVERSION) +from spinn_front_end_common.utilities.constants import BYTES_PER_WORD from spynnaker.pyNN.models.neuron.plasticity.stdp.timing_dependence import ( AbstractTimingDependence) from spynnaker.pyNN.models.neuron.plasticity.stdp.synapse_structure import (