Ejemplo n.º 1
0
 def jack_Cv_averages(self, EJack):
     """
     returns the M(=self.nsubsets) Cv Jackknife averages (from the combined subsets)
     """
     CvJack = np.zeros((self.nsubsets,self.T.size))
     if self.rect is 1:
         for i in xrange(self.nsubsets):
             CvJack[i][:] = compute_Z(np.array(EJack[i][:]), self.T, (self.K - self.n), P=self.P, ndof=self.ndof, imp=self.imp, live=self.live)[1]
     else:
         for i in xrange(self.nsubsets):
             CvJack[i][:] = compute_cv_c(np.array(EJack[i][:]), float(P), (self.K - self.n), float(self.Tmin), float(self.Tmax), self.nT, float(self.ndof), self.imp, self.live)
     #print 'CvJack ',CvJack
     return np.array(CvJack)
Ejemplo n.º 2
0
 def Cv_singles(self,Esplit):
     """
     returns the single Cvs
     """
     CvSingle = np.zeros((self.nsubsets,self.T.size))
     if self.rect is 1:
         for i in xrange(self.nsubsets):
             CvSingle[i][:] = compute_Z(np.array(Esplit[i][:]), self.T, (self.n), P=self.P, ndof=self.ndof, imp=self.imp, live=self.live)[1]
     else:
         for i in xrange(self.nsubsets):
             CvSingle[i][:] = compute_cv_c(np.array(Esplit[i][:]), float(P), (self.n), float(self.Tmin), float(self.Tmax), self.nT, float(self.ndof), self.imp, self.live)
     #print 'CvSingle ',CvSingle
     return np.array(CvSingle)
Ejemplo n.º 3
0
 def Cv_singles(self, Esplit):
     """
     returns the single Cvs
     """
     CvSingle = np.zeros((self.nsubsets, self.T.size))
     if self.rect is 1:
         for i in xrange(self.nsubsets):
             CvSingle[i][:] = compute_Z(np.array(Esplit[i][:]),
                                        self.T, (self.n),
                                        P=self.P,
                                        ndof=self.ndof,
                                        imp=self.imp,
                                        live=self.live)[1]
     else:
         for i in xrange(self.nsubsets):
             CvSingle[i][:] = compute_cv_c(np.array(Esplit[i][:]), float(P),
                                           (self.n), float(self.Tmin),
                                           float(self.Tmax), self.nT,
                                           float(self.ndof), self.imp,
                                           self.live)
     #print 'CvSingle ',CvSingle
     return np.array(CvSingle)
Ejemplo n.º 4
0
 def jack_Cv_averages(self, EJack):
     """
     returns the M(=self.nsubsets) Cv Jackknife averages (from the combined subsets)
     """
     CvJack = np.zeros((self.nsubsets, self.T.size))
     if self.rect is 1:
         for i in xrange(self.nsubsets):
             CvJack[i][:] = compute_Z(np.array(EJack[i][:]),
                                      self.T, (self.K - self.n),
                                      P=self.P,
                                      ndof=self.ndof,
                                      imp=self.imp,
                                      live=self.live)[1]
     else:
         for i in xrange(self.nsubsets):
             CvJack[i][:] = compute_cv_c(np.array(EJack[i][:]),
                                         float(P), (self.K - self.n),
                                         float(self.Tmin),
                                         float(self.Tmax), self.nT,
                                         float(self.ndof), self.imp,
                                         self.live)
     #print 'CvJack ',CvJack
     return np.array(CvJack)
Ejemplo n.º 5
0
 #make nd-arrays C contiguous 
 energies = np.array(energies, order='C')
 energies_Cv = np.array(energies_Cv, order='C')
 ##########################################################################################################
  
 print "parallel nprocessors", P
 
 Tmin = args.Tmin
 Tmax = args.Tmax
 nT = args.nT
 dT = (Tmax-Tmin) / nT
 T = np.array([Tmin + dT*i for i in range(nT)])
 
 if args.rect is 1:
     print "rectangular"
     Cv = compute_Z(energies_Cv, T, args.K*len(args.fname), P=P, ndof=args.ndof, imp=args.imp, live=args.live)[1]
 else:
     print "trapezoidal"
     Cv = compute_cv_c(energies_Cv, float(P), float(args.K*len(args.fname)), float(Tmin), float(Tmax), nT, float(args.ndof), args.imp, args.live)
 
 Cv_stdev, Cv_singles, CvMom1 = run_jackknife(energies, args.N, (args.K*len(args.fname)), Tmin, Tmax, nT, P, args.ndof, args.B, args.rect, args.imp, args.live)
 
 with open('cv_std_K{K}_Nsub{N}_d{ndof}_B{B}.dat'.format(K = args.K,N=args.N,ndof=args.ndof,B=args.B), "w") as fout:
     fout.write("#T Cv stdev\n")
     for vals in zip(T, Cv, Cv_stdev):
         fout.write("%g %g %g\n" % vals)
 
 #CvMom1 is also the jackknife estimate
 with open('cv_jack_est_K{K}_Nsub{N}_d{ndof}_B{B}.dat'.format(K = args.K,N=args.N,ndof=args.ndof,B=args.B), "w") as fout:
     fout.write("#T CvMom1 stdev\n")
     for vals in zip(T, CvMom1, Cv_stdev):
Ejemplo n.º 6
0
    ##########################################################################################################

    print "parallel nprocessors", P

    Tmin = args.Tmin
    Tmax = args.Tmax
    nT = args.nT
    dT = (Tmax - Tmin) / nT
    T = np.array([Tmin + dT * i for i in range(nT)])

    if args.rect is 1:
        print "rectangular"
        Cv = compute_Z(energies_Cv,
                       T,
                       args.K * len(args.fname),
                       P=P,
                       ndof=args.ndof,
                       imp=args.imp,
                       live=args.live)[1]
    else:
        print "trapezoidal"
        Cv = compute_cv_c(energies_Cv, float(P),
                          float(args.K * len(args.fname)), float(Tmin),
                          float(Tmax), nT, float(args.ndof), args.imp,
                          args.live)

    Cv_stdev, Cv_singles, CvMom1 = run_jackknife(energies, args.N,
                                                 (args.K * len(args.fname)),
                                                 Tmin, Tmax, nT, P, args.ndof,
                                                 args.B, args.rect, args.imp,
                                                 args.live)