Ghost/make_figs.py
def load_all_calculated(self,exp_ghosts):
        """Load all current predictions of ghosts"""
        predictions=[['Xray_avg.pickle','Xray'],['MD_calcghosts_nowat.pickle','MD_nowat'],['average_calcghosts_predrag_all.pickle','MD'],['Xrays/all_ghosts_2LZT_H.pdb.pickle','2LZT']] # ['average_calcghosts_predragGB.pickle','GB'],
        alldata={}
        for filename,ensemble_name in predictions:
            import os
            filename=os.path.join(os.getcwd(),self.options.calcghostdir,filename)
            calc_ghosts=self.load_calcghosts(self.options,filename)
            print 
            print '=================%s====================' %ensemble_name
            print
            big_satisfied=self.find_opteps(exp_ghosts,calc_ghosts)
            alldata[ensemble_name]=self.restraint_plot(big_satisfied)
        #
        # Do the full plot
        #
        import pylab
        colours=['k','r','b','g','y','c','m','grey','orange','pink']
        pylab.clf()
        count=0
        sumsum=[]
        for ensname in sorted(alldata.keys()):
            for xs,present,absent,method in alldata[ensname]:
                text='%s:%s' %(ensname,method)
                col=colours[count]
                marker=''
                if ensname=='GB':
                    marker='o'
                pylab.plot(xs,present,'-',marker=marker,color=col,label=text,linewidth=3)
                pylab.plot(xs,absent,'--',marker=marker,color=col,linewidth=3)
                count=count+1
                if count==len(colours):
                    count=0
                #
                # Find the best eps
                #
                ecount=0
                maxval=-999.9
                besteps=0.0
                for val in present:
                    if val>maxval:
                        maxval=val
                        besteps=ecount
                    ecount=ecount+1
                print 'Best eps for %s present: %5.1f with %5.1f %% satisfied, at this eps absent is %5.1f' %(text,xs[besteps],maxval,absent[besteps])
                sumsum.append([maxval+absent[besteps],xs[besteps],maxval,absent[besteps],text])
        sumsum.sort()
        print 'Sum, Eps, %present, %absent, method'
        for sum,eps,present,absent,text in sumsum:
            print '%5.1f, %5.1f, %5.1f, %5.1f %s' %(sum,eps,present,absent,text)
                    


        #
        # Finish the plot
        #
        pylab.ylim((0.0,100.0))
        pylab.xlim((0.0,30.0))
        pylab.legend()
        pylab.title('Satisfied restraints for %s' %self.options.atom)
        pylab.xlabel('Dielectric constant')
        pylab.ylabel('% restraints satisfied')
        pylab.savefig('bigplot.png',dpi=300)
        pylab.show()
        return
Load all current predictions of ghosts
Load all current predictions of ghosts
Load all current predictions of ghosts
def load_all_calculated(self,exp_ghosts):
        predictions=[['Xray_avg.pickle','Xray'],['MD_calcghosts_nowat.pickle','MD_nowat'],['average_calcghosts_predrag_all.pickle','MD'],['Xrays/all_ghosts_2LZT_H.pdb.pickle','2LZT']] 
        alldata={}
        for filename,ensemble_name in predictions:
            import os
            filename=os.path.join(os.getcwd(),self.options.calcghostdir,filename)
            calc_ghosts=self.load_calcghosts(self.options,filename)
            print 
            print '=================%s====================' %ensemble_name
            print
            big_satisfied=self.find_opteps(exp_ghosts,calc_ghosts)
            alldata[ensemble_name]=self.restraint_plot(big_satisfied)
         Do the full plot
        import pylab
        colours=['k','r','b','g','y','c','m','grey','orange','pink']
        pylab.clf()
        count=0
        sumsum=[]
        for ensname in sorted(alldata.keys()):
            for xs,present,absent,method in alldata[ensname]:
                text='%s:%s' %(ensname,method)
                col=colours[count]
                marker=''
                if ensname=='GB':
                    marker='o'
                pylab.plot(xs,present,'-',marker=marker,color=col,label=text,linewidth=3)
                pylab.plot(xs,absent,'--',marker=marker,color=col,linewidth=3)
                count=count+1
                if count==len(colours):
                    count=0
                 Find the best eps
                ecount=0
                maxval=-999.9
                besteps=0.0
                for val in present:
                    if val>maxval:
                        maxval=val
                        besteps=ecount
                    ecount=ecount+1
                print 'Best eps for %s present: %5.1f with %5.1f %% satisfied, at this eps absent is %5.1f' %(text,xs[besteps],maxval,absent[besteps])
                sumsum.append([maxval+absent[besteps],xs[besteps],maxval,absent[besteps],text])
        sumsum.sort()
        print 'Sum, Eps, %present, %absent, method'
        for sum,eps,present,absent,text in sumsum:
            print '%5.1f, %5.1f, %5.1f, %5.1f %s' %(sum,eps,present,absent,text)
         Finish the plot
        pylab.ylim((0.0,100.0))
        pylab.xlim((0.0,30.0))
        pylab.legend()
        pylab.title('Satisfied restraints for %s' %self.options.atom)
        pylab.xlabel('Dielectric constant')
        pylab.ylabel('% restraints satisfied')
        pylab.savefig('bigplot.png',dpi=300)
        pylab.show()
        return
