io#

This module contains methods to handle samna devices, IO and other convenience methods.

close_device(device_id: str)[source]#

Close a device by device identifier

Parameters

device_id (str) – device_name:device_id pair given as a string. dynapcnndevkit:0 or speck:0 or dynapcnndevkit:1

disable_timestamps(device_id: str) None[source]#

Disable timestamps of the samna node

Parameters

device_id (str) – Name of the device to initialize. Required for different existing APIs for Dynapcnndevkit and Speck chips

discover_device(device_id: str)[source]#

Discover a samna device by device_name:device_id pair

Parameters

device_id (str) – Device name/identifier (dynapcnndevkit:0 or speck:0 or dvxplorer:1 … ) The convention is similar to that of pytorch GPU identifier ie cuda:0 , cuda:1 etc.

Returns

device_info (samna.device.DeviceInfo)

enable_timestamps(device_id: str) None[source]#

Disable timestamps of the samna node

Parameters

device_id (str) – Name of the device to initialize. Required for different existing APIs for Dynapcnndevkit and Speck chips

events_to_raster(event_list: List, layer: int) torch.Tensor[source]#

Convert an eventList read from samna to a tensor raster by filtering only the events specified by layer.

Parameters
  • event_list (List) – A list comprising of events from samna API

  • layer (int) – The index of layer for which the data needs to be converted

Returns

raster (torch.Tensor)

events_to_xytp(event_list: List, layer: int) numpy.array[source]#

Convert an eventList read from samna to a numpy structured array of x, y, t, channel.

Parameters
  • event_list (List) – A list comprising of events from samna API

  • layer (int) – The index of layer for which the data needs to be converted

Returns

xytc (np.array) – A numpy structured array with columns x, y, t, channel.

get_device_map() Dict[source]#
Returns

  • dict(str (samna.device.DeviceInfo))

  • Returns a dict of device name and device identifier.

is_device_type(dev_info: samna.device.DeviceInfo, dev_type: str) bool[source]#

Check if a DeviceInfo object is of a given device type dev_type

Parameters
  • dev_info (samna.device.DeviceInfo) – Device info object

  • dev_type (str) – Device type as a string

  • Returns

  • -------- – bool

open_device(device_id: str)[source]#

Open device function.

Parameters

device_id (str) – device_name:device_id pair given as a string

Returns

device_handle (samna.device.*) – Device handle received from samna.

reset_timestamps(device_id: str) None[source]#

Disable timestamps of the samna node

Parameters

device_id (str) – Name of the device to initialize. Required for different existing APIs for Dynapcnndevkit and Speck chips