Example #1
0
def importAe(**kwargs):
    print(kwargs)
    filePathOrName = getOrInsertDefault(kwargs, 'filePathOrName', '.')
    print(kwargs)
    if not os.path.exists(filePathOrName):
        raise FileNotFoundError("File or folder not found.")
    fileFormat = kwargs.get('fileFormat')
    if not fileFormat:
        # Try to determine the file format
        if os.path.isdir(filePathOrName):
            # It's a path - assume YARP log directory
            kwargs['fileFormat'] = 'yarp'
        else:
            ext = os.path.splitext(filePathOrName)[1]
            if ext == '.aedat' or ext == '.dat':
                # Assume it's aedat
                kwargs['fileFormat'] = 'aedat'
            elif ext == '.bag':
                # Assume it's rpg_dvs_ros
                kwargs['fileFormat'] = 'rosbag'
            elif ext == '.bin':
                # Assume it's a secdvs file
                kwargs['fileFormat'] = 'secdvs'
            elif ext == '.npy':
                kwargs['fileFormat'] = 'npy'
            # etc ...
            else:
                raise Exception("The file format cannot be determined.")
    # Let the fileformat parameter dictate the file or folder format
    fileFormat = kwargs.get('fileFormat').lower()
    if fileFormat in ['iityarp', 'yarp', 'iit', 'log', 'yarplog']:
        importedData = importIitYarp(**kwargs)
    elif fileFormat in ['rpgdvsros', 'rosbag', 'rpg', 'ros', 'bag', 'rpgdvs']:
        if 'template' not in kwargs or kwargs['template'] is None:
            print(
                'Template for ROS bag not defined - all data-type dicts will be imported into separate channels'
            )
        importedData = importRpgDvsRos(**kwargs)
    elif fileFormat in ['npy', 'numpy']:
        importedData = importNumpy(**kwargs)
    #elif fileFormat in ['iniaedat', 'aedat', 'dat', 'jaer', 'caer', 'ini', 'inivation', 'inilabs']:
    #    importedData = importIniAedat(kwargs)
    elif fileFormat in ['secdvs', 'bin', 'samsung', 'sec', 'gen3']:
        importedData = importSecDvs(**kwargs)
    else:
        raise Exception("fileFormat: " + str(fileFormat) + " not supported.")
    #celex
    return importedData
Example #2
0
# Create the ntupleViz app and start it in a thread
visualizerApp = ntupleviz.Ntupleviz()
thread = threading.Thread(target=visualizerApp.run)
thread.daemon = True
thread.start()

# Wait until the load dialog has come up

#%% Load some data that you want to work with

from importIitYarp import importIitYarp

filePathOrName = os.path.join(prefix,
                              "data/2019_11_11_AikoImu/linear_100/ATIS")
container = importIitYarp(filePathOrName=filePathOrName, tsBits=30)

# Having loaded a dvs dataDict - poke it into the dsm
visualizerApp.root.data_controller.data_dict = imported

#%% Load some different data and push it in

from importIitYarp import importIitYarp

filePathOrName = os.path.join(prefix,
                              "data/2019_11_11_AikoImu/tripod_pitch/ATIS")
container = importIitYarp(filePathOrName=filePathOrName, tsBits=30)

visualizerApp.root.data_controller.data_dict = container

#%% Simulated DAVIS data
Example #3
0
sys.path.append(
    os.path.join(prefix,
                 'repos/event-driven-python-dev/python/libraries/bimvee')
)  # A path to this library
#sys.path.insert(0, os.path.join(prefix, 'repos/event-driven-python-dev/python/libraries/bimvee')) # A path to this library

#%% IMPORT FUNCTIONS

#%% Import from yarp

from importIitYarp import importIitYarp

filePathOrName = os.path.join(prefix, "data/2019_11_11_AikoImu/tripod_pitch")
# If the number of bits dedicated to the timestamp have been limited
# prior to dumping, then match this with the 'tsBits' parameter
imported = importIitYarp(filePathOrName=filePathOrName, tsBits=30)

#%% Inspection of a rosbag
'''
To just inspect the connections of a rosbag file , pass in an empty template.
This doesn't import any data but prints out which connections are present 
in the file. You can then construct a template to import the file as desired.
'''

from importRpgDvsRos import importRpgDvsRos

filePathOrName = os.path.join(prefix, 'data/rpg/shapes_rotation.bag')
inspected = importRpgDvsRos(filePathOrName=filePathOrName)

#%% Import Rpg Event-Camera Dataset