tonic.io#

Module Contents#

Functions#

make_structured_array(*args[, dtype])

Make a structured array given a variable number of argument values.

read_aedat4(in_file)

Get the aer events from version 4 of .aedat file.

read_dvs_128(filename)

Get the aer events from DVS with resolution of rows and cols are (128, 128)

read_dvs_ibm(filename)

Get the aer events from DVS with ibm gesture dataset.

read_dvs_red(filename)

Get the aer events from DVS with resolution of (260, 346)

read_davis_346(filename)

Get the aer events from DAVIS346 with resolution of (260, 346)

read_dvs_346mini(filename)

Get the aer events from DVS with resolution of (132,104)

read_mnist_file(bin_file, dtype[, is_stream])

Reads the events contained in N-MNIST/N-CALTECH101 datasets.

read_aedat_header_from_file(filename)

Get the aedat file version and start index of the binary data.

get_aer_events_from_file(filename, data_version, ...)

Get aer events from an aer file.

Attributes#

events_struct

tonic.io.events_struct#
tonic.io.make_structured_array(*args, dtype=events_struct)[source]#

Make a structured array given a variable number of argument values.

Parameters:

*args – Values in the form of nested lists or tuples or numpy arrays. Every except the first argument can be of a primitive data type like int or float.

Returns:

numpy structured array with the shape of the first argument

Return type:

struct_arr

tonic.io.read_aedat4(in_file)[source]#

Get the aer events from version 4 of .aedat file.

Parameters:

in_file – str The name of the .aedat file

Returns:

numpy structured array of events

Return type:

events

tonic.io.read_dvs_128(filename)[source]#

Get the aer events from DVS with resolution of rows and cols are (128, 128)

Parameters:

filename – filename

Returns:

(height, width) of the sensor array xytp: numpy structured array of events

Return type:

shape (tuple)

tonic.io.read_dvs_ibm(filename)[source]#

Get the aer events from DVS with ibm gesture dataset.

Parameters:

filename – filename

Returns:

(height, width) of the sensor array xytp: numpy structured array of events

Return type:

shape (tuple)

tonic.io.read_dvs_red(filename)[source]#

Get the aer events from DVS with resolution of (260, 346)

Parameters:

filename – filename

Returns:

(height, width) of the sensor array

events: numpy structured array of events

Return type:

shape (tuple)

tonic.io.read_davis_346(filename)[source]#

Get the aer events from DAVIS346 with resolution of (260, 346)

Parameters:

filename – filename

Returns:

(height, width) of the sensor array

events: numpy structured array of events

Return type:

shape (tuple)

tonic.io.read_dvs_346mini(filename)[source]#

Get the aer events from DVS with resolution of (132,104)

Parameters:

filename – filename

Returns:

(height, width) of the sensor array xytp: numpy structure of xytp

Return type:

shape (tuple)

tonic.io.read_mnist_file(bin_file: Union[str, BinaryIO], dtype: numpy.dtype, is_stream: bool = False)[source]#

Reads the events contained in N-MNIST/N-CALTECH101 datasets.

Code adapted from gorchard/event-Python

Parameters:
  • bin_file (Union[str, BinaryIO]) –

  • dtype (numpy.dtype) –

  • is_stream (bool) –

tonic.io.read_aedat_header_from_file(filename)[source]#

Get the aedat file version and start index of the binary data.

Parameters:

filename (str) – The name of the .aedat file

Returns:

The version of the .aedat file data_start (int): The start index of the data start_timestamp (int): The start absolute system timestamp in micro-seconds

Return type:

data_version (float)

tonic.io.get_aer_events_from_file(filename, data_version, data_start)[source]#

Get aer events from an aer file.

Parameters:
  • filename (str) – The name of the .aedat file

  • data_version (float) – The version of the .aedat file

  • data_start (int) – The start index of the data

Returns:

Numpy structured array:

[‘address’] the address of a neuron which fires [‘timeStamp’] the timeStamp in mus when a neuron fires

Return type:

all_events