Device Models#

Every device supported by Samna has a corresponding device model. The device model has two main functions. It allows you to send and receive events to/from the device via the filter system, and to apply a new configuration to the device. After obtaining a development kit object using the device controller the chip model can be retrieved.

# Obtain the device model for the device on the development kit we obtained from the device controller
model = my_board.get_device_model()

# Devices can also be closed via the device controller.


Device models all have an apply_configuration() function that accepts a configuration object. Such a configuration object can be created in Python, for example to create and apply a DYNAP-CNN configuration

# Create a default configuration
config = samna.dynapcnn.configuration.DynapcnnConfiguration()

# Modify some parameter of the configuration if desired
config.cnn_layers[0].monitor_enable = true

# Apply the configuration to a device via its device model
# This will generate errors if the configuration is illegal

Event streams#

All models can hook into the event filtering system using their source and sink nodes. All events written to the sink node of a device model will be transmitted to the physical device and all events produced by the physical device will be broadcast from the model source node.

All device models provide the get_source_node() and get_sink_node() functions.

Common model functions#

class Model#

Returns a reference to the source event node which will broadcast all events produced by the device.


Returns a reference to the sink event node which will transmit all events it receives to the device.


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


Attempts to apply a configuration for the device. The configuration will first be validated and the configuration will only be applied if validation is successful. If validation does not succeed this method will throw an exception containing a validation error message.


configuration (DeviceConfiguration) – The configuration specific to the type of device.

Supported device models#