def fitExp(r11,maxlag=None):
    if maxlag==None:
        maxlag=len(r11)
    xdata=np.arange(len(r11[:maxlag]))
    ydata=np.array(r11[:maxlag])
    try:
        popt, pcov = tt.fit_exp_correlation(xdata,ydata)
        T=popt
    except RuntimeError:
        print("Error - curve_fit failed")
        T=0
    return T
Beispiel #2
0
def fitExp(r11, maxlag=None):
    if maxlag == None:
        maxlag = len(r11)
    xdata = np.arange(len(r11[:maxlag]))
    ydata = np.array(r11[:maxlag])
    try:
        popt, pcov = tt.fit_exp_correlation(xdata, ydata)
        T = popt
    except RuntimeError:
        print("Error - curve_fit failed")
        T = 0
    return T
Beispiel #3
0
 def doAutoCorr(xkey,ykey,Tkey,Lkey=None,threshold=0.1):
     xdata=self.data[xkey]
     ydata=self.data[ykey]
     
     if checkAutoCorr(xdata,ydata,threshold=threshold):
         try:
             popt, pcov = tt.fit_exp_correlation(xdata,ydata)
             #self.data['Txx']=abs(popt[0])*np.sqrt(np.pi)*0.5*self.data['dt']
             self.data[Tkey]=popt[0]*self.data['dt']
             if Lkey:
                 self.data[Lkey]=self.data[Tkey]*self.Umean()
         except RuntimeError:
             print("Error - curve_fit failed")
             self.data[Tkey]=0
             if Lkey:
                 self.data[Lkey]=0
     else:
         self.data[Tkey]=0
         if Lkey:
             self.data[Lkey]=0