aertb.core.loaders¶
Suggested use is:
from aertb.core.loaders import PolarityEventFile
file = PolarityEventFile('../myFile.myext')
# handle every supported file extension
# then file.header, file.get_events() ...
-
class
aertb.core.loaders.AedatLoader(*args, **kwargs)¶ Bases:
objectFinds the appropriate version to load the file …
-
get_header(filename)¶
-
classmethod
get_version(filename)¶ Gets the version of the AEDAT file in format (DIGIT.DIGIT)
-
instance= None¶
-
load_events(filename, polarities, to_secs)¶
-
load_events_v2(filename, polarities, to_secs)¶ Returns events from an aedat file. Each dat file is a binary file in which events are encoded using 4 bytes (unsigned int32) for the timestamps and 4 bytes (unsigned int32) for the data. The data is composed of 7 bits for the x position, 7 bits for the y position and 1 bit for the polarity.
- Parameters
filename (str,) – the name of the file to load
polarities (list,) – the polarity encoding, can be [0,1] or [-1,1], by default [-1, 1]
to_secs (bool,) – determines whether to keep in microseconds (False) or convert to seconds (True), by default True
- Returns
a numpy structured array with (x, y, ts, p) fields
- Return type
np.array
-
parse_header(f)¶
-
-
class
aertb.core.loaders.BinLoader(*args, **kwargs)¶ Bases:
aertb.core.loaders.interface.LoaderInterface-
get_header(filename)¶
-
instance= None¶
-
load_events(filename, polarities, to_secs)¶ Reads a binary file containing events. To use with the N-MNIST or N-CALTECH101 dataset
- Each event occupies 40 bits as described below:
bit 39 - 32: Xaddress (in pixels) bit 31 - 24: Yaddress (in pixels) bit 23: Polarity (0 for OFF, 1 for ON) bit 22 - 0: Timestamp (in microseconds)
-
-
class
aertb.core.loaders.DatLoader(*args, **kwargs)¶ Bases:
aertb.core.loaders.interface.LoaderInterface-
dat_events(f, ev_type, polarities, to_secs)¶ Load the events with the appropriate file extension
- Parameters
f – the file pointer
ev_type – the DAT event type
polarities – how the polarities hould be encoded
to_secs – if we should encode TS in secs
-
get_header(filename)¶
-
instance= None¶
-
load_cd_events(f, polarities, to_secs)¶
-
load_events(filename, polarities=[- 1, 1], to_secs=False)¶ Returns events from a dat file. Each dat file is a binary file in which events are encoded using 4 bytes (unsigned int32) for the timestamps and 4 bytes (unsigned int32) for the data, encoding is little-endian ordering. The data is composed of 14 bits for the x position, 14 bits for the y position and 1 bit for the polarity (encoded as -1/1).
- Parameters
filename – the filename/path to the .dat file
polarities – the polarity encoding, can be [0,1] or [-1,1] (default)
- Returns
- Return type
returns: a recarray with (x, y, ts, p)
-
load_stereo_cd_events(f, polarities, to_secs)¶
-
parse_header(f)¶
-
-
class
aertb.core.loaders.LoaderInterface¶ Bases:
abc.ABC-
abstract
get_header(filename)¶
-
abstract
load_events(filename, polarities, to_secs)¶
-
abstract
-
class
aertb.core.loaders.MatLoader(*args, **kwargs)¶ Bases:
aertb.core.loaders.interface.LoaderInterface-
get_header(filename)¶
-
instance= None¶
-
load_events(filename, polarities=[- 1, 1], to_secs=False)¶ Returns events from a mat file. Each mat file is a MATLAB file containing an object with the TD events.
Works on DVS-BARREL ‘Original.mat’
- Parameters
filename – the filename/path to the .mat file
polarities – the polarity encoding, can be [0,1] or [-1,1] (default)
- Returns
- Return type
returns: a recarray with (x, y, ts, p)
-
load_sample_events(filename, object_name='ROI', sample=0, polarities=[- 1, 1], to_secs=False)¶ Returns events from a mat file. Each mat file is a MATLAB file containing an object with the TD events.
Works on DVS-BARREL ‘Stabilized.mat / Moving.mat’
- Parameters
filename – the filename/path to the .mat file
object_name – the name of the MATLAB object saved in the file
sample – an integer specifying the sample to load
polarities – the polarity encoding, can be [0,1] or [-1,1] (default)
- Returns
- Return type
returns: a recarray with (x, y, ts, p)
-
-
class
aertb.core.loaders.PolarityEventFile(filename)¶ Bases:
objectA top level class redirecting instructions to the correct loader class for the given file
-
get_header()¶ Gets the header specified in the file
-
property
header¶
-
load_events(polarities=[- 1, 1], to_secs=True)¶ Returns a structured event array from a supported event file
- Parameters
polarities (list, optional) – the polarity encoding, can be [0,1] or [-1,1], by default [-1, 1]
to_secs (bool, optional) – determines whether to keep in microseconds (False) or convert to seconds (True), by default True
- Returns
a numpy structured array with (x, y, ts, p) fields
- Return type
np.array
-
-
aertb.core.loaders.get_loader(extension)¶ Acts as a factory method for File loaders