/
oldtimer.py
executable file
·716 lines (583 loc) · 24.5 KB
/
oldtimer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
#!/usr/bin/python
# oldtimer.py
# Analyzes ChaNGa logs, prints statistics, and plots.
# Author: Ian Smith
# 2011-08-22
import pdb
import sys
import re
import os
import platform
import matplotlib
import numpy as np
import pylab as py
# PySide imports
from PySide.QtGui import *
from ui_oldtimer import *
#### begin GUI ####
class MainWindow(QMainWindow, Ui_MainWindow):
DEFAULT_LOGNAME = "Log"
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
self.setupUi(self)
# List of openLog objects
self.openLogs = []
# List of bar plots, because py.bar() doesn't draw new bars next to preexisting data
self.barPlots = []
# Setup menu actions
self.action_Open.triggered.connect(self.openFile)
# Setup button actions
self.buttonPlot.clicked.connect(self.plot)
# Set disabled plot button
self.buttonPlot.setEnabled(False)
# Set Axis combo to repopulate when Log combo is changed
self.comboYLog.currentIndexChanged.connect(self.updateAxes)
def openFile(self):
filename, filtr = QtGui.QFileDialog.getOpenFileName(self)
if filename:
self.loadFile(filename)
def loadFile(self, filename):
print "Opening %s..." % filename
try:
f = open(filename, 'r')
except IOError:
print "Cannot open %s" % filename
else:
logLines = f.readlines()
f.close()
# Create ChangaLog
logobject = ChangaLog(logLines)
# Add ChangaLog and other metadata to openLogs
self.openLogs.append( openLog(filename, self.getLogName(filename), logobject) )
# Update the mainwindow widgets to reflect new log
self.updateMainWindow()
self.buttonPlot.setEnabled(True)
#
# TODO: Make a new textEdit for each opened log
# self.textEdit1.insertPlainText(''.join(logLines))
def updateAxes(self, changalog):
# Get selected log name from combo box
# Find log object with that name
# Redo combo axes with possible axes for that log
logname = self.comboYLog.currentText()
logobject = None
for log in self.openLogs:
if log.logname == logname:
logobject = log.logobject
if logobject is not None:
self.comboYAxis.clear()
self.comboYAxis.addItems(logobject.getAxes())
def updateMainWindow(self):
self.comboYAxis.clear()
self.comboYLog.clear()
self.comboResolution.clear()
for log in self.openLogs:
self.comboYLog.addItem(log.logname)
self.comboResolution.addItems(ChangaLog.RESOLUTION_LIST)
def getLogName(self, filename):
goodname = False
while not goodname:
prompt = os.path.basename(filename) + "\n\n" + 'Enter a name for this log: '
name, ok = QInputDialog.getText(self, 'Log name', prompt)
if ok and name:
if name in [log.logname for log in self.openLogs]:
msgBox = QMessageBox()
msgBox.setText('Choose a unique name')
msgBox.exec_()
else:
goodname = True
return name
def plot(self):
# Call createPlot with data points from logs and axes specified by comboboxes
points = []
resolution = self.comboResolution.currentText()
axisYName = self.comboYAxis.currentText()
logYName = self.comboYLog.currentText()
#pdb.set_trace()
if resolution == 'Big step' or resolution == 'Sub step':
for log in self.openLogs:
if log.logname == logYName:
points = log.logobject.getData(axisYName, resolution)
# if len(pointsY) != len(pointsX):
# msgBox = QMessageBox()
# msgBox.setText("Y and X axis data not of equal length\n\nY: " + str(len(pointsY)) + "\nX: " + str(len(pointsX)))
# msgBox.exec_()
# return
createPlot(points['yData'], points['xData'], points['xLabels'], points['annotations'], logYName + '.' + axisYName, resolution, self.checkBoxStep.isChecked(), self.checkBoxAnnotate.isChecked())
elif resolution == 'Summed rungs':
for log in self.openLogs:
if log.logname == logYName:
points = log.logobject.getSummedRungs(axisYName)
createBarPlot(self.barPlots, points['yData'], points['xData'], logYName + '.' + axisYName, resolution)
#### end GUI ####
# Class RungIndex keeps info about a step on a rung, such as
# the rung number from and to which the step is calculated, and the
# line numbers of beginning and end of rung step in the log.
class RungIndex:
def __init__(self):
self.fromRung = -1
self.toRung = -1
self.fromIndex = -1
self.toIndex = -1
self.gravityActive = -1
self.gasActive = -1
self.step = -1
def __repr__(self):
return "rung: " + str(self.fromRung) + " to " + str(self.toRung) + " from index " + str(self.fromIndex) + " to " + str(self.toIndex) + "(Gravity: " + str(self.gravityActive) + ")"
# Struct containing metadata about an open log
class openLog():
def __init__(self, filename, logname, logobject):
self.filename = filename
self.logname = logname
self.logobject = logobject
class ChangaLog():
# Regex constants to search for key words in logfile
RE_RUNG_DISTRIBUTION = 'Rung distribution'
RE_DONE = 'Done.'
RE_BIG_STEP_LINE = 'Big step'
# Find number between 'took' and 'seconds'
RE_TOOK_SECONDS = '(?<=took.)([0-9]*\.?[0-9]+).(?=seconds)'
RE_BALANCER = 'Load balancer'
RE_BUILD_TREES = 'Building trees'
RE_GRAVITY = 'Calculating gravity'
RE_DENSITY = 'Calculating densities'
RE_MARK_NEIGHBOR = 'Marking Neighbors'
RE_DENSITY_OF_NEIGHBOR = 'Density of Neighbors'
RE_PRESSURE_GRADIENT = 'Calculating pressure gradients'
RE_DOMAIN_DECOMP = 'Domain decomposition'
# Step as first word on line
RE_SUB_STEP = '^Step:'
RE_GRAVITY_ACTIVE = '(?<=Gravity Active:.)([0-9]*\.?[0-9]+).'
RE_CONSPH = 'Calculating gravity and SPH'
# Text that indicates if +consph is set
RE_ISCONSPH = 'Calculating gravity and SPH'
# List of Axes
AXES_LIST = ['TotalStepTime', 'DomainDecompTimes', 'BalancerTimes', 'BuildTreesTimes', 'GravityTimes', 'DensityTimes', 'MarkNeighborTimes', 'DensityOfNeighborTimes', 'PressureGradientTimes']
CONSPH_AXES_LIST = ['TotalStepTime', 'DomainDecompTimes', 'BalancerTimes', 'BuildTreesTimes', 'ConsphTimes']
# List of resolutions
RESOLUTION_LIST = ['Big step', 'Sub step', 'Summed rungs']
def __init__(self, loglines):
# Boolean indicating whether this log is for a +consph run
# consph runs don't have valid times for gravity, density, marking neighbors, pressure gradients,
# or density of neighbors. But they do have a valid time for: calculating gravity and SPH
self.isconsph = self.findKeyword(loglines, ChangaLog.RE_ISCONSPH) is not None
print "Is consph?:", self.isconsph
# Do parsing of entire log to build dictionary of times
self.parselog(loglines)
# Returns line of text from a list of lines containing first occurence of keyword, or None if not found
def findKeyword(self, lines, keyword):
for line in lines:
if keyword in line:
return line
return None
# Begins the parsing of a log file
# list fullLog: list of lines in logfile
# string logName: name of log
def parselog(self, loglines):
# Break up log into list of Big steps
# Each bigStep is a dictionary, where 'logLines' contains all the text lines in that step
self.bigSteps = []
for bigStepText in self.getBigStepsLines(loglines):
self.bigSteps.append( { 'LogLines' : bigStepText } )
# Dictionary of stats and info calculated now, and stored for later use
for index, bigStep in enumerate(self.bigSteps):
bigStep['StepNumber'] = index + 1 # First big step is #1, not #0
bigStep['TotalStepTime'] = self.getStepTime(bigStep)
bigStep['DomainDecompTimes'] = self.getStepKeywordTimes(bigStep, ChangaLog.RE_DOMAIN_DECOMP)
bigStep['BalancerTimes'] = self.getStepKeywordTimes(bigStep, ChangaLog.RE_BALANCER)
bigStep['BuildTreesTimes'] = self.getStepKeywordTimes(bigStep, ChangaLog.RE_BUILD_TREES)
if self.isconsph:
bigStep['ConsphTimes'] = self.getStepKeywordTimes(bigStep, ChangaLog.RE_CONSPH)
else:
bigStep['GravityTimes'] = self.getStepKeywordTimes(bigStep, ChangaLog.RE_GRAVITY)
bigStep['DensityTimes'] = self.getStepKeywordTimes(bigStep, ChangaLog.RE_DENSITY)
bigStep['MarkNeighborTimes'] = self.getStepKeywordTimes(bigStep, ChangaLog.RE_MARK_NEIGHBOR)
bigStep['DensityOfNeighborTimes'] = self.getStepKeywordTimes(bigStep, ChangaLog.RE_DENSITY_OF_NEIGHBOR)
bigStep['PressureGradientTimes'] = self.getStepKeywordTimes(bigStep, ChangaLog.RE_PRESSURE_GRADIENT)
# Rung indexes stored as a list of rung objects
bigStep['RungIndexes'] = self.getRungIndexes(bigStep)
#print bigStep['RungIndexes']
# print bigStep['GravityTimes']
self.printStats()
#self.getCommand(bigSteps)
return
# TODO: this is very dirty, clean up rung search
def getRungIndexes(self, bigStep):
rungIndexes = []
lastIdx = None
for i, line in enumerate(bigStep['LogLines']):
if "Rungs" in line:
# dirty part to fix
s, rungLine = line.split("Rungs")
rungLine.strip()
firstRung, secRung = rungLine.split("to")
secRung, s = secRung.split(".")
firstRung = int(firstRung)
secRung = int(secRung)
idx = RungIndex()
idx.step = bigStep['StepNumber']
idx.fromRung = firstRung
idx.toRung = secRung
idx.fromIndex = i
# Set active gravity particles
# ex: Gravity Active: 1021611, Gas Active: 1021610
grav, gas = s.split(",")
s, grav = grav.split(":")
grav.strip()
idx.gravityActive = int(grav)
# TODO: set active gas particles
# Set the toIndex of the last RungIndex
if lastIdx is not None:
lastIdx.toIndex = idx.fromIndex - 1
rungIndexes.append(idx)
lastIdx = idx
# If this is the last line then set the toIndex
if lastIdx is not None:
lastIdx.toIndex = i
return rungIndexes
# Returns a list of axis names that this log recognizes as plottable
def getAxes(self):
if self.isconsph:
return ChangaLog.CONSPH_AXES_LIST
else:
return ChangaLog.AXES_LIST
# Returns a dictionary of 4 lists, 'yData' is Y axis points,
# 'xData' is X axis points,
# 'xLabels' is X axis tick labels,
# 'annotations' is point annotations,
# for this log for the specified axis
def getData(self, axis, resolution):
yData = []
xData = []
xLabels = []
annotations = []
if resolution == 'Big step':
if axis == 'TotalStepTime':
yData = self.getAllStepsTimes()
else:
yData = self.getAllStepsKeywordTimes(axis)
xData = np.arange(1, len(yData) + 1)
elif resolution == 'Sub step':
obj = self.getRungs(axis)
yData = obj['yData']
xData = obj['xData']
xLabels = obj['xLabels']
annotations = obj['annotations']
return {'yData': yData, 'xData': xData, 'xLabels': xLabels, 'annotations': annotations}
# Returns [y, x], where:
# y ~= [
# x ~= ['Rung 3 to 4']
def getSummedRungs(self, axis):
y = []
x = []
rungsTimes = []
for step in self.bigSteps:
rungTime = {}
for rung in step['RungIndexes']:
if not rung.fromRung in rungTime:
rungTime[rung.fromRung] = []
rungTime[rung.fromRung].append(self.getStepAxisTotalTimeBetweenIndexes(step, axis, rung.fromIndex, rung.toIndex))
#print step[axis]
#print step['RungIndexes']
for key in rungTime:
y.append(sum(rungTime[key]))
# If Rung 0 then label step number
xtick = ''
if key == 0:
xtick = 'Step ' + str(step['StepNumber']) + ', Rung ' + str(key)
else:
xtick = 'Rung ' + str(key)
x.append(xtick)
return {'yData': y, 'xData': x}
def getStepAxisTotalTimeBetweenIndexes(self, step, axis, fromIndex, toIndex):
time = 0
for idx, subStepTime in step[axis]:
if idx >= fromIndex and idx <= toIndex:
time += subStepTime
return time
# Returns [y, x], where:
# y ~= [
# x ~= ['Rung 3 to 4']
# axis: string of axis keyword
def getRungs(self, axis):
yData = []
xData = []
annotations = []
xLabels = []
rungList = []
for step in self.bigSteps:
for rung in step['RungIndexes']:
rungList.append(rung)
yData.append(self.getStepAxisTotalTimeBetweenIndexes(step, axis, rung.fromIndex, rung.toIndex))
xData = np.arange(1, len(yData) + 1)
# Make labels
# Rung 0 is last rung of step, so add step number to next step.
# Also add step number to very first label
prevStep = -1
for rung in rungList:
label = ''
if prevStep != rung.step:
prevStep = rung.step
label += 'Step ' + str(rung.step) + ': '
label += str(rung.fromRung) + ' to ' + str(rung.toRung)
xLabels.append(label)
annotations = [str(rung.gravityActive) for rung in rungList]
return {'yData': yData, 'xData': xData, 'xLabels': xLabels, 'annotations':annotations}
def getSubStepsKeywordTimes(self, keyword):
timeList = []
labelList = []
annotationList = []
for step in self.bigSteps:
rungTime = {}
for rung in step['RungIndexes']:
if not rung.fromRung in rungTime:
rungTime[rung.fromRung] = []
rungTime[rung.fromRung].append(self.getStepAxisTotalTimeBetweenIndexes(step, axis, rung.fromIndex, rung.toIndex))
# for e in [num for idx, num in step[keyword]]: # time is [1]
# print e
# timeList.append(e)
return [timeList, labelList, annotationList]
# Prints statistics for entire log
def printStats(self):
# individual step stats
for bigStep in self.bigSteps:
if bigStep['StepNumber'] == 0:
print "Init:"
else:
print "Big step: ", bigStep['StepNumber']
print " Domain Decomp time: ",
printListStats([num for idx, num in bigStep['DomainDecompTimes']])
print " LB time: ",
printListStats([num for idx, num in bigStep['BalancerTimes']])
print " Build trees time: ",
printListStats([num for idx, num in bigStep['BuildTreesTimes']])
if self.isconsph:
print " Concurrent SPH time: ",
printListStats([num for idx, num in bigStep['ConsphTimes']])
else:
print " Gravity time: ",
printListStats([num for idx, num in bigStep['GravityTimes']])
print " Density time: ",
printListStats([num for idx, num in bigStep['DensityTimes']])
print " Mark Neighbor time: ",
printListStats([num for idx, num in bigStep['MarkNeighborTimes']])
print " Density of Neighbor time:",
printListStats([num for idx, num in bigStep['DensityOfNeighborTimes']])
print " Pressure Gradient time: ",
printListStats([num for idx, num in bigStep['PressureGradientTimes']])
print " Big step time (r): ", bigStep['TotalStepTime']
# total stats
print " - - - - - - - - - -"
# subtract one for init
print "Total Big steps: ", self.getNumBigSteps()
print "Total Domain Decomp times: ",
printListStats(self.getAllStepsKeywordTimes('DomainDecompTimes'))
print "Total LB times: ",
printListStats(self.getAllStepsKeywordTimes('BalancerTimes'))
print "Total Build trees times: ",
printListStats(self.getAllStepsKeywordTimes('BuildTreesTimes'))
if self.isconsph:
print "Total Concurrent SPH times: ",
printListStats(self.getAllStepsKeywordTimes('ConsphTimes'))
else:
print "Total Gravity times: ",
printListStats(self.getAllStepsKeywordTimes('GravityTimes'))
print "Total Density times: ",
printListStats(self.getAllStepsKeywordTimes('DensityTimes'))
print "Total Mark Neighbor times: ",
printListStats(self.getAllStepsKeywordTimes('MarkNeighborTimes'))
print "Total Density of Neighbor times:",
printListStats(self.getAllStepsKeywordTimes('DensityOfNeighborTimes'))
print "Total Pressure Gradient times: ",
printListStats(self.getAllStepsKeywordTimes('PressureGradientTimes'))
print "Total Big Step (r) times: ",
printListStats(self.getAllStepsTimes())
return
def getStepKeywordTimes(self, step, keyword):
timeList = []
for index, line in enumerate(step['LogLines']):
if keyword in line:
p = re.search(ChangaLog.RE_TOOK_SECONDS, line)
if p is not None:
timeList.append([index, float(p.group())])
return timeList
# Returns the total time reported for a single big step ('Big step 1 took 10.0 seconds')
def getStepTime(self, step):
for line in step['LogLines']:
if ChangaLog.RE_BIG_STEP_LINE in line:
p = re.search(ChangaLog.RE_TOOK_SECONDS, line)
if p is not None:
return float(p.group())
return 0.0
## LOGFILE ALL STEPS TOTALS ##
# Returns total balancer time for list of steps
def getAllStepsKeywordTimes(self, keyword):
timeList = []
for step in self.bigSteps:
timeList.append(calcSum([num for idx, num in step[keyword]]))
return timeList
def getAllStepsTimes(self):
timeList = []
for step in self.bigSteps:
timeList.append(self.getStepTime(step))
return timeList
# Returns the number of big steps in the list of big steps
# list bigSteps: list of big step dictionaries
def getNumBigSteps(self):
return len(self.bigSteps)
def getNumSubSteps(self):
steps = 0
for step in self.bigSteps:
for e in step['GravityTimes']:
steps += 1
return steps
# Returns a list of file objects where each object is a Big step
# list fullLog: list of lines in logfile
def getBigStepsLines(self, fullLog):
# bigSteps is a list of big steps
bigStepsLines = []
# bigStep is a list of lines in a single step
bigStep = []
# TODO: add in small big step 0 (which is only rungs 0 to x)
for line in fullLog:
bigStep.append(line)
if ChangaLog.RE_BIG_STEP_LINE in line:
bigStepsLines.append(tuple(bigStep))
bigStep = []
# "Done." signals the proper exit of ChaNGa
if ChangaLog.RE_DONE in line:
return bigStepsLines
return bigStepsLines
def printAxesList(self):
print "Axes: ", ChangaLog.AXES_LIST
return
# Print the filename and other file info:
# number of lines
# Returns with the file position reset to 0
# file object f: file object
def printTitle(f):
f.seek(0)
print f.name, ':'
print "Lines: ", repr(len(f.readlines())).rjust(3)
print
f.seek(0)
return
def createPlot(dataY, dataX, ticksX, annotations, axisY, axisX, dostep, doannotate):
if not ticksX:
ticksX = dataX
if dostep:
py.step(dataX, dataY, where='post', linestyle='-', label=axisY) # where=post steps after point
else:
py.plot(dataX, dataY, marker='o', ms=5.0, linestyle='-', label=axisY)
if annotations and doannotate:
for note, x, y in zip(annotations, dataX, dataY):
py.annotate(note, (x, y), xytext=(2,2), xycoords='data', textcoords='offset points')
py.xticks(np.arange(1, len(dataX)+1), ticksX, horizontalalignment='left', rotation=30)
leg = py.legend()
leg.draggable()
py.xlabel(axisX)
py.ylabel('time (s)')
# Set X axis tick labels as rungs
#print zip(dataX, dataY)
py.draw()
py.show()
return
def createBarPlot(plotList, dataY, dataX, axisY, axisX):
colorList = ['b', 'g', 'y', 'r', 'm', 'c', 'k']
width = 0.35
x = np.arange(len(dataY))
thisColor = colorList[len(plotList)%len(colorList)]
py.bar(x+(width-0.1)*len(plotList), dataY, width, color=thisColor, label=axisY)
py.xticks(x, dataX, rotation=30, size='small')
py.xlabel(axisX)
py.ylabel('time (s)')
leg = py.legend()
leg.draggable()
plotList.append([dataY, dataX, axisY, axisX])
py.draw()
py.show()
# py.close()
#def getCommand(bigSteps):
# print
# print
# printAxesList()
# print
# print "Ready to plot."
# ri = ""
# plotNum = 0
# while True:
#
# ri = raw_input("Choose your axes (y, x) or type exit: ")
# if (ri == 'exit') or (ri == 'quit'):
# break
# try:
# yAxis, xAxis = ri.split(',')
# except ValueError:
# # TODO: loop on bad input
# print "Error: Bad formatting"
# else:
# yAxis = yAxis.strip()
# xAxis = xAxis.strip()
#
# if (xAxis not in ChangaLog.AXES_LIST) or (yAxis not in ChangaLog.AXES_LIST):
# print "Error: Unrecognized axis"
# else:
# createPlot(yAxis, xAxis, bigSteps, plotNum)
# plotNum += 1
# return
## CALCULATIONS ##
# Prints a line with stats about the numbers in the list
# min, max, avg, sigma
# list : a list of floats
def printListStats(flist):
if len(flist) == 0:
print "No data"
return
else:
print calcSum(flist),
print "avg:", calcAverage(flist),
print "min:", calcMin(flist),
print "max:", calcMax(flist),
print "std:", calcStd(flist)
# Returns average of a list of floats
def calcAverage(flist):
if not list:
return 0.0
return np.mean(flist)
def calcSum(flist):
if not list:
return 0.0
return sum(flist)
def calcMin(flist):
if not list:
return 0.0
return min(flist)
def calcMax(flist):
if not list:
return 0.0
return max(flist)
def calcStd(flist):
if not list:
return 0.0
return np.std(flist)
#### MAIN ####
def main(*args):
app = QApplication(sys.argv)
mw = MainWindow()
mw.show()
app.exec_()
# # get logfile names list from command line
# logFiles = args[1:]
# for logFile in logFiles:
# try:
# f = open(logFile, 'r')
# except IOError:
# print 'Cannot open', logFile
# else:
# printTitle(f)
# fullLog = f.readlines()
# f.close()
#
# parseLog(fullLog)
if __name__ == '__main__':
sys.exit(main(*sys.argv))