Пример #1
0
    title = "Bitrate plot from {}".format(os.path.basename(datfile))
    dat = eval(open(datfile, "rt").read())

    start, data, end = dat
    secs = (end - start) / 1e9

    width = max(math.ceil(secs), 30) * 10
    harness.WINDOW = (end - start) / width
    img = numpy.zeros((len(data), width))
    best = numpy.zeros(width)

    idx = [0] * len(data)

    for i in range(0, width):
        t = (i + .5) / width * (end - start) + start
        ps = [harness.packet_stats(data[r], t, r) for r, _ in enumerate(data)]
        badnesses = [bits.tx_time(rix, p, 1500) for rix, p in enumerate(ps)]

        best[i] = perm[numpy.argmin(badnesses)]
        for j, p in enumerate(ps):
            img[perm[j], i] = p

    fig, ax = pylab.subplots()

    ax.set_xlim(0, secs)
    ax.set_ylim(-.5, 11.5)
    ax.set_xlabel("Time (s)")

    # Hide the right and top spines
    ax.spines['left'].set_visible(False)
    ax.spines['right'].set_visible(False)
Пример #2
0
def apply_rate(t):
    ps = [harness.packet_stats(data[r], t, r) for r, _ in enumerate(rates.RATES)]
    badnesses = [bits.tx_time(rix, p, 1500) for rix, p in enumerate(ps)]
    least_bad = min(enumerate(badnesses), key=lambda x: x[1])
    return [(least_bad[0], 1)]
Пример #3
0
    title = "Bitrate plot from {}".format(os.path.basename(datfile))
    dat = eval(open(datfile, "rt").read())

    start, data, end = dat
    secs = (end - start) / 1e9

    width = max(math.ceil(secs), 30) * 10
    harness.WINDOW = (end - start) / width
    img = numpy.zeros((len(data), width))
    best = numpy.zeros(width)

    idx = [0] * len(data)

    for i in range(0, width):
        t = (i + .5) / width * (end - start) + start
        ps = [harness.packet_stats(data[r], t, r) for r, _ in enumerate(data)]
        badnesses = [bits.tx_time(rix, p, 1500) for rix, p in enumerate(ps)]

        best[i] = perm[numpy.argmin(badnesses)]
        for j, p in enumerate(ps):
            img[perm[j], i] = p

    fig, ax = pylab.subplots()

    ax.set_xlim(0, secs)
    ax.set_ylim(-.5, 11.5)
    ax.set_xlabel("Time (s)")

    # Hide the right and top spines
    ax.spines['left'].set_visible(False)
    ax.spines['right'].set_visible(False)