PEATDB/plugins/VantHoffAnalysis.py
def transformCD(self,x,y,transwidth=None,ax=None):
        """Transform raw data into fraction unfolded per temp value, by fitting to
            a general unfolding equation that extracts baseline/slopes"""
        #fit baseline slopes and get intercepts
        d50 = self.guessMidpoint(x,y)
        print 'fitting to get baseline slopes and intercepts..'
        print 'midpoint is %s' %d50
        A,X=Fitting.doFit(expdata=zip(x,y),model='Unfolding',noiter=50,silent=True,
                           guess=False,startvalues=[1,1,1,1,1,d50])
        #print X.getResult()
        fity = X.getFitLine(x)
        fd=X.getFitDict()
        if ax!=None:
            p=ax.plot(x,fity,'r',lw=2)
            self.drawParams(ax,fd)
        #we then use slopes and intercepts get frac unfolded at each temp
        mn = fd['bn']; mu = fd['bd'] #slopes
        #if mu>0.01: mu = 0.01
        yn = fd['an']; yu = fd['ad'] #intercepts
        d50 = fd['d50']; m = fd['m']

        t=[]; f=[]
        #print mu, mn
        for T,yo in zip(x,y):
            fu = (yo-(yn+mn*T)) / ((yu+mu*T)-(yn+mn*T))
            #print fu, (yo-(yn+mn*T)), (m), mu, mn
            #if f>0:
            f.append(fu)
            t.append(T)

        #try to take useful transition region of data
        at,af=t,f
        diff=1e5
        if transwidth != None:
            for i in t:
                d=abs(i-d50)
                if d<diff:
                    mid = t.index(i)
                    diff=d
            L=int(mid-transwidth); U=int(mid+transwidth)
            t,f = t[L:U], f[L:U]

        return at,af,t,f
Transform raw data into fraction unfolded per temp value, by fitting to
            a general unfolding equation that extracts baseline/slopes
Transform raw data into fraction unfolded per temp value, by fitting to
a general unfolding equation that extracts baseline/slopes
Transform raw data into fraction unfolded per temp value by fitting to a general unfolding equation that extracts baseline / slopes
def transformCD(self,x,y,transwidth=None,ax=None):
        d50 = self.guessMidpoint(x,y)
        print 'fitting to get baseline slopes and intercepts..'
        print 'midpoint is %s' %d50
        A,X=Fitting.doFit(expdata=zip(x,y),model='Unfolding',noiter=50,silent=True,
                           guess=False,startvalues=[1,1,1,1,1,d50])
        fity = X.getFitLine(x)
        fd=X.getFitDict()
        if ax!=None:
            p=ax.plot(x,fity,'r',lw=2)
            self.drawParams(ax,fd)
        mn = fd['bn']; mu = fd['bd'] 
        yn = fd['an']; yu = fd['ad'] 
        d50 = fd['d50']; m = fd['m']
        t=[]; f=[]
        for T,yo in zip(x,y):
            fu = (yo-(yn+mn*T)) / ((yu+mu*T)-(yn+mn*T))
            f.append(fu)
            t.append(T)
        at,af=t,f
        diff=1e5
        if transwidth != None:
            for i in t:
                d=abs(i-d50)
                if d<diff:
                    mid = t.index(i)
                    diff=d
            L=int(mid-transwidth); U=int(mid+transwidth)
            t,f = t[L:U], f[L:U]
        return at,af,t,f
def transformCD ( self , x , y , transwidth = None , ax = None ) : d50 = self . guessMidpoint ( x , y ) print 'fitting to get baseline slopes and intercepts..' print 'midpoint is %s' % d50 A , X = Fitting . doFit ( expdata = zip ( x , y ) , model = 'Unfolding' , noiter = 50 , silent = True , guess = False , startvalues = [ 1 , 1 , 1 , 1 , 1 , d50 ] ) fity = X . getFitLine ( x ) fd = X . getFitDict ( ) if ax != None : p = ax . plot ( x , fity , 'r' , lw = 2 ) self . drawParams ( ax , fd ) mn = fd [ 'bn' ] ; mu = fd [ 'bd' ] yn = fd [ 'an' ] ; yu = fd [ 'ad' ] d50 = fd [ 'd50' ] ; m = fd [ 'm' ] t = [ ] ; f = [ ] for T , yo in zip ( x , y ) : fu = ( yo - ( yn + mn * T ) ) / ( ( yu + mu * T ) - ( yn + mn * T ) ) f . append ( fu ) t . append ( T ) at , af = t , f diff = 1e5 if transwidth != None : for i in t : d = abs ( i - d50 ) if d < diff : mid = t . index ( i ) diff = d L = int ( mid - transwidth ) ; U = int ( mid + transwidth ) t , f = t [ L : U ] , f [ L : U ] return at , af , t , f
Transform raw data into fraction unfolded per temp value, by fitting to
a general unfolding equation that extracts baseline/slopes
Transform raw data into fraction unfolded per temp value by fitting to a general unfolding equation that extracts baseline / slopes
"""Transform raw data into fraction unfolded per temp value, by fitting to
            a general unfolding equation that extracts baseline/slopes""" #fit baseline slopes and get intercepts #print X.getResult() #we then use slopes and intercepts get frac unfolded at each temp #slopes #if mu>0.01: mu = 0.01 #intercepts #print mu, mn #print fu, (yo-(yn+mn*T)), (m), mu, mn #if f>0: #try to take useful transition region of data
self
x
y
transwidth
ax