-
Notifications
You must be signed in to change notification settings - Fork 0
/
GetAndCheckData.py
executable file
·98 lines (84 loc) · 3.5 KB
/
GetAndCheckData.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
#!/usr/bin/env python
import os
from RunParams import *
from shutil import copyfile,move,rmtree
import subprocess
from FilenameFuns import *
def GetGaugeField(icfg,thisgfosnum):
limefile = CreateLimeCfg(icfg,thisgfosnum)
limepath = rdsigfdir+limefile
if os.path.isfile(limepath):
if os.path.isfile(gfdir+CreateCfg(icfg,thisgfosnum)):
print gfdir+CreateCfg(icfg,thisgfosnum) , ' Already present'
else:
print 'Copying Gf from: '+limepath
copyfile(limepath,gfdir+limefile)
subprocess.call([limedir+"lime_unpack",gfdir+limefile])
move(gfdir+limefile+'.contents/msg01.rec02.ildg-binary-data',gfdir+CreateCfg(icfg,thisgfosnum))
rmtree(gfdir+limefile+'.contents/')
os.remove(gfdir+limefile)
print 'Copying complete'
else:
print 'Warning: ' , limepath , ' Does not exist'
def RemoveGaugeField(icfg,thisgfosnum):
gffile = gfdir+CreateCfg(icfg,thisgfosnum)
if os.path.isfile(gffile):
print 'Deleting: ' , gffile
os.remove(gffile)
# else:
# print gffile , ' not present'
def RemoveProp(icfg,thisgfosnum,thisismlist):
for ism in thisismlist:
thisfile = Get2ptProp(icfg,thisgfosnum,ism)
if os.path.isfile(thisfile):
print 'Removing: ',thisfile
os.remove(thisfile)
if os.path.isfile(thisfile+'.metadata'):
os.remove(thisfile+'.metadata')
# else:
# print thisfile,' not present'
def Move2ptCorr(icfg,thisgfosnum,thisismlist,thisjsmlist):
for ism in thisismlist:
map(mkdir_p,Get2ptCorrFolders(icfg,thisgfosnum,ism,jsmlist))
for jsm in thisjsmlist:
thisoutfile = Get2ptCorrOutput(icfg,thisgfosnum,ism,jsm)
thisfile = Get2ptCorr(icfg,thisgfosnum,ism,jsm)
if os.path.isfile(thisoutfile):
move(thisoutfile,thisfile)
def Check2ptProp(icfg,thisgfosnum,thisismlist):
Present = True
for ism in thisismlist:
thisfile = Get2ptProp(icfg,thisgfosnum,ism)
if not os.path.isfile(thisfile):
Present = False
return Present
def Check2ptCorr(icfg,thisgfosnum,thisismlist,thisjsmlist):
Present = True
for ism in thisismlist:
for jsm in thisjsmlist:
thisfile = Get2ptCorr(icfg,thisgfosnum,ism,jsm)
if not os.path.isfile(thisfile):
Present = False
return Present
def Check3ptCorr(icfg,thisgfosnum,thisismlist,tsinklist,Projectorlist,DSlist):
Present = True
for ism in thisismlist:
for tsink in tsinklist:
for Projector in Projectorlist:
for DS in DSlist:
thisfile = Get3ptCorr(icfg,thisgfosnum,ism,tsink,Projector,DS)
if not os.path.isfile(thisfile):
Present = False
return Present
def Remove2ptCorr(icfg,thisgfosnum,thisismlist,thisjsmlist):
for ism in thisismlist:
for jsm in thisjsmlist:
thisfile = Get2ptCorr(icfg,thisgfosnum,ism,jsm)
if os.path.isfile(thisfile): os.remove(thisfile)
def Remove3ptCorr(icfg,thisgfosnum,thisismlist,tsinklist,Projectorlist,DSlist):
for ism in thisismlist:
for tsink in tsinklist:
for Projector in Projectorlist:
for DS in DSlist:
thisfile = Get3ptCorr(icfg,thisgfosnum,ism,tsink,Projector,DS)
if os.path.isfile(thisfile): os.remove(thisfile)