postProcess.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:Polymers 作者: FracturedRocketSpace 项目源码 文件源码
def computeEndToEnd(endtoendDistances, polWeights):
    # Initiate variables
    weightedEndtoendSq=np.zeros(c.nBeads)
    weightedEndtoendSqStd=np.zeros(c.nBeads)

    # Loop over all possible polymer lengths
    for z in range(c.nBeads):
        # Get data
        t1 = np.squeeze(np.asarray(endtoendDistances)[:,z])
        t2 = np.squeeze(np.asarray(polWeights)[:,z]);
        # Count non-Zero
        dataLength = len( np.flatnonzero(t2!=0) );
        # Calculate mean and standard deveation of mean
        weightedEndtoendSq[z]=np.average(t1, weights=t2)
        weightedEndtoendSqStd[z]=( (np.average((t1 - weightedEndtoendSq[z])**2, weights=t2)) / (dataLength))**(1/2)

    return weightedEndtoendSq, weightedEndtoendSqStd

 # Calculate gyradius and errors
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号