Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:14:57

0001 import csv
0002 import matplotlib.pyplot as plt
0003 import numpy as np
0004 
0005 # Data preparation
0006 muDict = {}
0007 
0008 # Open the output file
0009 with open("output.log", mode="r") as csv_file:
0010     csv_reader = csv.reader(csv_file, delimiter=",")
0011     # read lines and go for it
0012     for csv_row in csv_reader:
0013         if len(csv_row) > 1:
0014             # get the job id
0015             jobID = csv_row[0]
0016             # mu, mode, exec time
0017             mode = float(csv_row[1])
0018             mu = int(csv_row[2])
0019             exectime = float(csv_row[3])
0020 
0021             # Make sure you have all the keys ready
0022             try:
0023                 mdict = muDict[mu]
0024             except:
0025                 muDict[mu] = {}
0026                 mdict = muDict[mu]
0027 
0028             # Now fill the sub dictionary
0029             try:
0030                 vmdict = mdict[mode]
0031             except:
0032                 mdict[mode] = []
0033                 vmdict = mdict[mode]
0034 
0035             vmdict += [exectime]
0036 
0037 # plot the muDict
0038 plt.figure(figsize=(7, 5))
0039 
0040 ax = plt.subplot(111)
0041 plt.plot(
0042     muDict.keys(),
0043     [i[0][0] for i in np.array(list(muDict.values()))],
0044     "-+",
0045     label="$\chi^{2}$<15, $n_{source link}  <=10$",
0046 )
0047 plt.plot(
0048     muDict.keys(),
0049     [i[1][0] for i in np.array(list(muDict.values()))],
0050     "-*",
0051     label="$\chi^{2}$<10, $n_{source link}=1$",
0052 )
0053 ax.set_xlabel("$<\mu>$")
0054 ax.set_ylabel("time/event [Sec]")
0055 ax.set_xlim((0, 250))
0056 plt.legend(numpoints=1)
0057 
0058 plt.suptitle("CKF timing vs. $<\mu>$")
0059 
0060 plt.show()