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..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,10 +5,7 @@ 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) { - - // This can be used to indicate the scaling used on the weights - use(ring_buffer_to_input_buffer_left_shifts); + UNUSED REAL *min_weights) { log_info("weight_initialise: starting"); log_info("\tSTDP my weight dependence"); 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 5176a98..96a75af 100644 --- a/nmt_integration_tests/test_my_model_curr_exp_stdp.py +++ b/nmt_integration_tests/test_my_model_curr_exp_stdp.py @@ -54,7 +54,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): 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 122f012..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 @@ -5,6 +5,9 @@ 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 spynnaker.pyNN.data import SpynnakerDataView class MyTimingDependence(AbstractTimingDependence): @@ -13,6 +16,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 +43,12 @@ def __init__( self._a_plus = A_plus self._a_minus = A_minus + ts = SpynnakerDataView.get_simulation_time_step_ms() + 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 @@ -113,6 +124,15 @@ def write_parameters( 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 = SpynnakerDataView.get_simulation_time_step_ms() + 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 723075d..4a4de03 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 @@ -118,6 +118,21 @@ 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 + 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']