ATLAS Offline Software
graphs.py
Go to the documentation of this file.
1 #Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 import os
4 import pandas as pd
5 
6 # Jennet averages over modules and saves TGraphs
7 def averageModules (suffix):
8 
9  blacklist = ["LI_S01_C_M4","LI_S03_A_M4","LI_S05_C_M4","LI_S11_A_M4","LI_S12_A_M4","LI_S13_C_M4"]
10 
11  indir = "/eos/atlas/user/j/jdickins/Pixel/LeakageCurrent/IBLData/processedData/means/"
12  header = ["unix-timestamp","HV_VMeas","start","intlumi","HV_VSet","volume","HV_VMeas_0","HV_VMeas_1","PP4LV","TModule","HV_IMeas","ENV_TT","I_Eg1.12","I_Eg1.21","I_Eg1.30"]
13 
14  df_concat = pd.DataFrame({})
15  # loop over modules and add the ones with the right suffix
16  for stave in range(1,15):
17  staveString = str(stave)
18  if stave<10:
19  staveString="0"+str(stave)
20  m = "LI_S" + str(staveString) + "_" + suffix
21  print(m)
22  this_infile = indir + m + ".ssv"
23  if m in blacklist:
24  print(m + " is blacklisted. Skipping...")
25  continue
26 
27  this_infile = indir + "LI_S" + str(staveString) + "_" + suffix + ".ssv"
28  this_df = pd.read_csv(this_infile, names=header, delimiter=',', skiprows=1)
29  df_concat = df_concat.append(this_df)
30 
31  df_avg = df_concat.groupby(df_concat.index).mean()
32  df_avg = df_avg[["intlumi","I_Eg1.12","I_Eg1.21","I_Eg1.30"]]
33 # df_avg.plot.scatter("intlumi","I_Eg1.12",marker=".")
34 
35 # print((1.0*max(df_avg["start"])-min(df_avg["start"]))/31557600,max(df_avg["intlumi"]))
36 
37  saveFileName = indir + suffix + ".ssv"
38  if os.path.exists(saveFileName):
39  os.remove(saveFileName)
40  df_avg.to_csv(saveFileName,index=False)
41 
42 # Begin script
43 def main():
44 
45  averageModules("A_M1")
46  averageModules("C_M1")
47  averageModules("A_M2")
48  averageModules("C_M2")
49  averageModules("A_M3")
50  averageModules("C_M3")
51  averageModules("A_M4")
52  averageModules("C_M4")
53 
54 if __name__ == "__main__":
55  main()
mean
void mean(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")
Definition: dependence.cxx:254
graphs.main
def main()
Definition: graphs.py:43
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
graphs.averageModules
def averageModules(suffix)
Definition: graphs.py:7
str
Definition: BTagTrackIpAccessor.cxx:11
dbg::print
void print(std::FILE *stream, std::format_string< Args... > fmt, Args &&... args)
Definition: SGImplSvc.cxx:70