本文整理汇总了Python中pymbar.MBAR.computeEffectiveSampleNumber方法的典型用法代码示例。如果您正苦于以下问题:Python MBAR.computeEffectiveSampleNumber方法的具体用法?Python MBAR.computeEffectiveSampleNumber怎么用?Python MBAR.computeEffectiveSampleNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymbar.MBAR
的用法示例。
在下文中一共展示了MBAR.computeEffectiveSampleNumber方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_mbar_computeEffectiveSampleNumber
# 需要导入模块: from pymbar import MBAR [as 别名]
# 或者: from pymbar.MBAR import computeEffectiveSampleNumber [as 别名]
def test_mbar_computeEffectiveSampleNumber():
""" testing computeEffectiveSampleNumber """
for system_generator in system_generators:
name, test = system_generator()
x_n, u_kn, N_k_output, s_n = test.sample(N_k, mode='u_kn')
eq(N_k, N_k_output)
mbar = MBAR(u_kn, N_k)
# one mathematical effective sample numbers should be between N_k and sum_k N_k
N_eff = mbar.computeEffectiveSampleNumber()
sumN = np.sum(N_k)
assert all(N_eff > N_k)
assert all(N_eff < sumN)
示例2: sqrt
# 需要导入模块: from pymbar import MBAR [as 别名]
# 或者: from pymbar.MBAR import computeEffectiveSampleNumber [as 别名]
print "looks like it is."
else:
print "but it's not."
print "Overlap eigenvalue output"
print O_i
print "Overlap scalar output"
print O
print "============================================"
print " Testing computeEffectiveSampleNumber "
print "============================================"
N_eff = mbar.computeEffectiveSampleNumber(verbose = True)
print "Effective Sample number"
print N_eff
print "Compare stanadrd estimate of <x> with the MBAR estimate of <x>"
print "We should have that with MBAR, err_MBAR = sqrt(N_k/N_eff)*err_standard,"
print "so standard (scaled) results should be very close to MBAR results."
print "No standard estimate exists for states that are not sampled."
A_kn = x_kn
(val_mbar, err_mbar) = mbar.computeExpectations(A_kn)
err_standard = numpy.zeros([K],dtype = numpy.float64)
err_scaled = numpy.zeros([K],dtype = numpy.float64)
for k in range(K):
if N_k[k] != 0:
# use position
err_standard[k] = numpy.std(A_kn[k,0:N_k[k]])/numpy.sqrt(N_k[k]-1)