Mercurial > hg > webaudioevaluationtool
comparison scripts/score_individual.py @ 209:538322113524 Dev_main
Merge from the default branch
author | Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk> |
---|---|
date | Tue, 16 Jun 2015 14:14:08 +0100 |
parents | 59eea6eed91b |
children |
comparison
equal
deleted
inserted
replaced
204:d12dbbab3565 | 209:538322113524 |
---|---|
6 rating_folder = 'ratings/' # folder with rating csv files | 6 rating_folder = 'ratings/' # folder with rating csv files |
7 | 7 |
8 colormap = ['b', 'r', 'g', 'c', 'm', 'y', 'k'] # colormap for to cycle through | 8 colormap = ['b', 'r', 'g', 'c', 'm', 'y', 'k'] # colormap for to cycle through |
9 markerlist = ["x", ".", "o", "*", "+", "v", ">", "<", "8", "s", "p"] | 9 markerlist = ["x", ".", "o", "*", "+", "v", ">", "<", "8", "s", "p"] |
10 | 10 |
11 show_legend = False | |
12 | |
11 # get every csv file in folder | 13 # get every csv file in folder |
12 for file in os.listdir(rating_folder): | 14 for file in os.listdir(rating_folder): |
13 if file.endswith(".csv"): | 15 if file.endswith(".csv"): |
16 | |
14 page_name = file[:-4] # file name (without extension) is page ID | 17 page_name = file[:-4] # file name (without extension) is page ID |
15 | 18 |
16 with open(rating_folder+file, 'r') as readfile: # read this csv file | 19 with open(rating_folder+file, 'r') as readfile: # read this csv file |
17 filereader = csv.reader(readfile, delimiter=',') | 20 filereader = csv.reader(readfile, delimiter=',') |
18 headerrow = filereader.next() # use headerrow as X-axis | 21 headerrow = filereader.next() # use headerrow as X-axis |
32 linestyle='None', | 35 linestyle='None', |
33 label=subject_id | 36 label=subject_id |
34 ) | 37 ) |
35 increment += 1 # increase counter | 38 increment += 1 # increase counter |
36 linehandles.append(plothandle) | 39 linehandles.append(plothandle) |
37 legendnames.append(subject_id) | 40 legendnames.append(subject_id.decode("utf-8")) # avoid decoding problems |
38 | 41 |
39 | 42 |
40 plt.xlabel('Fragment') | 43 plt.xlabel('Fragment') |
41 plt.title('Individual ratings '+page_name) | 44 plt.title('Individual ratings '+page_name) |
42 plt.xlim(0, len(headerrow)+1) # only show relevant region, leave space left & right) | 45 plt.xlim(0, len(headerrow)+1) # only show relevant region, leave space left & right) |
43 plt.xticks(range(1, len(headerrow)+1), headerrow) # show fragment names | 46 plt.xticks(range(1, len(headerrow)+1), headerrow) # show fragment names |
44 | 47 |
45 plt.ylabel('Rating') | 48 plt.ylabel('Rating') |
46 plt.ylim(0,1) | 49 plt.ylim(0,1) |
47 | 50 |
48 plt.legend(linehandles, legendnames, | 51 if show_legend: |
49 loc='upper right', | 52 plt.legend(linehandles, legendnames, |
50 bbox_to_anchor=(1.1, 1), | 53 loc='upper right', |
51 borderaxespad=0., | 54 bbox_to_anchor=(1.1, 1), |
52 numpoints=1 # remove extra marker | 55 borderaxespad=0., |
53 ) | 56 numpoints=1 # remove extra marker |
57 ) | |
54 | 58 |
55 #TODO Put legend outside of box | 59 #TODO Put legend outside of box |
56 | 60 |
57 #plt.show() # show plot | 61 #plt.show() # show plot |
58 #exit() | 62 #exit() |
59 | 63 |
60 plt.savefig(rating_folder+page_name+"-ind.png") | 64 plt.savefig(rating_folder+page_name+"-ind.png") |
65 plt.close() |