Skip to content

Data Format

Peter edited this page Sep 15, 2017 · 1 revision

The file format and the way it is saved is subject to change at any point, but by using decode_file from core/files.py and upgrade_version from core/versions.py, it'll bring any data file up to date.

Saving/Loading:

For a combination of compression and speed, the file is currently saved within a zip container, as of version 2.0.10. The numpy arrays are separated from the main data, and replaced with an integer, as numpy has a much more efficient pickle.

profile.data:
    _: Pickled data with numpy arrays replaced with integers (eg. data[Maps][Tracks][(1920, 1080)] = 3)
    n: The number of numpy arrays stored separately
    0-n: Numpy arrays pickled with numpy.save

Doing it this way after the conversion to numpy has cut file sizes by over 80%, but slightly increased saving times by roughly 25%.

Data Structure:

This generally gets changed for each update, either to add options, or for a change in the way certain parts are processed. It is recommended to use the CSV export to process the data, though a function to get individual parts may be added so that updates don't break things.

*map = {(width, height): numpy.array((height, width), dtype=int64)}
*keys = {<str>: <int>}

Ticks: {
    Total: <int>,
    Recorded: <int>,
    Tracks: <int>,
    Session: {
        Total: <int>,
        Tracks: <int>
    }
},
Maps: {
    Tracks: <*map>,
    Click: {
        Single: {
            Left: <*map>,
            Middle: <*map>,
            Right: <*map>
        },
        Double: {
            Left: <*map>,
            Middle: <*map>,
            Right: <*map>
        },
        'Session': {
            Single: {
                Left: <*map>,
                Middle: <*map>,
                Right: <*map>
            },
            Double: {
                Left: <*map>,
                Middle: <*map>,
                Right: <*map>
            }
        }
    }
},
Keys: {
    All:{
        Held: <*keys>,
        Pressed: <*keys>
    }
    Session:{
        Held: <*keys>,
        Pressed: <*keys>
    }
},
Time: {
    Created: <float>,
    Modified: <float>
},
TimesLoaded: <int>,
'Version': <str>,
'SessionStarts': [<float>, <float>...]
Clone this wiki locally