Mercurial > hg > webaudioevaluationtool
comparison scripts/evaluation_stats.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 | 3e84741cca7a |
children | a1c1f032ff0a 99cb3436759e |
comparison
equal
deleted
inserted
replaced
1062:3e84741cca7a | 1063:e67a76e9ba7a |
---|---|
2 # -*- coding: utf-8 -*- | 2 # -*- coding: utf-8 -*- |
3 | 3 |
4 import xml.etree.ElementTree as ET | 4 import xml.etree.ElementTree as ET |
5 import os # for getting files from directory | 5 import os # for getting files from directory |
6 import operator # for sorting data with multiple keys | 6 import operator # for sorting data with multiple keys |
7 import sys # for accessing command line arguments | |
7 | 8 |
8 # XML results files location (modify as needed): | 9 # Command line arguments |
9 folder_name = "../saves" # Looks in 'saves/' folder from 'scripts/' folder | 10 assert len(sys.argv)<3, "evaluation_stats takes at most 1 command line argument\n"+\ |
11 "Use: python evaluation_stats.py [results_folder]" | |
12 | |
13 # XML results files location | |
14 if len(sys.argv) == 1: | |
15 folder_name = "../saves" # Looks in 'saves/' folder from 'scripts/' folder | |
16 print "Use: python evaluation_stats.py [results_folder]" | |
17 print "Using default path: " + folder_name | |
18 elif len(sys.argv) == 2: | |
19 folder_name = sys.argv[1] # First command line argument is folder | |
10 | 20 |
11 # Turn number of seconds (int) to '[minutes] min [seconds] s' (string) | 21 # Turn number of seconds (int) to '[minutes] min [seconds] s' (string) |
12 def seconds2timestr(time_in_seconds): | 22 def seconds2timestr(time_in_seconds): |
13 time_in_minutes = int(time_in_seconds/60) | 23 time_in_minutes = int(time_in_seconds/60) |
14 remaining_seconds = int(time_in_seconds%60) | 24 remaining_seconds = int(time_in_seconds%60) |
124 print "Number of XML files: " + str(number_of_XML_files) | 134 print "Number of XML files: " + str(number_of_XML_files) |
125 print "Number of pages: " + str(number_of_pages) | 135 print "Number of pages: " + str(number_of_pages) |
126 print "Number of fragments: " + str(number_of_fragments) | 136 print "Number of fragments: " + str(number_of_fragments) |
127 print "Number of empty comments: " + str(total_empty_comments) | 137 print "Number of empty comments: " + str(total_empty_comments) |
128 print "Average time per page: " + seconds2timestr(time_per_page_accum/number_of_pages) | 138 print "Average time per page: " + seconds2timestr(time_per_page_accum/number_of_pages) |
139 | |
140 # Pages and number of times tested | |
129 page_count_strings = list(str(x) for x in page_count) | 141 page_count_strings = list(str(x) for x in page_count) |
130 count_list = page_names + page_count_strings | 142 count_list = page_names + page_count_strings |
131 count_list[::2] = page_names | 143 count_list[::2] = page_names |
132 count_list[1::2] = page_count_strings | 144 count_list[1::2] = page_count_strings |
133 print "Pages tested: " + str(count_list) | 145 print "Pages tested: " + str(count_list) |