pKaTool/CCPS_stab_opt.py
def _CCPS_maxrange(self,spec):
        """Score for having the maximum of the CCPS in a range"""
        #
        # Get the pH values where we want to impose the criterium
        #
        if not self.CCPSmax_pH_vals:
            self.CCPSmax_pH_vals=self.get_pH_range(spec['pH']['var'].get())
            print 'Monitoring activity at these pH values',self.CCPSmax_pH_vals
        #
        # pH values have already been identified
        #
        opttype=spec['opttype']['var'].get()
        cutoff=spec['cutoff']['var'].get()
        if opttype=='maximise':
            #
            # Find the maximum activity
            #
            maxact=0.0
            for pH in self.act_prof.keys():
                maxact=max(maxact,self.act_prof[pH])
            #
            # Report the fraction of points that are within 10%
            #
            count=0
            ok=0.0
            for pH in self.CCPSmax_pH_vals:
                if maxact>0.000001:
                    if abs((self.act_prof[pH]-maxact)/maxact)<=cutoff:
                        pass
                    else:
                        ok=ok+abs((self.act_prof[pH]-maxact)/maxact)
                        print pH,(self.act_prof[pH]-maxact)/maxact
                else:
                    ok=ok+10*(0.000001-maxact)
                count=count+1
            if count>0:
                ok=ok/float(count)
            #
        else:
            raise Exception
        ok=ok*spec['weight']['var'].get()
        return ok
Score for having the maximum of the CCPS in a range
Score for having the maximum of the CCPS in a range
Score for having the maximum of the CCPS in a range
def _CCPS_maxrange(self,spec):
         Get the pH values where we want to impose the criterium
        if not self.CCPSmax_pH_vals:
            self.CCPSmax_pH_vals=self.get_pH_range(spec['pH']['var'].get())
            print 'Monitoring activity at these pH values',self.CCPSmax_pH_vals
         pH values have already been identified
        opttype=spec['opttype']['var'].get()
        cutoff=spec['cutoff']['var'].get()
        if opttype=='maximise':
             Find the maximum activity
            maxact=0.0
            for pH in self.act_prof.keys():
                maxact=max(maxact,self.act_prof[pH])
             Report the fraction of points that are within 10%
            count=0
            ok=0.0
            for pH in self.CCPSmax_pH_vals:
                if maxact>0.000001:
                    if abs((self.act_prof[pH]-maxact)/maxact)<=cutoff:
                        pass
                    else:
                        ok=ok+abs((self.act_prof[pH]-maxact)/maxact)
                        print pH,(self.act_prof[pH]-maxact)/maxact
                else:
                    ok=ok+10*(0.000001-maxact)
                count=count+1
            if count>0:
                ok=ok/float(count)
        else:
            raise Exception
        ok=ok*spec['weight']['var'].get()
        return ok
def _CCPS_maxrange ( self , spec ) : if not self . CCPSmax_pH_vals : self . CCPSmax_pH_vals = self . get_pH_range ( spec [ 'pH' ] [ 'var' ] . get ( ) ) print 'Monitoring activity at these pH values' , self . CCPSmax_pH_vals opttype = spec [ 'opttype' ] [ 'var' ] . get ( ) cutoff = spec [ 'cutoff' ] [ 'var' ] . get ( ) if opttype == 'maximise' : maxact = 0.0 for pH in self . act_prof . keys ( ) : maxact = max ( maxact , self . act_prof [ pH ] ) count = 0 ok = 0.0 for pH in self . CCPSmax_pH_vals : if maxact > 0.000001 : if abs ( ( self . act_prof [ pH ] - maxact ) / maxact ) <= cutoff : pass else : ok = ok + abs ( ( self . act_prof [ pH ] - maxact ) / maxact ) print pH , ( self . act_prof [ pH ] - maxact ) / maxact else : ok = ok + 10 * ( 0.000001 - maxact ) count = count + 1 if count > 0 : ok = ok / float ( count ) else : raise Exception ok = ok * spec [ 'weight' ] [ 'var' ] . get ( ) return ok
Score for having the maximum of the CCPS in a range
Score for having the maximum of the CCPS in a range
"""Score for having the maximum of the CCPS in a range""" # # Get the pH values where we want to impose the criterium # # # pH values have already been identified # # # Find the maximum activity # # # Report the fraction of points that are within 10% # #
self
spec