parameters: (self)
docstring: Perform optimization test and print the results of each iteration.
docstring_summary: Perform optimization test and print the results of each iteration.
docstring_tokens: Perform optimization test and print the results of each iteration .
function: def test(self):
          """
          Perform optimization test and print the results of each iteration.
          """
          print
          print 'testing:',self.name
          GPO = GaussianProcessOptimizer(
              niterations     = self.niterations,
              param_lower     = self.param_lower,
              param_upper     = self.param_upper,
              energy_function = self,
              mode            = self.mode,
              verbose         = self.verbose,
              exit_on_save    = self.exit_on_save,
              )
  
          self.gp = GPO
  
          P0,E0 = GPO.optimize()
          Eref = []
          Eref_err = []
          for P in P0:
              E,Ee = self(P)
              Eref.append(E)
              Eref_err.append(Ee)
          #end for
          Emin,Emin_err = self(self.Pmin)
  
          for i in range(len(P0)):
              print rP(P0[i]),rE(E0[i]),rE(Eref[i]),rE(E0[i]-Eref[i]),rE(E0[i]-Emin)
          #end for
          print 20*'-'
          print rP(self.Pmin),rE(Emin)
  
          if self.plot:
              n=200
              fline = []
              Eline = []
              for i in range(n):
                  f = float(i)/(n-1)
                  Pf = (1-f)*self.Pmin+f*P0[-1]
                  Ef = self(Pf).ravel()[0]
                  fline.append(f)
                  Eline.append(Ef)
                  #print f,Ef
              #end for
              from plotting import figure,plot,show
              figure()
              plot(fline,Eline)
              show()
function_tokens: def test ( self ) : print print 'testing:' , self . name GPO = GaussianProcessOptimizer ( niterations = self . niterations , param_lower = self . param_lower , param_upper = self . param_upper , energy_function = self , mode = self . mode , verbose = self . verbose , exit_on_save = self . exit_on_save , ) self . gp = GPO P0 , E0 = GPO . optimize ( ) Eref = [ ] Eref_err = [ ] for P in P0 : E , Ee = self ( P ) Eref . append ( E ) Eref_err . append ( Ee ) #end for Emin , Emin_err = self ( self . Pmin ) for i in range ( len ( P0 ) ) : print rP ( P0 [ i ] ) , rE ( E0 [ i ] ) , rE ( Eref [ i ] ) , rE ( E0 [ i ] - Eref [ i ] ) , rE ( E0 [ i ] - Emin ) #end for print 20 * '-' print rP ( self . Pmin ) , rE ( Emin ) if self . plot : n = 200 fline = [ ] Eline = [ ] for i in range ( n ) : f = float ( i ) / ( n - 1 ) Pf = ( 1 - f ) * self . Pmin + f * P0 [ - 1 ] Ef = self ( Pf ) . ravel ( ) [ 0 ] fline . append ( f ) Eline . append ( Ef ) #print f,Ef #end for from plotting import figure , plot , show figure ( ) plot ( fline , Eline ) show ( )