Public Member Functions | |
def | __init__ |
def | numls |
def | numruns |
def | runs |
def | runsandls |
Private Attributes | |
__filename | |
__result | |
__strresult |
Definition at line 12 of file csvLumibyLSParser.py.
def csvLumibyLSParser::csvLumibyLSParser::__init__ | ( | self, | |
filename | |||
) |
Definition at line 13 of file csvLumibyLSParser.py.
00014 : 00015 self.__result={} 00016 self.__strresult={} 00017 self.__filename=filename 00018 csvReader=csv.reader(open(filename),delimiter=',') 00019 oldRun=0 00020 runnumber=0 00021 ldict = {} 00022 llist = [] 00023 NonValidLumi = 0 00024 lastLumi = 0 00025 for row in csvReader: 00026 field0=str(row[0]).strip() 00027 fieldsplit=re.split(':',field0) 00028 runstring = fieldsplit[0] 00029 try: 00030 field1=str(row[1]).strip() 00031 fieldsplit=re.split(':',field1) 00032 lsstring = fieldsplit[0] 00033 except Exception,e: 00034 lsstring='1' # for list with run number only, fake lsnum 00035 if not is_intstr(runstring) or not is_intstr(lsstring): 00036 continue 00037 runnumber=int(runstring) 00038 lsnumber=int(lsstring) 00039 00040 if runnumber != oldRun: 00041 if oldRun>0: 00042 self.__result[oldRun]=ldict 00043 ldict = {} 00044 oldRun = runnumber 00045 lastLumi = 0 00046 NonValidLumi = 0 00047 else: 00048 oldRun = runnumber 00049 00050 try: 00051 delivered, recorded = float( row[5] ), float( row[6] ) 00052 except: 00053 print 'Record not parsed, Run = %d, LS = %d' % (runnumber, lsnumber) 00054 00055 # Commented out... If there is no value, there is no interpolation now... 00056 # if recorded>0 : 00057 # lastLumi = recorded 00058 # if NonValidLumi>0: 00059 # # have to put real values in lumi list 00060 # for lnum in llist: 00061 # elems = [delivered, recorded] 00062 # ldict[lnum] = elems 00063 # NonValidLumi=0 00064 # llist = [] 00065 # else: 00066 # if lastLumi>0: 00067 # recorded = lastLumi 00068 # else: 00069 # # have to save lumi sections to fill once we get a non-zero lumi value 00070 # llist.append(lsnumber) 00071 # NonValidLumi=1 00072 00073 elems = [ delivered,recorded ] 00074 ldict[lsnumber]=elems 00075 00076 self.__result[runnumber]=ldict #catch the last one
def csvLumibyLSParser::csvLumibyLSParser::numls | ( | self, | |
run | |||
) |
Definition at line 89 of file csvLumibyLSParser.py.
def csvLumibyLSParser::csvLumibyLSParser::numruns | ( | self | ) |
Definition at line 87 of file csvLumibyLSParser.py.
def csvLumibyLSParser::csvLumibyLSParser::runs | ( | self | ) |
Definition at line 77 of file csvLumibyLSParser.py.
def csvLumibyLSParser::csvLumibyLSParser::runsandls | ( | self | ) |
return {run:lslist}
Definition at line 79 of file csvLumibyLSParser.py.
Definition at line 13 of file csvLumibyLSParser.py.
Definition at line 13 of file csvLumibyLSParser.py.
Definition at line 13 of file csvLumibyLSParser.py.