from minwii.logfilereader import LogFileReader
from pprint import pprint
from minwii.musicxml import musicXml2Song
+from minwii.globals import PLAYING_MODES
from statlib import stats
from datetime import timedelta
-DEFAULT_STATS = ('geometricmean',
- 'harmonicmean',
- 'mean',
- 'median',
- 'medianscore',
+PLAYING_MODES = dict(PLAYING_MODES)
+
+DEFAULT_STATS = (#'geometricmean',
+ ('harmonicmean', 'Moyenne harmonique'),
+ ('mean', 'Moyenne '),
+ ('median', 'Médiane'),
+ #'medianscore',
#'mode',
- 'moment',
- 'variation',
- 'skew',
- 'kurtosis',
+ #'moment',
+ ('variation', 'Variation'),
+ #'skew',
+ ('kurtosis', 'Kurtosis'),
#'itemfreq',
#'histogram',
#'cumfreq',
def statsresults(m) :
def computeList(self):
l = m(self)
- ret = {}
- for name in DEFAULT_STATS :
- ret[name] = getattr(stats, name)(l)
- return ret
+ results = []
+ for name, label in DEFAULT_STATS :
+ results.append('%s : %s' % (label, getattr(stats, name)(l)))
+ return '\n'.join(results)
+ computeList.__name__ = m.__name__
+ computeList.__doc__ = m.__doc__
return computeList
class LogFileAnalyser(LogFileReader) :
try :
self.mode = mode = self.getMode()
- results.append(('Mode de jeu', mode))
+ results.append(('Mode de jeu', PLAYING_MODES.get(mode, mode)))
for name in self.POSSIBLE_ANALYSES[mode] :
meth = getattr(self, name)
results.append((meth.__doc__, meth()))