@@ -79,7 +79,7 @@ def main():
7979 test = subparsers .add_parser ('Test' , help = '''\
8080 Runs Testing Utililty''' )
8181
82- can .add_argument ('--multi' , '-m' , type = int , default = 10 , metavar = 'x' , help = '''\
82+ can .add_argument ('--multi' , '-m' , type = int , default = 50 , metavar = 'x' , help = '''\
8383 Displays x most similar MATs''' )
8484 test .add_argument ('--plural' , '-p' , type = int , default = 20 , metavar = 'x' , help = '''\
8585 Splits this many of the MATs into 2.''' )
@@ -104,22 +104,28 @@ def doit(algorithm, tested, num, testing=False):
104104 if algorithm in (None , ['defaults' , ], 'defaults' ):
105105 algorithm = defs .algorithm
106106 if tested is not None :
107+ chain = itertools .chain .from_iterable
107108 importkeys = []
108109 for a , b in zip (algorithm [:- 3 :4 ], algorithm [1 :- 2 :4 ]):
109110 importkeys += [a , b ]
110111 table = importer (importkeys , testing = testing )[0 ]
111112 retresults = []
112113 with multiprocess .Pool (processes = defs .threadcount ) as pool :
113114 partthing = partial (tester , table , algorithm = algorithm , number = num , testing = testing )
114- for result in pool .imap_unordered (partthing , tested ):
115+ if len (tested ) > 1 :
116+ first = [partthing (tested .pop () go = 0 ), ]
117+ partthing = partial (tester , table , algorithm = algorithm , number = num , testing = testing , go = 1 )
118+ else :
119+ first = []
120+
121+ for result in chain (first , pool .imap_unordered (partthing , tested )):
115122 print ('{} is most similar to {}\n ' .format (result [2 ], ' then ' .join (result [0 ])), flush = True )
116123 retresults .append ((result [2 ], result [1 ]))
117124 if testing :
118125 return retresults
119126 else :
120127 with open ('result.csv' , 'w' , encoding = 'utf-16' ) as resultsfile :
121128 print ('Writing results to file...' , flush = True )
122- chain = itertools .chain .from_iterable
123129 fields = sorted (list (chain (['Average ' + x , 'Subject ' + x ] for x in defs .ProgressScoreHeaders )))
124130 writer = csv .DictWriter (resultsfile , fieldnames = ['MAT' , ] + fields )
125131 writer .writeheader ()
0 commit comments