-
Notifications
You must be signed in to change notification settings - Fork 0
/
CfunBoot.py
executable file
·68 lines (61 loc) · 2.75 KB
/
CfunBoot.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
#!/usr/bin/env python
from array import array
import numpy as np
import BootTest as bt
from Params import *
from MiscFuns import *
from ReadBinaryCfuns import *
##NB CreateBoot take array [ iconf , it ]
#data = [ iconf , igamma , ip , it ]
#dataout = [igamma , ip , it ] bs
def BootSet3pt(data,thisMomList,thisGammaList,nboot,printstr='',randlist=[]):
dataout = []
for ig,igamma in enumerate(thisGammaList):
dataout.append([])
for ip,imom in enumerate(thisMomList):
# print 'Booting '+printstr+igamma+' {}% \r'.format(int((ip*100)/float(len(thisMomList)))),
bootdata,randlist = bt.CreateBoot(np.array(data)[:,ig,ip,:],nboot,0,randlist=randlist)
dataout[ig].append(bootdata)
# print ' \r',
return dataout
#data = [ iconf , ip , it]
#dataout = [ ip , it ]. bs
def BootSet2pt(data,thisMomList,nboot,randlist=[]):
dataout = []
randlist = []
for ip,imom in enumerate(thisMomList):
# print 'Booting {}% \r'.format(int((ip*100)/float(len(thisMomList)))),
bootdata,randlist = bt.CreateBoot(np.array(data)[:,ip,:],nboot,0,randlist=randlist)
dataout.append(bootdata)
# print ' \r',
return dataout,randlist
#dataout = [ ip , it ]. bs
def ReadAndBoot2pt(readfilelist,thisMomList,thisnboot,randlist=[]):
tempdata = []
for iconf,ifile in enumerate(readfilelist):
# print 'Reading {}% \r'.format(int((iconf*100)/float(len(readfilelist)))),
try:
tempdata.append(Read2ptCfunPick(ifile,thisMomList).data)
except NaNCfunError as e:
print 'Deleting file ' + ifile
print e
os.remove(ifile)
return BootSet2pt(tempdata,thisMomList,thisnboot,randlist=randlist)
#dataout [ igamma , ip , it ]. bs
def ReadAndBoot3pt(readfilelist,thisMomList,thisGammaList,thisDerGammaList,thisnboot,printstr='',randlist=[]):
tempdata = []
for iconf,ifile in enumerate(readfilelist):
# print 'Reading '+printstr+' {}% \r'.format(int((iconf*100)/float(len(readfilelist)))),
try:
if len(thisGammaList) > 0:
tempdata.append(ReadFSCfunPick(ifile,thisMomList,thisGammaList).data)
if len(thisDerGammaList) > 0:
tempdata.append(ReadFSDerCfunPick(ifile,thisMomList,thisDerGammaList).data)
except NaNCfunError as e:
print 'Deleting file ' + ifile
print e
readfilelist.remove(ifile)
if len(thisGammaList) > 0:
return BootSet3pt(tempdata,thisMomList,thisGammaList,thisnboot,printstr='',randlist=randlist)
elif len(thisDerGammaList) > 0:
return BootSet3pt(tempdata,thisMomList,thisDerGammaList,thisnboot,printstr='',randlist=randlist)