Example #1
0
for fName in sys.argv[1:] :
  f = file( fName )
  results = pickle.load( f )
  
  if isinstance( results, tuple ):
    results = key_vote_lib.computeMachs( results )
  
  key_vote_lib.countLost( results, scores )
  
  # for the individual ratios
  ratios.append( key_vote_lib.computeScores( key_vote_lib.countLost( results ) ) )
  
  f.close()
  
ratio = key_vote_lib.computeScores( scores )

sigma = {}
total = 0
for k in ratio.keys() :
  sum2 = 0
  for r in ratios :
    sum2 += math.pow( r[k] - ratio[k], 2 )
  s = math.sqrt( sum2 / len(ratios) )
  sigma[k] = s
  total += s

key_vote_lib.printScores( sigma, hands )
key_vote_lib.printStdOut()
key_vote_lib.printStdOut( u"Différence totale: " + str( total ) )
key_vote_lib.printKbdScores( sigma )
Example #2
0
#!/usr/bin/python
# -*- coding: utf-8 -*-

import sys, pickle, key_vote_lib

scores = {}
nbOfVotes = 0

for fName in sys.argv[1:] :
  f = file( fName )
  results = pickle.load( f )
  
  if isinstance( results, tuple ):
    results = key_vote_lib.computeMachs( results )
  
  key_vote_lib.countLost( results, scores )
  nbOfVotes += len( results )
  
  f.close()
  
print len(sys.argv[1:]), "participants,", nbOfVotes, "votes."
ratio = key_vote_lib.computeScores( scores )
key_vote_lib.printKbdScores( ratio )
Example #3
0
  
  if isinstance( results, tuple ):
    results = key_vote_lib.computeMachs( results )
  
  key_vote_lib.countLost( results, scores )
  nbOfVotes += len( results )
  
  f.close()
  
ratio = key_vote_lib.computeScores( scores )

# load the results to compare to the mean
singleResults = pickle.load( file( sys.argv[1] ) )
if isinstance( singleResults, tuple ):
  singleResults = key_vote_lib.computeMachs( singleResults )
singleScores = key_vote_lib.countLost( singleResults )
singleRatio = key_vote_lib.computeScores( singleScores )

# now, for the all the scores, compute the diff to the mean
singleDiff = {}
total = 0
for k, v in singleRatio.iteritems() :
  diff = abs( v - ratio[k] )
  singleDiff[k] = diff
  total += diff

key_vote_lib.printScores( singleDiff, hands )
key_vote_lib.printStdOut()
key_vote_lib.printStdOut( u"Différence totale: " + str( total ) )
key_vote_lib.printKbdScores( singleDiff )
Example #4
0
          elif ires == 2 or res == TEST: # le caractère est moins bon que le milieu
            max = middle-1 # le maximum est avant le milieu
            if max < min:
              results[handID].insert(middle, (c,)) # insertion après le milieu
            matchs[pair] = 2
          elif ires == 0: # les caractères sont aussi bons
            results[handID][middle] += (c,) # on ajoute au milieu
            max = min-1 # fin du test de ce caractère
            matchs[pair] = 0
        
        pickle.dump( matchs, file( resultFile, "w" ) )
        pickle.dump( results, file( sortedResultFile, "w" ) )
        
      untested.pop(0) # on supprime le caractère de l'array
    

  # génère les duels comme dans la version de base
  base_results = key_vote_lib.computeMachs( results )

  # affichage des résultats
  key_vote_lib.printStdOut()
  # key_vote_lib.printStdOut( u'Vos votes :' )
  
  # calcul des matchs perdus/total pour chaque touche
  scores = key_vote_lib.computeScores( key_vote_lib.countLost( base_results ) )
  
  # affichage du résultat
  key_vote_lib.printScores( scores,kbd )
  key_vote_lib.printKbdScores( scores )
  key_vote_lib.readResult( u'appuyez sur Entrée pour quitter' )