Skip to content

Commit

Permalink
Fix mean calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Kim committed Sep 20, 2016
1 parent 083ebbb commit bee5b1a
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions graph_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,17 @@ def get_tuples(filename, slabels, xlabel, ylabels, nosort):
series_tuples[series_name]["order"] = slabels.index(series_name);
count += 1;
series_tuples[series_name]["mean"] = 0;
count2 = 0;
for sample in series.get("samples"):
for ylabel in ylabels:
count2 = 0;
if(sample.get(ylabel) != None):
series_tuples[series_name][(xlabel, ylabel)].append((sample.get(xlabel), sample.get(ylabel)));
series_tuples[series_name]["mean"] += sample.get(ylabel);
count2 += 1;
if(count2 == 0):
count2 = 1;
series_tuples[series_name]["mean"] /= count2;
ylabel = ylabels[0];
if(sample.get(ylabel) != None):
series_tuples[series_name][(xlabel, ylabel)].append((sample.get(xlabel), sample.get(ylabel)));
series_tuples[series_name]["mean"] += sample.get(ylabel);
count2 += 1;
if(count2 == 0):
count2 = 1;
series_tuples[series_name]["mean"] /= count2;
print(series_name + "." + ylabels[0] + " = " + str(series_tuples[series_name]["mean"]));
fd.close();
if(nosort == True):
order_ybar(series_tuples, xlabel, ylabels[0]);
Expand Down

0 comments on commit bee5b1a

Please sign in to comment.