10 yield curr,
min(curr + delta, end)
23 if not os.path.exists(datesFileName):
24 print(
"No any file found! at " + datesFileName +
". Making default values")
26 with open(datesFileName,
'w')
as datesFile:
27 firstTempDate = datetime.datetime(2015,4,2,1,1,1,1)
28 lastTempDate = datetime.datetime(2015,4,2,1,1,1)
30 datesFile.write(
str(tempRun) +
" " +
str(firstTempDate) +
" " +
str(lastTempDate) +
"\n")
31 startingDates.append(firstTempDate)
32 endDates.append(lastTempDate)
36 print(
"Found " + datesFileName)
37 with open(datesFileName,
'r')
as datesFile:
39 for dateLine
in datesFile:
40 tempDatesLine = dateLine.split()
41 firstTemp = tempDatesLine[1].
split(
'-')
42 lastTemp = tempDatesLine[3].
split(
'-')
44 firstTempTime = tempDatesLine[2].
split(
':')
45 lastTempTime = tempDatesLine[4].
split(
':')
47 firstTempTimes = firstTempTime[2].
split(
'.')
48 lastTempTimes = lastTempTime[2].
split(
'.')
50 if len(firstTempTimes)<2:
51 firstTempTimes.append(0)
52 if len(lastTempTimes)<2:
53 lastTempTimes.append(0)
55 firstTempDate = datetime.datetime(
int(firstTemp[0]),
int(firstTemp[1]),
int(firstTemp[2]),
int(firstTempTime[0]),
int(firstTempTime[1]),
int(firstTempTimes[0]),
int(firstTempTimes[1]))
56 lastTempDate = datetime.datetime(
int(lastTemp[0]),
int(lastTemp[1]),
int(lastTemp[2]),
int(lastTempTime[0]),
int(lastTempTimes[0]),
int(lastTempTimes[0]),
int(lastTempTimes[1]))
58 startingDates.append(firstTempDate)
59 endDates.append(lastTempDate)
61 datesList=[startingDates,endDates]
64 outPath =
"/eos/atlas/user/j/jdickins/Pixel/LeakageCurrent/IBLData/processedData/Lumi/"
65 outputName = outPath +
"/runData.txt"
66 outputSummary = outPath +
"/runs.txt"
68 inPath =
"/eos/atlas/user/j/jdickins/Pixel/LeakageCurrent/IBLData/rawData/Lumi/"
70 [startDates,endDates] =
checkDates(outputSummary)
72 currentDay = datetime.date(2018,11,7)
73 firstDay = startDates[0].
date()
75 with open(outputName,
'a+')
as fout:
77 if firstDay + datetime.timedelta(days=1)<currentDay:
78 for s, e
in perdelta( firstDay, currentDay, datetime.timedelta(days=1)):
83 filename = inPath + s_str +
"-" + e_str +
".txt"
84 with open(filename,
"r")
as fin:
94 startDate = startDateTime.split(
'-')
95 startTime = startDateTime.split(
':')
96 start = datetime.datetime(
int(startDate[0]),
int(startDate[1]),
int(startDate[2].
split(
':')[0]),
int(startTime[1]),
int(startTime[2]),
int(startTime[3]))
98 endDateTime=array[1].
split(
'/UTC')[0]
99 endDate = startDateTime.split(
'-')
100 endTime = startDateTime.split(
':')
101 end = datetime.datetime(
int(endDate[0]),
int(endDate[1]),
int(endDate[2].
split(
':')[0]),
int(endTime[1]),
int(endTime[2]),
int(endTime[3]))
103 [run,lb] = array[2].
split(
'/')
107 intlumi = length*lumi
110 fout.write(
str(run) +
" " +
str(fill) +
" " +
str(lb) +
" " +
111 str(time.mktime(start.timetuple())) +
" " +
str(length) +
" " +
112 str(0) +
" " +
str(0) +
" " +
str(lumi) +
" " +
str(intlumi) +
116 with open(outputSummary,
'w')
as summaryFile:
117 summaryFile.write(
str(run) +
" " +
str(startDates[0]) +
" " +
str(end) +
"\n")