summaryrefslogtreecommitdiff
path: root/bin/analyze-archive.py
blob: a2596d3476cd851ac5b542b560fcbbb4ff19bca1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env python3

import json
import numpy as np
import os
from scipy.cluster.vq import kmeans2
import struct
import sys
import tarfile
from dfatool import Analysis, RawData

if __name__ == '__main__':
    filename = sys.argv[1]
    raw_data = RawData(filename)

    preprocessed_data = raw_data.get_preprocessed_data()
    print(preprocessed_data)
    foo = Analysis(preprocessed_data)
    res = foo.analyze()
    print(res)
    for key in res.keys():
        print(key)
        for subkey in res[key].keys():
            if subkey != 'isa' and len(res[key][subkey]) > 0:
                print('  {:s}: {:f}'.format(subkey, np.mean(res[key][subkey])))
    sys.exit(0)