print_scores.py 730 Bytes
import sys
import glob
import shelve
import numpy as np
scores_ordoned={}
files= glob.glob(sys.argv[1]+"/**.bak")
files.sort()
for j,i in enumerate(files):
        #if "MINIAE" not in i :
             #   continue
    scores={}
    fname= i.split("/")[-1][:-11]
    data=shelve.open(i[:-4])
#    print i[:-4]
    for key,table in data.iteritems():
        scores[key]=round(table[1][np.argmax([x[0] for x in table[0]])][0],3)
    keys = scores.keys()
    keys.sort()
    scores_to_print=[fname]
    for key in keys:
        scores_to_print.append(" ".join([key,str(round(scores[key],4))]))
   # if len(scores_to_print) < 4  :
        #       print keys,scores_to_print,data.keys()
    print ";".join(scores_to_print)
data.close()