def performFits(self): for fitSeq in self.fitInfo: fType = fitSeq['Type'] if fType != 'Constant': print('Effective Energy: Supports only Constant fits for now!') print('Performing %s Fits on the Effective Energy...'%(fType)) self.fitBins[fType] = {} self.fitMean[fType] = {} self.chiBins[fType] = {} self.chiMean[fType] = {} self.Nbinfit[fType] = {} for mTag in fitSeq['Ranges'].keys(): tini,tfin = fitSeq['Ranges'][mTag] Nf = 0 self.fitBins[fType][mTag] = np.zeros(self.Nbins,dtype=np.float128) self.chiBins[fType][mTag] = np.zeros(self.Nbins,dtype=np.float128) for b in range(self.Nbins): data = self.bins[mTag][b,tini:tfin+1] err = self.mean[mTag][1][tini:tfin+1] if not np.isnan(data).any(): if fType == 'Constant': self.fitBins[fType][mTag][Nf] = constFit.fit(data,err) self.chiBins[fType][mTag][Nf] = constFit.chiSquare(data,err,self.fitBins[fType][mTag][Nf]) Nf += 1 self.fitBins[fType][mTag] = self.fitBins[fType][mTag][:Nf] self.chiBins[fType][mTag] = self.chiBins[fType][mTag][:Nf] self.Nbinfit[fType][mTag] = Nf # Disregard the fit if there's only one, or no successfull fits within the JK bins if np.shape(self.fitBins[fType][mTag])==(0,) or np.shape(self.fitBins[fType][mTag])==(1,): self.fitMean[fType][mTag] = (None,None) self.chiMean[fType][mTag] = (None,None) else: self.fitMean[fType][mTag] = jackknife.mean(self.fitBins[fType][mTag], Nbins = Nf, Nspl=1) self.chiMean[fType][mTag] = jackknife.mean(self.chiBins[fType][mTag], Nbins = Nf, Nspl=1) print("Momentum %s Done"%(mTag))
def logRatio(c2ptBins): Nt = self.dSetAttr[mTag]['Nt'] binsArr = np.zeros((self.Nbins,Nt),dtype=np.float128) # Need to check element by element to avoid negative log warnings for b in range(self.Nbins): for t in range(Nt): try: binsArr[b,t] = np.log(c2ptBins[b,t] / c2ptBins[b,(t+1)%Nt]) except RuntimeWarning: binsArr[b,t] = None meanArr = jackknife.mean(binsArr, self.Nbins, Nspl=Nt) return binsArr,meanArr
def evaluate(self): for mom in self.momAvg: mTag = tags.momString(mom) tsepList = self.dSetAttr3pt[mTag]['tsep'] tsepList_rs = self.dSetAttr3pt[mTag][ 'tsep'][:-1] # Need this for the reduced-summed ratio dispListAvg = self.dispAvg[mTag] for t in self.ratioTypes: for ri in self.RI: self.bins[t][ri][mTag] = {} self.mean[t][ri][mTag] = {} for its, tsep in enumerate(tsepList): Ntins = tsep for z3 in dispListAvg: for gamma in self.gammaList: dkey = (tsep, z3, gamma) for ri in self.RI: self.bins['plain'][ri][mTag][dkey] = np.zeros( (self.Nbins, Ntins), dtype=np.float64) self.bins['sum'][ri][mTag][dkey] = np.zeros( self.Nbins, dtype=np.float64) for tins in range(Ntins): # Plain ratio self.bins['plain'][ri][mTag][dkey][:, tins] = ( self.c3pt.bins[ri][mTag][dkey][:, tins] / self.c2pt.bins[mTag][:, tsep]) # Summed ratio if tins > 0: # Exclude source contact term self.bins['sum'][ri][mTag][ dkey] += self.bins['plain'][ri][mTag][ dkey][:, tins] self.mean['plain'][ri][mTag][ dkey] = jackknife.mean( self.bins['plain'][ri][mTag][dkey], self.Nbins, Nspl=Ntins) self.mean['sum'][ri][mTag][dkey] = jackknife.mean( self.bins['sum'][ri][mTag][dkey], self.Nbins, Nspl=1) # End for tsep # Evaluate reduced-summed ratio for its, tsep in enumerate(tsepList_rs): tsepL = tsepList[its] tsepH = tsepList[its + 1] for z3 in dispListAvg: for gamma in self.gammaList: dkey = (tsep, z3, gamma) dkeyL = (tsepL, z3, gamma) dkeyH = (tsepH, z3, gamma) for ri in self.RI: self.bins['r-sum'][ri][mTag][dkey] = ( (self.bins['sum'][ri][mTag][dkeyH] - self.bins['sum'][ri][mTag][dkeyL]) / (tsepH - tsepL)) self.mean['r-sum'][ri][mTag][ dkey] = jackknife.mean( self.bins['r-sum'][ri][mTag][dkey], self.Nbins, Nspl=1) print('Ratio evaluation for %s completed' % (mTag))
def doStatistics(self): if not self.dataLoaded: raise ValueError( 'Data must be loaded first, before doing Statistical Sampling') for mom in self.moms: mTag = tags.momString(mom) t0List = self.dSetAttr[mTag]['t0'] tsepList = self.dSetAttr[mTag]['tsep'] dispList = self.dSetAttr[mTag]['disp'] Nrows = self.dSetAttr[mTag]['Nrows'] Ncfg = self.dSetAttr[mTag]['Ncfg'] Nt0 = len(t0List) Nop = self.dSetAttr[mTag]['Nop'] # Determine the Jackknife sampling number of Bins self.Nbins = jackknife.Nbins(Ncfg, self.binsize) Navg = Nrows * Nt0 * Nop # The plain data Bins and Mean for ri in self.RI: self.plainBins[ri][mTag] = {} self.plainMean[ri][mTag] = {} self.avgData[ri][mTag] = {} self.avgBins[ri][mTag] = {} self.avgMean[ri][mTag] = {} for tsep in tsepList: Nt = tsep for z3 in dispList: for gamma in self.gammaList: dkeyAvg = (tsep, z3, gamma) for ri in self.RI: self.avgData[ri][mTag][dkeyAvg] = np.zeros( (Ncfg, Nt), dtype=np.float128) # We are averaging for the following attributes for t0 in t0List: for iop, opPair in enumerate( self.dSetAttr[mTag]['intOpList']): for row in range(1, Nrows + 1): dkey = (tsep, t0, z3, iop, row, gamma) for ri in self.RI: # Jackknife sampling on the Plain data self.plainBins[ri][mTag][ dkey] = np.zeros((self.Nbins, Nt), dtype=np.float128) for t in range(Nt): self.plainBins[ri][mTag][ dkey][:, t] = jackknife.sampling( self.plainData[ri] [mTag][dkey][:, t], self.Nbins, self.binsize) self.plainMean[ri][mTag][ dkey] = jackknife.mean( self.plainBins[ri][mTag][dkey], self.Nbins, Nspl=Nt) # Average over Source-Sink operators, t0's and rows self.avgData[ri][mTag][ dkeyAvg] += self.plainData[ri][ mTag][dkey] # Average over Source-Sink operators, t0's and rows for ri in self.RI: self.avgData[ri][mTag][dkeyAvg] = self.avgData[ri][ mTag][dkeyAvg] / Navg # Jackknife sampling over the averaged data, for each momentum, tsep, z3 and gamma self.avgBins[ri][mTag][dkeyAvg] = np.zeros( (self.Nbins, Nt), dtype=np.float128) for t in range(Nt): self.avgBins[ri][mTag][ dkeyAvg][:, t] = jackknife.sampling( self.avgData[ri][mTag][dkeyAvg][:, t], self.Nbins, self.binsize) self.avgMean[ri][mTag][dkeyAvg] = jackknife.mean( self.avgBins[ri][mTag][dkeyAvg], self.Nbins, Nspl=Nt) print('Jackknife analysis for momentum %s completed' % (mTag)) # End for momentum # Perform average over momenta and z3 values for mom in self.momAvg: mTag = tags.momString(mom) tsepList = self.dSetAttr[mTag]['tsep'] dispList = self.dSetAttr[mTag]['disp'] dispListAvg = self.dispAvg[mTag] Ncfg = self.dSetAttr[mTag]['Ncfg'] for ri in self.RI: self.data[ri][mTag] = {} self.bins[ri][mTag] = {} self.mean[ri][mTag] = {} for tsep in tsepList: Nt = tsep for gamma in self.gammaList: for z3 in dispListAvg: # Run over the z3>=0 dkey = (tsep, z3, gamma) for ri in self.RI: self.data[ri][mTag][dkey] = np.zeros( (Ncfg, Nt), dtype=np.float128) if mom == [0, 0, 0]: if z3 == 0 or not ( z3 in dispList and -z3 in dispList ): # Pz=0, z3=0, OR NOT both z3 and -z3 exist dkeyAvg = (tsep, -z3, gamma) if -z3 in dispList else ( tsep, z3, gamma) for ri in self.RI: self.data[ri][mTag][dkey] = self.avgData[ ri][mTag][dkeyAvg] else: # Pz=0, z3!=0 dkeyAvgPosZ = (tsep, z3, gamma) dkeyAvgNegZ = (tsep, -z3, gamma) self.data['Re'][mTag][dkey] = 0.5 * ( self.avgData['Re'][mTag][dkeyAvgPosZ] + self.avgData['Re'][mTag][dkeyAvgNegZ]) self.data['Im'][mTag][dkey] = 0.5 * ( self.avgData['Im'][mTag][dkeyAvgPosZ] + self.avgData['Im'][mTag][dkeyAvgNegZ]) else: momNeg = [mom[0], mom[1], -mom[2]] if mom in self.moms and momNeg in self.moms: # Negative momentum exists in global momentum list mTagPos = mTag mTagNeg = tags.momString(momNeg) if z3 == 0: # Pz!=0, z3=0 self.data['Re'][mTag][dkey] = 0.5 * ( self.avgData['Re'][mTagPos][dkey] + self.avgData['Re'][mTagNeg][dkey]) self.data['Im'][mTag][dkey] = 0.5 * ( self.avgData['Im'][mTagPos][dkey] + self.avgData['Im'][mTagNeg][dkey]) else: # Pz!=0, z3!=0 if z3 in dispList and -z3 in dispList: dkeyAvgPosZ = (tsep, z3, gamma) dkeyAvgNegZ = (tsep, -z3, gamma) self.data['Re'][mTag][dkey] = 0.25 * ( self.avgData['Re'][mTagPos] [dkeyAvgPosZ] + self.avgData['Re'] [mTagPos][dkeyAvgNegZ] + self.avgData['Re'][mTagNeg] [dkeyAvgPosZ] + self.avgData['Re'] [mTagNeg][dkeyAvgNegZ]) self.data['Im'][mTag][dkey] = 0.25 * ( self.avgData['Im'][mTagPos] [dkeyAvgPosZ] - self.avgData['Im'] [mTagPos][dkeyAvgNegZ] - self.avgData['Im'][mTagNeg] [dkeyAvgPosZ] + self.avgData['Im'] [mTagNeg][dkeyAvgNegZ]) elif z3 in dispList and -z3 not in dispList: dkeyAvg = (tsep, z3, gamma) self.data['Re'][mTag][dkey] = 0.5 * ( self.avgData['Re'][mTagPos] [dkeyAvg] + self.avgData['Re'] [mTagNeg][dkeyAvg]) self.data['Im'][mTag][dkey] = 0.5 * ( self.avgData['Im'][mTagPos] [dkeyAvg] - self.avgData['Im'] [mTagNeg][dkeyAvg]) elif -z3 in dispList and z3 not in dispList: dkeyAvg = (tsep, -z3, gamma) self.data['Re'][mTag][dkey] = 0.5 * ( self.avgData['Re'][mTagPos] [dkeyAvg] + self.avgData['Re'] [mTagNeg][dkeyAvg]) self.data['Im'][mTag][dkey] = 0.5 * ( self.avgData['Im'][mTagNeg] [dkeyAvg] - self.avgData['Im'] [mTagPos][dkeyAvg]) else: raise ValueError( '\n Error: Inconsistency with z3 values!!!' ) elif mom in self.moms and momNeg not in self.moms: mTagPos = mTag if z3 == 0 or not (z3 in dispList and -z3 in dispList): # Pz!=0, z3=0 dkeyAvg = (tsep, -z3, gamma) if -z3 in dispList else ( tsep, z3, gamma) for ri in self.RI: self.data[ri][mTag][ dkey] = self.avgData[ri][mTagPos][ dkeyAvg] else: # Pz!=0, z3!=0 dkeyAvgPosZ = (tsep, z3, gamma) dkeyAvgNegZ = (tsep, -z3, gamma) self.data['Re'][mTag][dkey] = 0.5 * ( self.avgData['Re'][mTagPos] [dkeyAvgPosZ] + self.avgData['Re'] [mTagPos][dkeyAvgNegZ]) self.data['Im'][mTag][dkey] = 0.5 * ( self.avgData['Im'][mTagPos] [dkeyAvgPosZ] - self.avgData['Im'] [mTagPos][dkeyAvgNegZ]) elif momNeg in self.moms and mom not in self.moms: mTagNeg = tags.momString(momNeg) if z3 == 0 or not (z3 in dispList and -z3 in dispList): # Pz!=0, z3=0 dkeyAvg = (tsep, -z3, gamma) if -z3 in dispList else ( tsep, z3, gamma) for ri in self.RI: self.data[ri][mTag][ dkey] = self.avgData[ri][mTagNeg][ dkeyAvg] else: # Pz!=0, z3!=0 dkeyAvgPosZ = (tsep, z3, gamma) dkeyAvgNegZ = (tsep, -z3, gamma) self.data['Re'][mTag][dkey] = 0.5 * ( self.avgData['Re'][mTagNeg] [dkeyAvgPosZ] + self.avgData['Re'] [mTagNeg][dkeyAvgNegZ]) self.data['Im'][mTag][dkey] = 0.5 * ( self.avgData['Im'][mTagNeg] [dkeyAvgNegZ] - self.avgData['Im'] [mTagNeg][dkeyAvgPosZ]) else: raise ValueError( '\n Error: Inconsistency with momenta values!!!' ) # End if mom != 0 # Jackknife sampling over the fully averaged data, for each momentum, tsep, z3 and gamma for ri in self.RI: self.bins[ri][mTag][dkey] = np.zeros( (self.Nbins, Nt), dtype=np.float128) for t in range(Nt): self.bins[ri][mTag][ dkey][:, t] = jackknife.sampling( self.data[ri][mTag][dkey][:, t], self.Nbins, self.binsize) self.mean[ri][mTag][dkey] = jackknife.mean( self.bins[ri][mTag][dkey], self.Nbins, Nspl=Nt) print('Averaging over z3 and momenta for momentum %s completed.' % (mTag))
def doStatistics(self): if not self.dataLoaded: raise ValueError( 'Data must be loaded first, before doing Statistical Sampling') for mom in self.moms: mTag = tags.momString(mom) t0List = self.dSetAttr[mTag]['t0'] Nrows = self.dSetAttr[mTag]['Nrows'] Nt0 = len(t0List) Nop = self.dSetAttr[mTag]['Nop'] Ncfg = self.dSetAttr[mTag]['Ncfg'] Nt = self.dSetAttr[mTag]['Nt'] Navg = Nrows * Nt0 * Nop # Determine the Jackknife sampling number of Bins self.Nbins = jackknife.Nbins(Ncfg, self.binsize) # The plain data Bins and Mean self.plainBins[mTag] = {} self.plainMean[mTag] = {} # That's the averaged data self.avgData[mTag] = np.zeros((Ncfg, Nt), dtype=np.complex128) # The mean required for the covariant matrix self.covMean[mTag] = {} for t0 in t0List: covSum = np.zeros((Ncfg, Nt), dtype=np.float128) for iop, opPair in enumerate(self.dSetAttr[mTag]['intOpList']): for row in range(1, Nrows + 1): dkey = (t0, iop, row) # Jackknife sampling on the Plain data self.plainBins[mTag][dkey] = np.zeros( (self.Nbins, Nt), dtype=np.float128) for t in range(Nt): self.plainBins[mTag][dkey][:, t] = jackknife.sampling( self.plainData[mTag] [dkey][:, t].real, self.Nbins, self.binsize) self.plainMean[mTag][dkey] = jackknife.mean( self.plainBins[mTag][dkey], self.Nbins, Nspl=Nt) # Sum over Source-Sink operators, t0's and rows self.avgData[mTag] += self.plainData[mTag][dkey] # Sum over Source-Sink operators and rows covSum += self.plainData[mTag][dkey].real # Standard Mean and Error over source-sink operators and rows, for each t0 (for covariant matrix) covAvg = covSum / (Nop * Nrows) # Still a (Ncfg * Nt) array self.covMean[mTag][t0] = (np.mean( covAvg, axis=0), np.std(covAvg, axis=0) / np.sqrt(Ncfg)) # Sum over Source-Sink operators, t0's and rows self.avgData[mTag] = self.avgData[mTag] / Navg # Jackknife sampling over the averaged data, for each momentum self.avgBins[mTag] = np.zeros((self.Nbins, Nt), dtype=np.float128) for t in range(Nt): self.avgBins[mTag][:, t] = jackknife.sampling( self.avgData[mTag][:, t].real, self.Nbins, self.binsize) self.avgMean[mTag] = jackknife.mean(self.avgBins[mTag], self.Nbins, Nspl=Nt) # End for momentum ------------- # Perform averaging over momentum for mom in self.momAvg: momNeg = [mom[0], mom[1], -mom[2]] mTag = tags.momString(mom) mTagPos = mTag mTagNeg = tags.momString(momNeg) Ncfg = self.dSetAttr[mTag]['Ncfg'] Nt = self.dSetAttr[mTag]['Nt'] self.data[mTag] = np.zeros((Ncfg, Nt), dtype=np.complex128) self.bins[mTag] = np.zeros((self.Nbins, Nt), dtype=np.float128) if mom in self.moms and momNeg in self.moms: self.data[mTag] = 0.5 * (self.avgData[mTagPos] + self.avgData[mTagNeg]) self.bins[mTag] = 0.5 * (self.avgBins[mTagPos] + self.avgBins[mTagNeg]) elif mom in self.moms and momNeg not in self.moms: self.data[mTag] = self.avgData[mTagPos] self.bins[mTag] = self.avgBins[mTagPos] elif mom not in self.moms and momNeg in self.moms: self.data[mTag] = self.avgData[mTagNeg] self.bins[mTag] = self.avgBins[mTagNeg] self.mean[mTag] = jackknife.mean(self.bins[mTag], self.Nbins, Nspl=Nt) print('Statistical evaluation completed')
def evaluatePlateauITD(fitLabels): # This function is specific to the plateau fits def getOptimalPlatKeys(tOpt,z3_c,gamma): z3_0 = 0 kp = {} for pz in self.pzPos: zT = z3_0 if 'z0' in pz else z3_c kp[pz] = (tOpt[pz],zT,gamma) return kp #------------------- # This function is specific to the plateau fits def getOptimalPlatFits(fit_,ri_,mTag_c,dkey_): mTag_0 = tags.momString([0,0,0]) f = {} for pz in self.pzPos: mT = mTag_0 if 'p0' in pz else mTag_c if self.plat.optimalFit[fit_][ri_][mT][dkey_[pz]] != -1: # Valid optimal fit f[pz] = self.plat.optimalFit[fit_][ri_][mT][dkey_[pz]] else: # Get value from provided plateau ranges # These are the same for all momenta and z tS = dkey_[pz][0] # Get the tsep from the key f[pz] = self.platRng[ri_][tS] return f #------------------- # Zero momentum mTag_0 = tags.momString([0,0,0]) # Temporary variable platBins = {} for ri in self.RI: platBins[ri] = {} for fit in fitLabels: # These are just the plateau fit labels! for mom in self.momAvg: mTag = tags.momString(mom) dispListAvg = self.dispAvg[mTag] for z3 in dispListAvg: for gamma in self.gammaList: dkey = (mTag,z3,gamma) self.bins[fit][dkey] = {} self.mean[fit][dkey] = {} # Need separate for-loop for these because all values of ri # are needed in each ri-iteration further down tOpt = {} dkeyP = {} optFit = {} for ri in self.RI: tOpt[ri] = getSelectedFits(fit,ri,mTag,z3) dkeyP[ri] = getOptimalPlatKeys(tOpt[ri],z3,gamma) optFit[ri] = getOptimalPlatFits(fit,ri,mTag,dkeyP[ri]) # The off-center values are only needed for the real part for pz in self.pzPosOff: mT = mTag_0 if 'p0' in pz else mTag platBins['Re'][pz] = self.plat.Mbins[fit]['Re'][mT][dkeyP['Re'][pz]][optFit['Re'][pz]] # Evaluate the ITDs for ri in self.RI: # The 'center' value is needed for both real and imaginary platBins[ri]['c'] = self.plat.Mbins[fit][ri][mTag][dkeyP[ri]['c']][optFit[ri]['c']] # Still use the Real part if z3 = 0 and/or mom = 0 self.bins[fit][dkey][ri] = ( (platBins[ri] ['c'] / platBins['Re']['z0']) * (platBins['Re']['p0z0'] / platBins['Re']['p0']) ) self.mean[fit][dkey][ri] = jackknife.mean(self.bins[fit][dkey][ri], Nbins = self.Nbins, Nspl=1) print('%s ITD for momentum %s completed'%(fit,mom))
def makeLinearFitBands(fitSeq): Npts = fitSeq['Fit Bands']['Npoints'] fType = fitSeq['Type'] fLabel = fitSeq['Label'] tsepLowList = fitSeq['tsepLow'] for mom in self.momAvg: mTag = tags.momString(mom) dispListAvg = self.dispAvg[mTag] for tL in tsepLowList: sLTag = 'tL%d' % (tL) MTag = 'M' + '_%s' % (sLTag) bTag = 'b' + '_%s' % (sLTag) # Determine beginning and ending of bands, and interval xStart = self.tsepFitX[fLabel][mTag][sLTag][0] - 1 xEnd = self.tsepFitX[fLabel][mTag][sLTag][-1] + 1 dx = (xEnd - xStart) / (Npts - 1) for ri in self.RI: self.fitBands[fLabel][sLTag][ri][mTag] = {} for z3 in dispListAvg: for gamma in self.gammaList: dkeyF = (z3, gamma) self.fitBands[fLabel][sLTag][ri][mTag][ dkeyF] = { 'x': np.zeros(Npts, dtype=np.float64), # x 'v': np.zeros(Npts, dtype=np.float64), # value 'e': np.zeros(Npts, dtype=np.float64) } # error for ix in range(Npts): x = xStart + ix * dx # Current point in the band Mmean = self.mean[fLabel][MTag][ri][mTag][ dkeyF][0] # Matrix element (slope) bmean = self.mean[fLabel][bTag][ri][mTag][ dkeyF][0] # Intersection self.fitBands[fLabel][sLTag][ri][mTag][ dkeyF]['x'][ix] = x self.fitBands[fLabel][sLTag][ri][mTag][ dkeyF]['v'][ix] = linearFit.model( x, Mmean, bmean) # Determine error band errBand = np.zeros(self.Nbins, dtype=np.float64) for ib in range(self.Nbins): Mbins = self.bins[fLabel][MTag][ri][ mTag][dkeyF][ib] bbins = self.bins[fLabel][bTag][ri][ mTag][dkeyF][ib] errBand[ib] = linearFit.model( x, Mbins, bbins) self.fitBands[fLabel][sLTag][ri][mTag][ dkeyF]['e'][ix] = jackknife.mean( errBand, self.Nbins, Nspl=1)[1] # End for tsepLow ------ print('%s error bands for momentum %s completed' % (fType, mTag))
def makeLinearFit(fitSeq): fType = fitSeq['Type'] fLabel = fitSeq['Label'] tsepLowList = fitSeq['tsepLow'] fPrmList = self.fitParams[fType] for mom in self.momAvg: mTag = tags.momString(mom) tsepList = self.dSetAttr3pt[mTag]['tsep'] dispListAvg = self.dispAvg[mTag] # Determine the x-data for each tLow self.tsepFitX[fLabel][mTag] = {} for tL in tsepLowList: sLTag = 'tL%d' % (tL) self.tsepFitX[fLabel][mTag][sLTag] = tsepList[tsepList. index(tL):] xData = self.tsepFitX[fLabel][mTag][sLTag] Nfdata = len(xData) for ri in self.RI: self.chiBins[fLabel][sLTag][ri][mTag] = {} self.chiMean[fLabel][sLTag][ri][mTag] = {} for fP in fPrmList: fpTag = fP + '_%s' % (sLTag) self.bins[fLabel][fpTag][ri][mTag] = {} self.mean[fLabel][fpTag][ri][mTag] = {} for z3 in dispListAvg: for gamma in self.gammaList: dkeyF = (z3, gamma) self.chiBins[fLabel][sLTag][ri][mTag][ dkeyF] = np.zeros(self.Nbins, dtype=np.float64) for fP in fPrmList: fpTag = fP + '_%s' % (sLTag) self.bins[fLabel][fpTag][ri][mTag][ dkeyF] = np.zeros(self.Nbins, dtype=np.float64) # Perform the fits for each bin for b in range(self.Nbins): ydata = np.zeros(Nfdata, dtype=np.float64) yerr = np.zeros(Nfdata, dtype=np.float64) # Fill in fit data for itL, tL in enumerate( self.tsepFitX[fLabel][mTag] [sLTag]): dkey = (tL, z3, gamma) ydata[itL] = self.ratioBins[ri][mTag][ dkey][b] yerr[itL] = self.ratioMean[ri][mTag][ dkey][1] # Perform the fit fprmRes, covRes = scipyOpt.curve_fit( linearFit.model, xData, ydata, sigma=yerr) self.chiBins[fLabel][sLTag][ri][mTag][ dkeyF][b] = linearFit.chiSquare( xData, ydata, yerr, fprmRes[0], fprmRes[1]) for ifP, fP in enumerate(fPrmList): fpTag = fP + '_%s' % (sLTag) self.bins[fLabel][fpTag][ri][mTag][ dkeyF][b] = fprmRes[ifP] # End for bins # Jackknife averages self.chiMean[fLabel][sLTag][ri][mTag][ dkeyF] = jackknife.mean( self.chiBins[fLabel][sLTag][ri][mTag] [dkeyF], Nbins=self.Nbins, Nspl=1) for fP in fPrmList: fpTag = fP + '_%s' % (sLTag) self.mean[fLabel][fpTag][ri][mTag][ dkeyF] = jackknife.mean( self.bins[fLabel][fpTag][ri][mTag] [dkeyF], Nbins=self.Nbins, Nspl=1) # End for tsepLow ------ print('%s fits for momentum %s completed' % (fType, mTag))