import sys import numpy as np sys.path.append("/hiskp2/oehm/development/analysis/") import a calcbstraps = 1 destdir = "/hiskp2/oehm/analysis/baryons/A40.24/" correlator = sys.argv[1] if calcbstraps == 1: x = a.readcor("/hiskp2/oehm/baryon/contractions/A40.24/correlators/"+correlator,48) x = x[0:50,:] x_bstraps = a.boot(x,1500) np.save(os.path.join(destdir,correlator+"_x_bstraps50.npy"),x_bstraps) else: x_bstraps = np.load(os.path.join(destdir,correlator+"_x_bstraps50.npy")) if correlator == "corr1": for t in range(0,48): x_bstraps[:,t] = -x_bstraps[:,t] if correlator == "corr2": for t in range(24,48):
import os,inspect currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) parentdir = os.path.dirname(currentdir) sys.path.insert(0,parentdir) import a sigma = int(sys.argv[1]) print "sigma "+str(sigma) a.ensure_dir("/hiskp2/oehm/correlators/momentum/A40.24/O012/analysis/sigma"+str(sigma)+"/") numBootstraps = 1500 O012 = a.readcor("/hiskp2/oehm/correlators/momentum/A40.24/O012/sigma"+str(sigma)+"/O012_sigma"+str(sigma),48) xn = a.readcor("/hiskp2/oehm/correlators/momentum/A40.24/x/sigma"+str(sigma)+"/x"+str(sigma),48) O012 = a.asym(O012) xn = a.sym(xn) O012_bstraps = a.boot(O012,numBootstraps) O012_bstraps_mean = np.mean(O012_bstraps,axis=0) xn_bstraps = a.boot(xn,numBootstraps) xn_bstraps_mean = np.mean(xn_bstraps,axis=0) xn_result = np.zeros((21,numBootstraps,4)) effmass, effmass_error, effmass_nans = a.effmass(xn_bstraps) print effmass xnfunc = lambda p,x: p[0]*(np.exp(-x*p[1])+np.exp(-(48-x)*p[1]))
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) parentdir = os.path.dirname(currentdir) sys.path.insert(0,parentdir) import a import numpy as np numBoots = 200 #O0123_1 = a.readcor("/hiskp2/oehm/correlators/momentum3/A80/O0123/sigma1/O0123_sigma1",48) #O0123_2 = a.readcor("/hiskp2/oehm/correlators/momentum3/A80/O0123/sigma2/O0123_sigma2",48) #O0123_3 = a.readcor("/hiskp2/oehm/correlators/momentum3/A80/O0123/sigma3/O0123_sigma3",48) #O0123_4 = a.readcor("/hiskp2/oehm/correlators/momentum3/A80/O0123/sigma4/O0123_sigma4",48) #O0123_5 = a.readcor("/hiskp2/oehm/correlators/momentum3/A80/O0123/sigma5/O0123_sigma5",48) O0123_5t8 = a.readcor("/hiskp2/oehm/correlators/momentum3/A80/O0123/sigma5-8/O0123_sigma5-8",48) #O0123_1_bstraps = a.boot(O0123_1,numBoots) #O0123_2_bstraps = a.boot(O0123_2,numBoots) #O0123_3_bstraps = a.boot(O0123_3,numBoots) #O0123_4_bstraps = a.boot(O0123_4,numBoots) #O0123_5_bstraps = a.boot(O0123_5,numBoots) O0123_5t8_bstraps = a.boot(O0123_5t8,numBoots) #a.nsettofile2(O0123_1_bstraps[0,:],np.std(O0123_1_bstraps,axis=0),"/hiskp2/oehm/correlators/momentum3/A80/O0123/analysis/O0123_1") #a.nsettofile2(O0123_2_bstraps[0,:],np.std(O0123_2_bstraps,axis=0),"/hiskp2/oehm/correlators/momentum3/A80/O0123/analysis/O0123_2") #a.nsettofile2(O0123_3_bstraps[0,:],np.std(O0123_3_bstraps,axis=0),"/hiskp2/oehm/correlators/momentum3/A80/O0123/analysis/O0123_3") #a.nsettofile2(O0123_4_bstraps[0,:],np.std(O0123_4_bstraps,axis=0),"/hiskp2/oehm/correlators/momentum3/A80/O0123/analysis/O0123_4") #a.nsettofile2(O0123_5_bstraps[0,:],np.std(O0123_5_bstraps,axis=0),"/hiskp2/oehm/correlators/momentum3/A80/O0123/analysis/O0123_5") a.nsettofile2(O0123_5t8_bstraps[0,:],np.std(O0123_5t8_bstraps,axis=0),"/hiskp2/oehm/correlators/momentum3/A80/O0123/analysis/O0123_5t8")
import a calcbstraps = int(sys.argv[3]) destdir = "/hiskp2/oehm/analysis/baryons/A40.24/" correlator1 = sys.argv[1] correlator2 = sys.argv[2] T = 48 # read in the two correlators and seperate the correlators of the two parity partners if calcbstraps == 1: x1 = a.readcor("/hiskp2/oehm/baryon/contractions/A40.24/correlators/"+correlator1,T) x2 = a.readcor("/hiskp2/oehm/baryon/contractions/A40.24/correlators/"+correlator2,T) y1 = np.zeros(x1.shape[0],T/2+1) y2 = np.zeros(x1.shape[0],T/2+1) for i in range(0,x.shape[0]): y1[i,0] = x1[i,0] y2[i,0] = x2[i,0] for t in range(1,T/2+1): y1[i,t] = (x1[i,t]+x2[i,T-t])/2 y2[i,t] = (x2[i,t]+x1[i,T-t])/2 y1_bstraps = a.boot(y1,1500) y2_bstraps = a.boot(y2,1500)
elif task == "calcplatval": sigmaterm = runr.getsigma(sigma) if op == "O44": valfunc = lambda x,y,z: -x/y*z/(z**2+((2*math.pi/24*sigmaterm)**2)/3) elif op == "O012": valfunc = lambda x,y,z: -x/y/((2*math.pi/24*sigmaterm)**2) elif op == "O0ii": valfunc = lambda x,y,z: -x/y*2/((2*math.pi/24*sigmaterm)**2) print runr.getopcf(op,sigma)+","+runr.getopcf("x",sigma)+","+destdir+","+str(latT)+","+str(numBstraps)+","+str(doasym) a.calcplatval(runr.getopcf(op,sigma),runr.getopcf("x",sigma),destdir,latT,numBstraps,valfunc,wpe) elif task == "autocorr_bstrap": data = a.readcor(runr.getopcf(op,sigma),latT) if runr.istrue("wpe"): data = a.sym_wope(data) else: data = a.sym(data) errors = a.autocorr_bstrap(data,int(taskr.rparam("start")),int(taskr.rparam("end")),numBstraps) a.plotautocorr_bstrap(errors,os.path.join(destdir,"autocorr_bstrap.pdf")) elif task == "mwerr": data = a.readcor(runr.getopcf(op,sigma),latT) if runr.istrue("wpe"): data = a.sym_wope(data) data = data[:,1:len(data[0])-1]
def ensure_dir(f): d = os.path.dirname(f) if not os.path.exists(d): os.makedirs(d) numBootstraps = 1500 lattice = sys.argv[1] print "destdir: "+"/hiskp2/oehm/averx/analysis/"+lattice+"/" T = int(sys.argv[2]) print "T: "+str(T) ensure_dir("/hiskp2/oehm/averx/analysis/"+lattice+"/") O44 = a.readcor("/hiskp2/oehm/averx/"+lattice+"/maxmomf2e",T) xn = a.readcor("/hiskp2/oehm/averx/"+lattice+"/maxppcor",T) O44 = a.sym_wope(O44) xn = a.sym(xn) O44_bstraps = a.boot(O44,numBootstraps) O44_bstraps_mean = np.mean(O44_bstraps,axis=0) xn_bstraps = a.boot(xn,numBootstraps) xn_bstraps_mean = np.mean(xn_bstraps,axis=0) xn_result = np.zeros((T/2+1-4,numBootstraps,4)) effmass, effmass_error, effmass_nans = a.effmass(xn_bstraps) print effmass