-
Notifications
You must be signed in to change notification settings - Fork 0
/
GraphRapNew.py~
executable file
·153 lines (139 loc) · 7.61 KB
/
GraphRapNew.py~
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!/usr/bin/env python
from Params import *
import numpy as np
from ReadTxt import *
from MiscFuns import *
from FitParams import *
from StringFix import *
from GraphDataNew import *
from SetLists import CutDupSet
from OppFuns import CreateGammaList
import time,datetime
from MultiWrap import *
from multiprocessing import Pool
##Hard Code lists:
thisMethodList = ['RF']
# thisMethodList = MethodList
# thisMomList = ['q = 0 0 0', 'q = -1 0 0', 'q = -1 -1 0','q = -1 -1 -1','q = -2 0 0' , 'q = -2 0 -1', 'q = -2 -1 -1','q = -2 -2 0','q = -2 -2 -1','q = -3 0 0' ]
thisMomList = ['q = 0 0 0']
##
##datadict = { gamma } { mom } { method } { set }
##thisdatadict = { method } { set }
##thisGammaList format: D/S P4/3 Opp (e.g. doubP4g4)
##thisMomList in qstr format (e.g. 'q = 0 0 0')
##NB q = 0 0 0 MUST BE INCLUDED FOR TSF ETC
def progprint(numb,starttime,igamma):
print 'Graphing Operator: ' + igamma , int(numb*100/float(9)) , '% time taken:' , str(datetime.timedelta(seconds=time.time()-starttime)) ,' h:m:s \r',
def ReadAndPlotMass(thisMomList,thisSmearList,thisSetList,thisSetPoFLists,thisMethodList):
thisAllSetList = thisSmearList+thisSetList
for isetlist,dump in thisSetPoFLists[:len(thisSetPoFLists)/2]:
thisAllSetList += isetlist
datadict = ReadSetFitRFDict(outputdir,thisAllSetList,['twopt'],thisMethodList,thisMomList=thisMomList)
thisMassdict = datadict['twopt']['q = 0 0 0']
start = time.time()
for imom in thisMomList[-1:]:
momstart = time.time()
# print 'Plotting ' , imom , 'Mass \r',
thistwoptdict = datadict['twopt'][imom]
PlotMassData(thistwoptdict,thisSmearList+thisSetList,imom)
# print 'Plotting ' , imom , 'State Fits \r',
PlotMassSFData(thistwoptdict,thisSmearList+thisSetList,imom)
for ipof,(itpl,thistf) in enumerate(thisSetPoFLists):
# print 'Plotting ' , imom , 'PoFSets ', str(int((ipof*100)/len(thisSetPoFLists))),'% \r',
PlotMassData(thistwoptdict,thisSmearList+itpl,imom,TitleFlag=thistf)
print 'Plotting ' , imom, 'Took: ' , str(datetime.timedelta(seconds=(time.time()-momstart))) ,' h:m:s '
def ReadAndPlotDict(thisGammaList,thisMomList,thisSetList,thisMethodList):
datadict = ReadSetFitRFDict(outputdir,thisSetList,thisGammaList,thisMethodList,thisMomList=thisMomList)
thisGammaList = datadict.keys()
thisMassdict = datadict['twopt']['q = 0 0 0']
start = time.time()
for imom in thisMomList:
for icg,igamma in enumerate(thisGammaList):
if any([idst in igamma for idst in ['doub','sing','twopt']]): continue
gammastart = time.time()
timeleft = GetTimeLeft(icg,len(thisGammaList),time.time()-start)
if not CheckDict(datadict,igamma,imom): continue
thisdatadict = datadict[igamma][imom]
if kappa == 12090:
progprint(0,time.time(),igamma)
prevtime = time.time()
PlotTSinkData(thisdatadict,thisSetList,igamma,imom)
progprint(1,prevtime,igamma)
prevtime = time.time()
PlotTSinkData(thisdatadict,thisSetList,igamma,imom,thissm='state1'+REvecTvarList[0])
progprint(2,prevtime,igamma)
prevtime = time.time()
# PlotTSinkSumData(thisdatadict,thisSetList,igamma,imom)
# progprint(3,prevtime,igamma)
# prevtime = time.time()
# PlotTSinkSFData(thisdatadict,thisMassdict,thisSetList,igamma,imom,thisSF='TSFTsink')
# progprint(4,prevtime,igamma)
# prevtime = time.time()
# PlotTSinkSFData(thisdatadict,thisMassdict,thisSetList,igamma,imom,thisSF='TSFtest32')
# progprint(5,prevtime,igamma)
# prevtime = time.time()
# PlotTSinkSFData(thisdatadict,thisMassdict,thisSetList,igamma,imom,thisSF='TSFSmall')
# progprint(6,prevtime,igamma)
# prevtime = time.time()
# PlotTSinkSFData(thisdatadict,thisMassdict,thisSetList,igamma,imom,thisSF='OSFTsink')
# progprint(7,prevtime,igamma)
prevtime = time.time()
PlotCMData(thisdatadict,thisSetList,igamma,imom)
progprint(8,prevtime,igamma)
# PlotCMSFData(thisdatadict,thisMassdict,thisSetList,igamma,imom)
elif kappa == 12104:
PlotCMData(thisdatadict,thisSetList,igamma,imom)
# PlotCMSFData(thisdatadict,thisMassdict,['tsink29state1to18dt2'],igamma,imom,thisSF='SFREvec')
print 'Graphing Operator: ' + igamma + imom + ' took: ' , str(datetime.timedelta(seconds=(time.time()-gammastart))) ,' h:m:s '
thisGammaList = CreateGammaList(sys.argv[1:],twopt=True)
if thisGammaList == ['twopt']:
# thisMethodList = ['RF','OSFCM','TSFCM']
TvarPicked = ['tsink29'+str(istate) for istate in CreateMassSet([],['1'],[DefTvarPicked])]
thisSmList = ['tsink29'+str(ism) for ism in CreateMassSet(DefSmearList,['1'],[])]
# TvarLists = []
TvarLists = [(['tsink29'+str(istate) for istate in CreateMassSet([],['1'],DefTvarDt1)],'PoFDt1'),
(['tsink29'+str(istate) for istate in CreateMassSet([],['1'],DefTvarDt2)],'PoFDt2'),
(['tsink29'+str(istate) for istate in CreateMassSet([],['1'],DefTvarDt3)],'PoFDt3'),
(['tsink29'+str(istate) for istate in CreateMassSet([],['1'],DefTvarDt4)],'PoFDt4'),
(['tsink29'+str(istate) for istate in CreateMassSet([],['1'],DefTvarto16)],'PoFto16'),
(['tsink29'+str(istate) for istate in CreateMassSet([],['1'],DefTvarto17)],'PoFto17'),
(['tsink29'+str(istate) for istate in CreateMassSet([],['1'],DefTvarto18)],'PoFto18'),
(['tsink29'+str(istate) for istate in CreateMassSet([],['1'],DefTvarto19)],'PoFto19'),
(['tsink29'+str(istate) for istate in CreateMassSet([],['1'],DefTvarto20)],'PoFto20')]
thisAllSetList = thisSmList+TvarPicked
print 'AllSetList:\n' + '\n'.join(thisAllSetList)
print 'MethodList:\n' + '\n'.join(thisMethodList)
if DoMulticore:
inputparams = []
for imom in thisMomList:
if imom == 'q = 0 0 0':
inputparams.append(([imom],thisSmList,TvarPicked,TvarLists,thisMethodList))
else:
inputparams.append((['q = 0 0 0',imom],thisSmList,TvarPicked,TvarLists,thisMethodList))
makeContextFunctions(ReadAndPlotMass)
thisPool = Pool(min(len(inputparams),AnaProc))
output = thisPool.map(ReadAndPlotMass.mapper,inputparams)
thisPool.close()
thisPool.join()
else:
ReadAndPlotMass(thisGammaList,thisMomList,DefSetList,thisMethodList)
else:
if thisMomList == ['q = 0 0 0']:
# thisMethodList = thisMethodList
else:
thisMethodList = ['RF']
print 'MethodList:\n' + '\n'.join(thisMethodList)
print 'thisSetList:\n' + '\n'.join(DefSetList)
if DoMulticore:
inputparams = []
for igamma in thisGammaList:
if any([idst in igamma for idst in ['doub','sing','twopt']]): continue
inputparams.append((['doub'+igamma,'sing'+igamma,igamma,'twopt'],thisMomList,DefSetList,thisMethodList))
makeContextFunctions(ReadAndPlotDict)
thisPool = Pool(min(len(inputparams),AnaProc))
output = thisPool.map(ReadAndPlotDict.mapper,inputparams)
thisPool.close()
thisPool.join()
else:
ReadAndPlotDict(thisGammaList,thisMomList,DefSetList,thisMethodList)
print 'Graphing all complete'