Mercurial > hg > webaudioevaluationtool
comparison scripts/score_plot.py @ 1063:e67a76e9ba7a
Scripts: choose input/output folder from command line; score_plot also choose options from command line (WIP)
author | Brecht De Man <BrechtDeMan@users.noreply.github.com> |
---|---|
date | Mon, 20 Jul 2015 12:47:16 +0100 |
parents | cabeed51943a |
children | a1c1f032ff0a 99cb3436759e |
comparison
equal
deleted
inserted
replaced
1062:3e84741cca7a | 1063:e67a76e9ba7a |
---|---|
6 import matplotlib.pyplot as plt | 6 import matplotlib.pyplot as plt |
7 import numpy as np | 7 import numpy as np |
8 import scipy as sp | 8 import scipy as sp |
9 import scipy.stats | 9 import scipy.stats |
10 | 10 |
11 # CONFIGURATION | 11 # COMMAND LINE ARGUMENTS |
12 | 12 |
13 # Which type(s) of plot do you want? | 13 #TODO: Merge, implement this functionality |
14 enable_boxplot = True # show box plot | 14 #TODO: Control by CLI arguments (plot types, save and/or show, ...) |
15 | |
16 assert len(sys.argv)<4, "score_plot takes at most 2 command line arguments\n"+\ | |
17 "Use: python score_plot.py [ratings_folder_location]."+\ | |
18 "Type 'python score_plot.py -h' for more options" | |
19 | |
20 # initialise plot types (false by default) and options | |
21 enable_boxplot = False # show box plot | |
15 enable_confidence = False # show confidence interval | 22 enable_confidence = False # show confidence interval |
16 confidence = 0.90 # confidence value (for confidence interval plot) | 23 confidence = 0.90 # confidence value (for confidence interval plot) |
17 enable_individual = False # show all individual ratings | 24 enable_individual = False # show all individual ratings |
18 show_individual = [] # show specific individuals | 25 show_individual = [] # show specific individuals (empty: show all individuals found) |
19 show_legend = False # show names of individuals | 26 show_legend = False # show names of individuals |
20 #TODO: Merge, implement this functionality | 27 |
21 #TODO: Control by CLI arguments (plot types, save and/or show, ...) | 28 # DEFAULT: Looks in 'saves/ratings/' folder from 'scripts/' folder |
29 rating_folder = "../saves/ratings/" | |
30 | |
31 # XML results files location | |
32 if len(sys.argv) == 1: # no extra arguments | |
33 enable_boxplot = True # show box plot | |
34 print "Use: python score_plot.py [rating folder] [plot_type] [-l/-legend]" | |
35 print "Type 'python score_plot.py -h' for help." | |
36 print "Using default path: " + rating_folder + " with boxplot." | |
37 else: | |
38 for arg in sys.argv: # go over all arguments | |
39 if arg == '-h': | |
40 # show help | |
41 #TODO: replace with contents of helpfile score_plot.info (or similar) | |
42 print "Use: python score_plot.py [rating_folder] [plot_type] [-l] [confidence]" | |
43 print " rating_folder:" | |
44 print " folder where output of 'score_parser' can be found, and" | |
45 print " where plots will be stored." | |
46 print " By default, '../saves/ratings/' is used." | |
47 print "" | |
48 print "PLOT TYPES" | |
49 print " Can be used in combination." | |
50 print " box | boxplot | -b" | |
51 print " Enables the boxplot" | |
52 print " conf | confidence | -c" | |
53 print " Enables the confidence interval plot" | |
54 print " ind | individual | -i" | |
55 print " Enables plot of individual ratings" | |
56 print "" | |
57 print "PLOT OPTIONS" | |
58 print " legend | -l" | |
59 print " For individual plot: show legend with individual file names" | |
60 print " " | |
61 assert False, ""# stop immediately after showing help #TODO cleaner way | |
62 | |
63 # PLOT TYPES | |
64 elif arg == 'box' or arg == 'boxplot' or arg == '-b': | |
65 enable_boxplot = True # show box plot | |
66 elif arg == 'conf' or arg == 'confidence' or arg == '-c': | |
67 enable_confidence = True # show confidence interval | |
68 #TODO add confidence value input | |
69 elif arg == 'ind' or arg == 'individual' or arg == '-i': | |
70 enable_individual = True # show all individual ratings | |
71 | |
72 # PLOT OPTIONS | |
73 elif arg == 'leg' or arg == 'legend' or arg == '-l': | |
74 if not enable_individual: | |
75 print "WARNING: The 'legend' option is only relevant to plots of individual ratings" | |
76 show_legend = True # show all individual ratings | |
77 | |
78 # FOLDER NAME | |
79 else: | |
80 # assume it's the folder name | |
81 rating_folder = arg | |
82 #TODO try it exists, otherwise show exception | |
83 | |
84 # at least one plot type should be selected: box plot by default | |
85 if not enable_boxplot and not enable_confidence and not enable_individual: | |
86 enable_boxplot = True | |
87 | |
88 # CONFIGURATION | |
22 | 89 |
23 # Enter folder where rating CSV files are (generated with score_parser.py or same format). | 90 # Enter folder where rating CSV files are (generated with score_parser.py or same format). |
24 rating_folder = '../saves/ratings/' # folder with rating csv files | 91 rating_folder = '../saves/ratings/' # folder with rating csv files |
25 | 92 |
26 # Font settings | 93 # Font settings |