PEATDB/plugins/VantHoffAnalysis.py
def benchmark(self,E=None,d=None, method=1):
        """Test methods with varying paramaters, smoothing etc"""
        if E==None and self.E != None:
            E = self.E; d=self.dmenu.getcurselection()

        path='vh_benchmark'
        if not os.path.exists(path):
            os.mkdir(path)
        dHvals=[]

        if method == 1:
            xlabel = 'width (K)'
            title = 'method 1: deltaH variation with trans region width fit'
            vals=range(5,140,5)
            for w in vals:
                dH, dS, ax = self.fitVantHoff(E,d,transwidth=w,show=False,
                                              figname=os.path.join(path,'%s_%s.png' %(d,w)))
                if dH == None: dH=0
                dHvals.append(dH)
            #take best values from middle
            #dHvals= dHvals[5:16]
        elif method == 2:
            xlabel = 'width (K)'
            title = 'method 2: deltaH variation with width fit'
            vals=range(5,140,5)
            for w in vals:
                dH, dcp, dTm = self.fitElwellSchellman(E,d,transwidth=w,show=False,
                                                       figname=os.path.join(path,'%s_%s.png' %(d,w)))
                dHvals.append(dH)
        elif method == 3:
            xlabel = 'smoothing degree'
            title = 'method 3: deltaH variation with degree of smoothing'
            vals=range(1,30,3)
            for s in vals:
                dH, dTm = self.fitDifferentialCurve(E,d,smooth=s,show=False,
                                                    figname=os.path.join(path,'%s_%s.png' %(d,s)))
                dHvals.append(dH)
        mean = numpy.mean(dHvals)
        stdev = numpy.std(dHvals)
        f=plt.figure()
        ax=f.add_subplot(111)
        ax.plot(vals, dHvals,lw=2)
        ax.set_xlabel(xlabel)
        ax.set_ylabel('deltaH (kJ)')
        ax.set_title('mean: %2.2f stdev: %2.2f'%(mean, stdev))
        f.suptitle(title)
        f.savefig('benchmark_%s.png' %method)
        cw=csv.writer(open('benchmark_%s.csv' %method,'w'))
        for row in zip(vals,dHvals):
            cw.writerow(row)
        return
Test methods with varying paramaters, smoothing etc
Test methods with varying paramaters, smoothing etc
Test methods with varying paramaters smoothing etc
def benchmark(self,E=None,d=None, method=1):
        if E==None and self.E != None:
            E = self.E; d=self.dmenu.getcurselection()
        path='vh_benchmark'
        if not os.path.exists(path):
            os.mkdir(path)
        dHvals=[]
        if method == 1:
            xlabel = 'width (K)'
            title = 'method 1: deltaH variation with trans region width fit'
            vals=range(5,140,5)
            for w in vals:
                dH, dS, ax = self.fitVantHoff(E,d,transwidth=w,show=False,
                                              figname=os.path.join(path,'%s_%s.png' %(d,w)))
                if dH == None: dH=0
                dHvals.append(dH)
        elif method == 2:
            xlabel = 'width (K)'
            title = 'method 2: deltaH variation with width fit'
            vals=range(5,140,5)
            for w in vals:
                dH, dcp, dTm = self.fitElwellSchellman(E,d,transwidth=w,show=False,
                                                       figname=os.path.join(path,'%s_%s.png' %(d,w)))
                dHvals.append(dH)
        elif method == 3:
            xlabel = 'smoothing degree'
            title = 'method 3: deltaH variation with degree of smoothing'
            vals=range(1,30,3)
            for s in vals:
                dH, dTm = self.fitDifferentialCurve(E,d,smooth=s,show=False,
                                                    figname=os.path.join(path,'%s_%s.png' %(d,s)))
                dHvals.append(dH)
        mean = numpy.mean(dHvals)
        stdev = numpy.std(dHvals)
        f=plt.figure()
        ax=f.add_subplot(111)
        ax.plot(vals, dHvals,lw=2)
        ax.set_xlabel(xlabel)
        ax.set_ylabel('deltaH (kJ)')
        ax.set_title('mean: %2.2f stdev: %2.2f'%(mean, stdev))
        f.suptitle(title)
        f.savefig('benchmark_%s.png' %method)
        cw=csv.writer(open('benchmark_%s.csv' %method,'w'))
        for row in zip(vals,dHvals):
            cw.writerow(row)
        return
def benchmark ( self , E = None , d = None , method = 1 ) : if E == None and self . E != None : E = self . E ; d = self . dmenu . getcurselection ( ) path = 'vh_benchmark' if not os . path . exists ( path ) : os . mkdir ( path ) dHvals = [ ] if method == 1 : xlabel = 'width (K)' title = 'method 1: deltaH variation with trans region width fit' vals = range ( 5 , 140 , 5 ) for w in vals : dH , dS , ax = self . fitVantHoff ( E , d , transwidth = w , show = False , figname = os . path . join ( path , '%s_%s.png' % ( d , w ) ) ) if dH == None : dH = 0 dHvals . append ( dH ) elif method == 2 : xlabel = 'width (K)' title = 'method 2: deltaH variation with width fit' vals = range ( 5 , 140 , 5 ) for w in vals : dH , dcp , dTm = self . fitElwellSchellman ( E , d , transwidth = w , show = False , figname = os . path . join ( path , '%s_%s.png' % ( d , w ) ) ) dHvals . append ( dH ) elif method == 3 : xlabel = 'smoothing degree' title = 'method 3: deltaH variation with degree of smoothing' vals = range ( 1 , 30 , 3 ) for s in vals : dH , dTm = self . fitDifferentialCurve ( E , d , smooth = s , show = False , figname = os . path . join ( path , '%s_%s.png' % ( d , s ) ) ) dHvals . append ( dH ) mean = numpy . mean ( dHvals ) stdev = numpy . std ( dHvals ) f = plt . figure ( ) ax = f . add_subplot ( 111 ) ax . plot ( vals , dHvals , lw = 2 ) ax . set_xlabel ( xlabel ) ax . set_ylabel ( 'deltaH (kJ)' ) ax . set_title ( 'mean: %2.2f stdev: %2.2f' % ( mean , stdev ) ) f . suptitle ( title ) f . savefig ( 'benchmark_%s.png' % method ) cw = csv . writer ( open ( 'benchmark_%s.csv' % method , 'w' ) ) for row in zip ( vals , dHvals ) : cw . writerow ( row ) return
Test methods with varying paramaters, smoothing etc
Test methods with varying paramaters smoothing etc
"""Test methods with varying paramaters, smoothing etc""" #take best values from middle #dHvals= dHvals[5:16]
self
E
d
method