Ejemplo n.º 1
0
def macina(parse, target, filelst, infl, supl):
    pointsdict = {}
    for path in filelst:
        data = parse(path)
        points = extract_point(data, target)
        points = filter(lambda x: x > infl, points)
        for i, p in enumerate(points):
            l = pointsdict.get(i, [])
            l.append(p)
            pointsdict[i] = l

    stats = []

    if parse == parse_netperf:
        starts = pointsdict[0]
        ends = pointsdict[1]

        length = list(e - s for e, s in zip(ends, starts))
        print "netperf hole lengths:", length
        avg = utils.average(length)
        var = utils.variance(length)
        q1, median, q3 = utils.quartiles(length)

        stats.append((length, (avg, var, min(length), q1, median, q3, max(length))))
    else:
        for points in pointsdict.itervalues():
            print "mesh points:", points
            avg = utils.average(points)
            var = utils.variance(points)
            q1, median, q3 = utils.quartiles(points)

        stats.append((points, (avg, var, min(points), q1, median, q3, max(points))))
    return stats
Ejemplo n.º 2
0
def print_statistics(data, label):
    avg = utils.average(data)
    var = utils.variance(data)
    minp = min(data)
    q1st, median, q3rd = utils.quartiles(data)
    maxp = max(data)

    print("%s: avg=%.3f, var=%.3f, min=%.3f, 1stq=%.3f, median=%.3f, 3rdq=%.3f, max=%.3f"
          % (label, avg, var, minp, q1st, median, q3rd, maxp))
Ejemplo n.º 3
0
def anicam(parse, filelst, infl, supl):
    points = []
    gpoints = []
    for path in filelst:
        offset = None
        tmp = []
        data = parse(path)
        for t, v in data:
            tmp.append((t,v))
            if t >= infl and t <= supl:
                points.append(v)
            if offset == None and v == 0 and t >=supl:
                offset = 40 - t

        if offset == None: raise ValueError("Not found any 0")
        for t,v in tmp:
            gpoints.append(((t + offset), v))

    avg = utils.average(points)
    var = utils.variance(points)
    q1, median, q3 = utils.quartiles(points)
    
    return gpoints, (avg, var, min(points), q1, median, q3, max(points))