from statlib import stats
from datetime import timedelta
from statlib import stats
from datetime import timedelta
-DEFAULT_STATS = ('geometricmean',
- 'harmonicmean',
- 'mean',
- 'median',
- 'medianscore',
+DEFAULT_STATS = (#'geometricmean',
+ #'harmonicmean',
+ #'mean',
+ ('median', 'Médiane'),
+ #'medianscore',
- 'moment',
- 'variation',
- 'skew',
- 'kurtosis',
+ #'moment',
+ ('variation', 'Variation'),
+ #'skew',
+ ('kurtosis', 'Kurtosis'),
#'itemfreq',
#'histogram',
#'cumfreq',
#'itemfreq',
#'histogram',
#'cumfreq',
def statsresults(m) :
def computeList(self):
l = m(self)
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) :
return computeList
class LogFileAnalyser(LogFileReader) :
def chooseDirDialog(self, dir=None) :
if dir is None :
def chooseDirDialog(self, dir=None) :
if dir is None :
- self.logDir = tkFileDialog.askdirectory()
+ self.logDir = tkFileDialog.askdirectory(title='Sélectionnez un dossier de fichiers de logs')
else :
self.logDir = dir
if self.logDir :
self.logFiles = glob(pjoin(self.logDir, '*.log'))
self._cleanupJunkFiles()
self.logFiles.sort()
else :
self.logDir = dir
if self.logDir :
self.logFiles = glob(pjoin(self.logDir, '*.log'))
self._cleanupJunkFiles()
self.logFiles.sort()
+ self.logFiles.reverse()
self.dataFrame.grid(row=0, column=0, sticky=NW)
self.nav.setSize(len(self.logFiles))
self.nav.grid(row=0, column=1)
self.dataFrame.grid(row=0, column=0, sticky=NW)
self.nav.setSize(len(self.logFiles))
self.nav.grid(row=0, column=1)
if not getsize(f) :
os.remove(f)
continue
if not getsize(f) :
os.remove(f)
continue
- # TODO : vérifier qu'il existe des événements
+ lfa = LogFileAnalyser(f)
+ if lfa.getLastEventTicks() is None :
+ os.remove(f)
+ continue
+
files.append(f)
self.logFiles = files
files.append(f)
self.logFiles = files
for l in self.getBackwardLineIterator() :
if l.startswith('EVT ') :
break
for l in self.getBackwardLineIterator() :
if l.startswith('EVT ') :
break
lastTicks = int(l.split(None, 2)[1])
return lastTicks
lastTicks = int(l.split(None, 2)[1])
return lastTicks