Mercurial > hg > aimc
comparison trunk/experiments/scripts/cnbh-syllables/results_plotting/gen_results.py @ 388:d9be18850b55
- We'll get there in the end
author | tomwalters |
---|---|
date | Tue, 14 Sep 2010 01:14:54 +0000 |
parents | b0ce50fa8a95 |
children |
comparison
equal
deleted
inserted
replaced
387:59e03282b534 | 388:d9be18850b55 |
---|---|
10 import getopt | 10 import getopt |
11 import re | 11 import re |
12 | 12 |
13 | 13 |
14 help_message = ''' | 14 help_message = ''' |
15 Generate a file containing all the results for a run of the | 15 Write out all the results for a run of the |
16 syllable recognition experiment. Expected input is a 'misclassificaions' | 16 syllable recognition experiment. Expected input is a 'misclassificaions' |
17 file of the type generated by run_test_instance.sh, along with the locations | 17 file of the type generated by run_test_instance.sh, along with the locations |
18 of files containing the training talkers and all the talkers that the system | 18 of files containing the training talkers and all the talkers that the system |
19 was tested on. | 19 was tested on. |
20 | 20 |
21 Arguments: | 21 Arguments: |
22 -i --input_file | 22 -i --input_file |
23 -t --train_talkers | 23 -t --train_talkers |
24 -s --test_talkers | 24 -s --test_talkers |
25 -o --output_filename | |
26 -c --value_count | 25 -c --value_count |
27 -p --spoke_pattern | 26 -p --spoke_pattern |
28 ''' | 27 ''' |
29 | 28 |
30 class Usage(Exception): | 29 class Usage(Exception): |
37 argv = sys.argv | 36 argv = sys.argv |
38 try: | 37 try: |
39 try: | 38 try: |
40 opts, args = getopt.getopt(argv[1:], "hi:t:s:o:c:p:v", | 39 opts, args = getopt.getopt(argv[1:], "hi:t:s:o:c:p:v", |
41 ["help", "input_file=", "train_talkers=", | 40 ["help", "input_file=", "train_talkers=", |
42 "test_talkers=", "output_filename=", | 41 "test_talkers=", |
43 "value_count=", "spoke_pattern="]) | 42 "value_count=", "spoke_pattern="]) |
44 except getopt.error, msg: | 43 except getopt.error, msg: |
45 raise Usage(msg) | 44 raise Usage(msg) |
46 | 45 |
47 # defaults | 46 # defaults |
66 test_talkers = value | 65 test_talkers = value |
67 if option in ("-c", "--value_count"): | 66 if option in ("-c", "--value_count"): |
68 total_value_count = int(value) | 67 total_value_count = int(value) |
69 if option in ("-p", "--spoke_pattern"): | 68 if option in ("-p", "--spoke_pattern"): |
70 spoke_pattern_file = value | 69 spoke_pattern_file = value |
71 if option in ("-o", "--output_filename"): | |
72 output_filename = value | |
73 | 70 |
74 except Usage, err: | 71 except Usage, err: |
75 print >> sys.stderr, sys.argv[0].split("/")[-1] + ": " + str(err.msg) | 72 print >> sys.stderr, sys.argv[0].split("/")[-1] + ": " + str(err.msg) |
76 print >> sys.stderr, "\t for help use --help" | 73 print >> sys.stderr, "\t for help use --help" |
77 return 2 | 74 return 2 |