Ignore:
Timestamp:
Mar 7, 2023, 4:50:09 PM (22 months ago)
Author:
caparson <caparson@…>
Branches:
ADT, ast-experimental, master
Children:
dd16dd5
Parents:
50d2513
Message:

added latex compatible output format

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/colby_parsons_MMAth/benchmarks/actors/plotData.py

    r50d2513 r625f3e2  
    1010from statistics import median
    1111
     12import matplotlib
     13matplotlib.use("pgf")
     14matplotlib.rcParams.update({
     15    "pgf.texsystem": "pdflatex",
     16    'font.family': 'serif',
     17    'text.usetex': True,
     18    'pgf.rcfonts': False,
     19})
     20
    1221readfile = open(sys.argv[1], "r")
     22
     23machineName = ""
     24
     25if len(sys.argv) > 2:
     26    machineName = sys.argv[2]
    1327
    1428# first line has num times per experiment
     
    4761name = ""
    4862var_name = ""
     63sendData = [0.0 for j in range(numVariants)]
    4964data = [[0.0 for i in range(len(procs))] for j in range(numVariants)]
    5065bars = [[[0.0 for i in range(len(procs))],[0.0 for k in range(len(procs))]] for j in range(numVariants)]
     
    6479            currBench = Bench.Repeat
    6580        elif line == "balance_one":
    66             name = "Balance_One"
     81            name = "Balance-One"
    6782            currBench = Bench.Balance_One
    6883        elif line == "balance_multi":
    69             name = "Balance_Multi"
     84            name = "Balance-Multi"
    7085            currBench = Bench.Balance_Multi
    7186        elif line == "static":
     
    8499
    85100    if currBench == Bench.Static or currBench == Bench.Dynamic:
    86         print("NOT YET IMPLEMENTED")
    87         sys.exit()
     101        if not nameSet:
     102            nameSet = True
     103            continue
     104        lineArr = line.split()
     105        tempData[count] = float(lineArr[-1])
     106        count += 1
     107        if count == numTimes:
     108            currMedian = median( tempData )
     109            sendData[currVariant] = currMedian
     110            count = 0
     111            nameSet = False
     112            currVariant += 1
     113
     114            if currVariant == numVariants:
     115                fileName = "data/" + machineName
     116                if currBench == Bench.Static:
     117                    fileName += "SendStatic"
     118                else:
     119                    fileName += "SendDynamic"
     120                f = open(fileName, 'w')
     121                f.write(" & ".join(map(lambda a: str(int(a)) + 'ns', sendData)))
     122
     123                # reset
     124                currBench = Bench.Unset
     125                currVariant = 0
     126               
    88127    else:
    89128        if not nameSet:
     
    122161                        plt.ylim(0, None)
    123162                    ax.legend(names)
    124                     fig.savefig("plots/" + name + ".png")
     163                    # fig.savefig("plots/" + name + ".png")
     164                    plt.savefig("plots/" + machineName + name + ".pgf")
    125165                    fig.clf()
    126166
Note: See TracChangeset for help on using the changeset viewer.