def load_all_calculated ( self , exp_ghosts ) : predictions = [ [ 'Xray_avg.pickle' , 'Xray' ] , [ 'MD_calcghosts_nowat.pickle' , 'MD_nowat' ] , [ 'average_calcghosts_predrag_all.pickle' , 'MD' ] , [ 'Xrays/all_ghosts_2LZT_H.pdb.pickle' , '2LZT' ] ] alldata = { } for filename , ensemble_name in predictions : import os filename = os . path . join ( os . getcwd ( ) , self . options . calcghostdir , filename ) calc_ghosts = self . load_calcghosts ( self . options , filename ) print print '=================%s====================' % ensemble_name print big_satisfied = self . find_opteps ( exp_ghosts , calc_ghosts ) alldata [ ensemble_name ] = self . restraint_plot ( big_satisfied ) import pylab colours = [ 'k' , 'r' , 'b' , 'g' , 'y' , 'c' , 'm' , 'grey' , 'orange' , 'pink' ] pylab . clf ( ) count = 0 sumsum = [ ] for ensname in sorted ( alldata . keys ( ) ) : for xs , present , absent , method in alldata [ ensname ] : text = '%s:%s' % ( ensname , method ) col = colours [ count ] marker = '' if ensname == 'GB' : marker = 'o' pylab . plot ( xs , present , '-' , marker = marker , color = col , label = text , linewidth = 3 ) pylab . plot ( xs , absent , '--' , marker = marker , color = col , linewidth = 3 ) count = count + 1 if count == len ( colours ) : count = 0 ecount = 0 maxval = - 999.9 besteps = 0.0 for val in present : if val > maxval : maxval = val besteps = ecount ecount = ecount + 1 print 'Best eps for %s present: %5.1f with %5.1f %% satisfied, at this eps absent is %5.1f' % ( text , xs [ besteps ] , maxval , absent [ besteps ] ) sumsum . append ( [ maxval + absent [ besteps ] , xs [ besteps ] , maxval , absent [ besteps ] , text ] ) sumsum . sort ( ) print 'Sum, Eps, %present, %absent, method' for sum , eps , present , absent , text in sumsum : print '%5.1f, %5.1f, %5.1f, %5.1f %s' % ( sum , eps , present , absent , text ) pylab . ylim ( ( 0.0 , 100.0 ) ) pylab . xlim ( ( 0.0 , 30.0 ) ) pylab . legend ( ) pylab . title ( 'Satisfied restraints for %s' % self . options . atom ) pylab . xlabel ( 'Dielectric constant' ) pylab . ylabel ( '% restraints satisfied' ) pylab . savefig ( 'bigplot.png' , dpi = 300 ) pylab . show ( ) return
Load all current predictions of ghosts
Load all current predictions of ghosts
"""Load all current predictions of ghosts""" # ['average_calcghosts_predragGB.pickle','GB'], # # Do the full plot # # # Find the best eps # # # Finish the plot #
self
exp_ghosts