refined evaluation script

This commit is contained in:
Daniel Schick 2024-03-15 17:17:30 +01:00
parent 7d4ec5de59
commit 23ce2b9088

View File

@ -12,20 +12,23 @@ from collections import deque
abspath = os.path.abspath(__file__)
dname = os.path.dirname(abspath)
outputFileName = dname + "\\" + 'output.csv'
outputFileNameDBH = dname + "\\" + 'output_dbh.csv'
outputFileNameHISNORD = dname + "\\" + 'output_hisnord.csv'
# open the output file
outputFile = open(outputFileName, 'w')
# open the output files
outputFileDBH = open(outputFileNameDBH, 'w')
outputFileHISNORD = open(outputFileNameHISNORD, 'w')
# write the header
outputFile.write('Receive time, Duration\n')
outputFileDBH.write('Receive time, Duration, Message class, Attempts\n')
outputFileHISNORD.write('Receive time, Duration, message class, Attemps\n')
# open the log files
q = deque()
for i in range(0, 10):
for i in range(1, -1, -1):
logFileName = dname + "\\" + 'log-NSWMessageService.txt.' + str(i)
logFile = open(logFileName, 'r')
@ -38,6 +41,8 @@ for i in range(0, 10):
# get substring of the date
dateString = line[0:19]
# kept old code for reference, but it does nothing
if "Upload of" in line:
# add the dateString to the queue
q.appendleft(dateString)
@ -54,9 +59,21 @@ for i in range(0, 10):
# calculate the duration
duration = currentdate - lastdate
outputFile.write(dateString + "," + str(duration.seconds) + "\n")
# outputFile.write(dateString + "," + str(duration.seconds) + "\n")
if "MessageTelemetry" in line:
his = line[72:81].strip()
msg_class = line[83:91].strip()
duration = line[93:98]
tries = line[100:102]
if his == 'DUDR':
outputFileHISNORD.write(dateString + "," + duration + "," + msg_class + "," + tries + "\n")
elif his == 'DBH':
outputFileDBH.write(dateString + "," + duration + "," + msg_class + "," + tries + "\n")
# close the log file
logFile.close()
outputFile.close()
outputFileDBH.close()
outputFileHISNORD.close()