-
Notifications
You must be signed in to change notification settings - Fork 4
/
convert_test.py
29 lines (24 loc) · 901 Bytes
/
convert_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import glob
import os
import sys
import subprocess
bin_dir = '../bin/Release' # Directory to the image_converter executable
cmd_name = 'image_converter'
# Find *raw files
raw_files = glob.glob(sys.argv[1]+'//**/*.raw', recursive=True)
total_good = 0
total_bad = 0
for raw_file in raw_files:
cmd = os.path.join(bin_dir, cmd_name)
cmd += ' -i {} -o dmy.d77 -v'.format(raw_file)
#print(cmd)
print(raw_file, ' ', end='', flush=True)
log = subprocess.run(cmd, capture_output=True, text=True).stdout
for line in log.splitlines():
if(line[:2] == '**'):
msg, data = line.split(':')
good, bad = data.split(' ')
print(good, bad, int(bad)/(int(good)+int(bad)))
total_good += int(good)
total_bad += int(bad)
print('total result - good/bad/error rate:', total_good, total_bad, total_good/(total_good+total_bad))