pocolog2msgpack package¶
Submodules¶
pocolog2msgpack.BufferedFileDecompressor module¶
pocolog2msgpack.FifoFileBuffer module¶
pocolog2msgpack.object2relational module¶
- pocolog2msgpack.object2relational.object2relational(input_filename, output_filename, whitelist=())[source]¶
Convert a MsgPack logfile from object-oriented to relational storage.
The log data produced by pocolog2msgpack can usually be accessed with log[port_name][sample_idx][field_a]…[field_b]. This is an object-oriented view of the data because you can easily access a whole object from the log. This is not convenient if you want to use the data for, e.g., machine learning, where you typically need the whole dataset in a 2D array, i.e. a relational view on the data, in which you can access data in the form log[port_name][feature][sample_idx].
Parameters¶
- input_filenamestr
Name of the original logfile
- output_filenamestr
Name of the converted logfile
- whitelistlist or tuple
Usually arrays and vectors (represented as lists in Python) are handled as basic types and are put in a single column because they can have dynamic sizes. This is a list of fields that will be scanned recursively and interpreted as arrays with a fixed length. Note that you only have to give the name of the field, not the port name. An example would be [“elements”, “names”] if you want fully unravel a JointState object.
pocolog2msgpack.readhelpers module¶
- pocolog2msgpack.readhelpers.read_field(filename, srcKey, dataToNumpyArray=True, decompress='auto')[source]¶
- pocolog2msgpack.readhelpers.read_fields(filename, srcKeys=None, renameMap=None, dataToNumpyArray=True, allowDuplicates=False, decompress='auto')[source]¶
Read the list of fields in srcKeys from compress msgpack file determined by filename.
- Parameters:
filename – the path of the input file (e.g. a
*.msg.zzfile)srcKeys – the list of fields (to level keys) to read or None to read all or can be the same as renameMap
renameMap – a dict listing how the srcKeys should be called in the output
dataToNumpyArray – if true, each field is converted to numpy array
allowDuplicates – if true, values of output dict become lists
- Returns:
a dict with the field names or the values of renameMap as keys, and the data as values
- Raises:
IndexError – raises an exception a key cannot be found or is not unique
Module contents¶
Top-level package for pocolog2msgpack.