g = numpy.ones(2)
    print "statistical inefficiencies taken from input options and are %.3f and %.3f steps" % (
        options.efficiency[0], options.efficiency[1])
if (options.useg == 'subsample'):
    readmdfiles.subsample(N_k, U_kn, V_kn, N_kn, g, type)
else:
    print "statistical efficiencies used to scale the statistical uncertained determined from all data"
figname = options.figname
title = options.figname

checkensemble.ProbabilityAnalysis(N_k,
                                  type=analysis_type,
                                  T_k=T_k,
                                  P_k=P_k,
                                  mu_k=mu_k,
                                  U_kn=U_kn,
                                  V_kn=V_kn,
                                  N_kn=N_kn,
                                  title=title,
                                  figname=figname,
                                  nbins=nbins,
                                  reptype='bootstrap',
                                  g=g,
                                  nboots=nboots,
                                  bMaxwell=(type == 'kinetic'),
                                  bLinearFit=bLinearFit,
                                  bNonLinearFit=bNonLinearFit,
                                  bMaxLikelihood=bMaxLikelihood,
                                  seed=options.seed,
                                  kB=kB)
Esempio n. 2
0
            p = numpy.exp(beta_k[k] * mu_k[k]) * numpy.sqrt(
                2 * numpy.pi / beta_k[k] * K_k[k])
            N_kn[k, n] = scipy.stats.geom.rvs(1 - p, size=1)

            # now generate random distances
            x_i = numpy.random.normal(O_k[k], sigma_k[k], N_kn[k, n])

            # compute potential energy of all samples in all potentials
            U_kn[k, n] = 0.5 * (K_k[k] * numpy.sum(x_i**2))

    addrep = [U_kn.copy(), N_kn.copy()]
    reps.append(addrep)

checkensemble.ProbabilityAnalysis(N_k,
                                  type=analysis_type,
                                  T_k=T_k,
                                  mu_k=mu_k,
                                  U_kn=U_kn,
                                  N_kn=N_kn,
                                  kB=1.0,
                                  title=title,
                                  figname=options.figname,
                                  nbins=options.nbins,
                                  reptype=reptype,
                                  nboots=options.nboots,
                                  reps=reps,
                                  cuttails=options.cuttails,
                                  eunits='kT',
                                  seed=options.seed)
else:
    g = options.efficiency*numpy.ones(K)
    print "statistical inefficiency taken from input options is %f" % (options.efficiency)
if (options.useg == 'subsample'):
    readmdfiles.subsample(N_k,U_kn,V_kn,N_kn,g,type)
else:
    print "statistical efficiencies used to scale the statistical uncertained determined from all data"
figname = options.figname
title = options.figname

for k in range(K-1):
    print 'Now analyzing replicas %d and %d' % (k,k+1)
    twoN = numpy.array([N_k[k],N_k[k+1]])
    if (type in onlyE) or (type == 'enthalpy') or (type == 'jointEV'):
        twoT = numpy.array([T_k[k],T_k[k+1]])
    else:
        twoT = None
    if type in requireV:
        twoP = numpy.array([P_k[k],P_k[k+1]])
    else:
        twoP = None
    twoU = U_kn[k:k+2,:]
    twoV = V_kn[k:k+2,:]
    checkensemble.ProbabilityAnalysis(twoN,type=analysis_type,T_k=twoT,P_k=twoP,U_kn=twoU,V_kn=twoV,nbins=nbins,
                        reptype='bootstrap',g=g,nboots=nboots,bMaxwell=(type=='kinetic'),figname='replica',bLinearFit=bLinearFit,bNonLinearFit=bNonLinearFit,bMaxLikelihood=bMaxLikelihood,seed=options.seed)

    # now, we construct a graph with all of the lines. We could write
    # the probability analysis to do it, but better to do new specially designed plot here.