samna.dynapcnn#

Submodules#

Module content#

class samna.dynapcnn.DynapcnnModel#

Bases: pybind11_object

The DYNAP-CNN model is the standard interface between Python code and a connected DYNAP-CNN chip. Via the model it is possible to connect its source and sink nodes to the filtering system and apply configurations.

apply_configuration(self: samna.dynapcnn.DynapcnnModel, arg0: samna.dynapcnn.configuration.DynapcnnConfiguration) None#

Apply a configuration to the device.

The configuration will first be validated. If the configuration is not valid this function will throw an exception with an error message describing the validation failure.

Parameters:

config (DynapcnnConfiguration) – Configuration to validate and apply.

get_configuration(self: samna.dynapcnn.DynapcnnModel) samna.dynapcnn.configuration.DynapcnnConfiguration#

Returns a copy of the current configuration of the device.

Note that this is simply a copy of configuration provided by the last successful call to apply_configuration(). This function does not read physical device state.

get_sink_node(self: samna.dynapcnn.DynapcnnModel) samna.DeviceSinkNode_dynapcnn_event_input_event#

Get the handle to the model sink node

The model sink node ties into the filter system. It will transmit all events sent to sink node to the device represented by the DynapcnnModel.

To write events to this sink node, a BasicSourceNode must be instantiated and connected to the sink as follows:

source = samna.graph.source_to(dk.get_model().get_sink_node())
source.write([evt1, evt2, evt3, ...])
Returns:

A handle to the model sink node

get_source_node(self: samna.dynapcnn.DynapcnnModel) samna.DeviceSourceNode_dynapcnn_event_output_event#

Get the handle to the model source node

The model source node ties into the filter system. It will emit all events produced by the device represented by the DynapcnnModel

To read events from this source node, a BasicSinkNode must be instantiated and connected to the source as follows:

buf = samna.graph.sink_from(dk.get_model().get_source_node())
events = buf.get_events() # an array of events will be returned
Returns:

A handle to the model sink node

reset(self: samna.dynapcnn.DynapcnnModel) None#

Reset all state memory.

write(self: samna.dynapcnn.DynapcnnModel, arg0: List[samna.dynapcnn.event.Spike | samna.dynapcnn.event.RouterEvent | samna.dynapcnn.event.KillSensorPixel | samna.dynapcnn.event.ResetSensorPixel | samna.dynapcnn.event.WriteNeuronValue | samna.dynapcnn.event.ReadNeuronValue | samna.dynapcnn.event.WriteWeightValue | samna.dynapcnn.event.ReadWeightValue | samna.dynapcnn.event.WriteBiasValue | samna.dynapcnn.event.ReadBiasValue | samna.dynapcnn.event.WriteRegisterValue | samna.dynapcnn.event.ReadRegisterValue | samna.dynapcnn.event.WriteMemoryValue | samna.dynapcnn.event.ReadMemoryValue | samna.dynapcnn.event.ReadProbe]) None#

This function is DEPRECATED, please prefer sending events by streaming to the sink node using get_sink_node.

Submits a sequence (list) of events to be transmitted to the device represented by the device model. This function returns immediately. Events will be transmitted in the background.

Parameters:

events (List[Dynapcnn input event]) – Events which will be sent to the device. All events must be in the InputEvent variant. Event ordering will be preserved.

samna.dynapcnn.validate_configuration(arg0: samna.dynapcnn.configuration.DynapcnnConfiguration) Tuple[bool, str]#

Validates the given configuration.

Parameters:

config (dynapcnn.configuration.DynapcnnConfiguration) – The configuration to validate.

Returns:

A pair of the validation result and the analysis string.