Skip to content

Commit

Permalink
Merge branch 'master' into flake8_tidy_up
Browse files Browse the repository at this point in the history
  • Loading branch information
rowleya authored May 6, 2021
2 parents 79db5f7 + 0fc70fa commit c55c25f
Show file tree
Hide file tree
Showing 20 changed files with 298 additions and 458 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,6 @@ class MachineMunichMotorDevice(

#: The name of the provenance item saying that packets were lost.
INPUT_BUFFER_FULL_NAME = "Times_the_input_buffer_lost_packets"
_INPUT_BUFFER_FULL_MESSAGE = (
"The input buffer for {} on {}, {}, {} lost packets on {} "
"occasions. This is often a sign that the system is running "
"too quickly for the number of neurons per core. Please "
"increase the timer_tic or time_scale_factor or decrease the "
"number of neurons per core.")

def __init__(
self, speed, sample_time, update_time, delay_time,
Expand Down Expand Up @@ -127,30 +121,20 @@ def _provenance_region_id(self):
def _n_additional_data_items(self):
return self._PROVENANCE_ELEMENTS

@overrides(ProvidesProvenanceDataFromMachineImpl.
get_provenance_data_from_machine)
def get_provenance_data_from_machine(self, transceiver, placement):
# get prov data
provenance_data = self._read_provenance_data(transceiver, placement)
# get system level prov
provenance_items = self._read_basic_provenance_items(
provenance_data, placement)
# get left over prov
provenance_data = self._get_remaining_provenance_data_items(
provenance_data)
# stuff for making prov data items
label, x, y, p, names = self._get_placement_details(placement)

# get the only app level prov item
n_buffer_overflows = provenance_data[0]

# build it
provenance_items.append(ProvenanceDataItem(
self._add_name(names, self.INPUT_BUFFER_FULL_NAME),
n_buffer_overflows, report=n_buffer_overflows > 0,
message=self._INPUT_BUFFER_FULL_MESSAGE.format(
label, x, y, p, n_buffer_overflows)))
return provenance_items
@overrides(
ProvidesProvenanceDataFromMachineImpl.parse_extra_provenance_items)
def parse_extra_provenance_items(
self, label, names, provenance_data):
n_buffer_overflows, = provenance_data

yield ProvenanceDataItem(
names + [self.INPUT_BUFFER_FULL_NAME], n_buffer_overflows,
(n_buffer_overflows > 0),
f"The input buffer for {label} lost packets on "
f"{n_buffer_overflows} occasions. "
"This is often a sign that the system is running too quickly for "
"the number of neurons per core. Please increase the timer_tic "
"or time_scale_factor or decrease the number of neurons per core.")

@inject_items({
"routing_info": "MemoryRoutingInfos",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -585,18 +585,19 @@ def get_provenance_data(self, synapse_info):
"""
:param SynapseInformation synapse_info:
:rtype:
list(~spinn_front_end_common.utilities.utility_objs.ProvenanceDataItem)
iterable(~spinn_front_end_common.utilities.utility_objs.ProvenanceDataItem)
"""
name = "connector_{}_{}_{}".format(
synapse_info.pre_population.label,
synapse_info.post_population.label, self.__class__.__name__)
# Convert to native Python integer; provenance system assumption
ncd = self.__n_clipped_delays.item()
return [ProvenanceDataItem(
yield ProvenanceDataItem(
[name, "Times_synaptic_delays_got_clipped"], ncd,
report=(ncd > 0), message=self._CLIPPED_MSG.format(
self.__class__.__name__, synapse_info.pre_population.label,
synapse_info.post_population.label, self.__min_delay, ncd))]
synapse_info.post_population.label, self.__min_delay,
ncd))

@property
def safe(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def get_provenance_data(self, pre_population_label, post_population_label):
:param str pre_population_label: label of pre.
:param str post_population_label: label of post.
:rtype:
list(~spinn_front_end_common.utilities.utility_objs.ProvenanceDataItem)
iterable(~spinn_front_end_common.utilities.utility_objs.ProvenanceDataItem)
"""
# pylint: disable=unused-argument
return list()
return []
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
BYTES_PER_WORD, MICRO_TO_MILLISECOND_CONVERSION)
from spynnaker.pyNN.models.neuron.plasticity.stdp.common import (
get_exp_lut_array)
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.timing_dependence import (
AbstractTimingDependence)
from spynnaker.pyNN.models.neuron.plasticity.stdp.synapse_structure import (
SynapseStructureWeightOnly)
from spinn_front_end_common.utilities.globals_variables import get_simulator


Expand All @@ -44,6 +44,7 @@ class TimingDependencePfisterSpikeTriplet(AbstractTimingDependence):
"__tau_y_data",
"__a_plus",
"__a_minus"]
__PARAM_NAMES = ('tau_plus', 'tau_minus', 'tau_x', 'tau_y')

# noinspection PyPep8Naming
def __init__(self, tau_plus, tau_minus, tau_x, tau_y, A_plus, A_minus):
Expand Down Expand Up @@ -189,4 +190,4 @@ def synaptic_structure(self):

@overrides(AbstractTimingDependence.get_parameter_names)
def get_parameter_names(self):
return ['tau_plus', 'tau_minus', 'tau_x', 'tau_y']
return self.__PARAM_NAMES
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ class TimingDependenceRecurrent(AbstractTimingDependence):
"__synapse_structure",
"__a_plus",
"__a_minus"]
__PARAM_NAMES = (
'accumulator_depression', 'accumulator_potentiation',
'mean_pre_window', 'mean_post_window', 'dual_fsm')

default_parameters = {
'accumulator_depression': -6, 'accumulator_potentiation': 6,
Expand Down Expand Up @@ -187,5 +190,4 @@ def synaptic_structure(self):

@overrides(AbstractTimingDependence.get_parameter_names)
def get_parameter_names(self):
return ['accumulator_depression', 'accumulator_potentiation',
'mean_pre_window', 'mean_post_window', 'dual_fsm']
return self.__PARAM_NAMES
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class TimingDependenceSpikeNearestPair(AbstractTimingDependence):
"__tau_plus_data",
"__a_plus",
"__a_minus"]

__PARAM_NAMES = ('tau_plus', 'tau_minus')
default_parameters = {'tau_plus': 20.0, 'tau_minus': 20.0}

def __init__(self, tau_plus=default_parameters['tau_plus'],
Expand Down Expand Up @@ -154,4 +154,4 @@ def synaptic_structure(self):

@overrides(AbstractTimingDependence.get_parameter_names)
def get_parameter_names(self):
return ['tau_plus', 'tau_minus']
return self.__PARAM_NAMES
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class TimingDependenceSpikePair(AbstractTimingDependence):
"__tau_plus_data",
"__a_plus",
"__a_minus"]
__PARAM_NAMES = ('tau_plus', 'tau_minus')

def __init__(
self, tau_plus=20.0, tau_minus=20.0, A_plus=0.01, A_minus=0.01):
Expand Down Expand Up @@ -152,4 +153,4 @@ def synaptic_structure(self):

@overrides(AbstractTimingDependence.get_parameter_names)
def get_parameter_names(self):
return ['tau_plus', 'tau_minus']
return self.__PARAM_NAMES
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class TimingDependenceVogels2011(AbstractTimingDependence):
"__tau_data",
"__a_plus",
"__a_minus"]

__PARAM_NAMES = ('alpha', 'tau')
default_parameters = {'tau': 20.0}

def __init__(self, alpha, tau=default_parameters['tau'],
Expand Down Expand Up @@ -156,4 +156,4 @@ def synaptic_structure(self):

@overrides(AbstractTimingDependence.get_parameter_names)
def get_parameter_names(self):
return ['alpha', 'tau']
return self.__PARAM_NAMES
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ def get_provenance_data(self, pre_population_label, post_population_label):
:param str post_population_label: label of post.
:return: the provenance data of the weight dependency
:rtype:
list(~spinn_front_end_common.utilities.utility_objs.ProvenanceDataItem)
iterable(~spinn_front_end_common.utilities.utility_objs.ProvenanceDataItem)
"""
# pylint: disable=unused-argument
return list()
return []

@abstractmethod
def get_parameter_names(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class WeightDependenceAdditive(
__slots__ = [
"__w_max",
"__w_min"]
__PARAM_NAMES = ('w_min', 'w_max', 'A_plus', 'A_minus')

# noinspection PyPep8Naming
def __init__(self, w_min=0.0, w_max=1.0):
Expand Down Expand Up @@ -116,4 +117,4 @@ def weight_maximum(self):

@overrides(AbstractWeightDependence.get_parameter_names)
def get_parameter_names(self):
return ['w_min', 'w_max', 'A_plus', 'A_minus']
return self.__PARAM_NAMES
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class WeightDependenceAdditiveTriplet(
"__a3_plus",
"__w_max",
"__w_min"]
__PARAM_NAMES = ('w_min', 'w_max', 'A3_plus', 'A3_minus')

default_parameters = {'w_min': 0.0, 'w_max': 1.0, 'A3_plus': 0.01,
'A3_minus': 0.01}
Expand Down Expand Up @@ -153,4 +154,4 @@ def weight_maximum(self):

@overrides(AbstractWeightDependence.get_parameter_names)
def get_parameter_names(self):
return ['w_min', 'w_max', 'A3_plus', 'A3_minus']
return self.__PARAM_NAMES
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class WeightDependenceMultiplicative(
__slots__ = [
"__w_max",
"__w_min"]
__PARAM_NAMES = ('w_min', 'w_max', 'A_plus', 'A_minus')

def __init__(self, w_min=0.0, w_max=1.0):
"""
Expand Down Expand Up @@ -113,4 +114,4 @@ def weight_maximum(self):

@overrides(AbstractWeightDependence.get_parameter_names)
def get_parameter_names(self):
return ['w_min', 'w_max', 'A_plus', 'A_minus']
return self.__PARAM_NAMES
Loading

0 comments on commit c55c25f

Please sign in to comment.