Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
target = nengo_probe.target
if isinstance(nengo_probe.target, nengo.base.ObjView):
target = target.obj
# if the target is a Node
if isinstance(target, nengo.Node):
target_object = nengo_probe.target
# if the target is an ensemble, get the ensemble's app vert
elif isinstance(target, nengo.Ensemble):
target_object = target
# if the target is a Neurons from an ensemble, backtrack to the
# ensemble
elif isinstance(target, nengo.ensemble.Neurons):
if isinstance(nengo_probe.target, nengo.base.ObjView):
target_object = nengo_probe.target.obj.ensemble
else:
target_object = nengo_probe.target.ensemble
# if the target is a learning rule, locate the ensemble at the
# destination.
elif isinstance(target, nengo.connection.LearningRule):
if isinstance(nengo_probe.target.connection.post_obj,
nengo.Ensemble):
target_object = nengo_probe.target.connection.post_obj
else:
raise NotLocatedProbableClass(
"SpiNNaker does not currently support probing '{}' on "
"'{}'".format(
nengo_probe.attr, nengo_probe.target.
learning_rule_type.__class__.__name__))
def _get_reception_parameters(nengo_connection):
""" returns the reception parameters of the nengo connection
:param nengo_connection: the nengo connection in question
:return: the reception parameters
:rtype: ReceptionParameters
"""
if (isinstance(nengo_connection.post_obj, nengo.base.NengoObject) or
isinstance(nengo_connection.post_obj,
nengo.connection.LearningRule) or
isinstance(nengo_connection.post_obj, nengo.ensemble.Neurons)):
return ReceptionParameters(
parameter_filter=nengo_connection.synapse,
width=nengo_connection.post_obj.size_in,
learning_rule=nengo_connection.learning_rule)
def _locate_correct_app_vertex_for_probe(
nengo_probe, nengo_to_app_graph_map):
""" locates the correct app vertex for a given probe
:param nengo_probe: the nengo probe
:param nengo_to_app_graph_map: the map between nengo objects and
nengo operator graph
:return: the nengo operator considered here
"""
# ensure the target is of a nengo object
target = nengo_probe.target
if isinstance(nengo_probe.target, nengo.base.ObjView):
target = target.obj
# if the target is a Node
if isinstance(target, nengo.Node):
target_object = nengo_probe.target
# if the target is an ensemble, get the ensemble's app vert
elif isinstance(target, nengo.Ensemble):
target_object = target
# if the target is a Neurons from an ensemble, backtrack to the
# ensemble
elif isinstance(target, nengo.ensemble.Neurons):
if isinstance(nengo_probe.target, nengo.base.ObjView):
target_object = nengo_probe.target.obj.ensemble
else: