postProcess.py 文件源码

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

项目:Polymers 作者: FracturedRocketSpace 项目源码 文件源码
def computeGyradiusStd(gyradiusSq, polWeights):
    # Calc Weighted gyradius and standard deviation

    # Initiate variables
    weightedGyradiusSq=np.zeros(c.nBeads)
    weightedGyradiusSqStd=np.zeros(c.nBeads)

    # Loop over all possible polymer lengths
    for z in range(c.nBeads):
        # Get weight for bead number z in all polymers
        w = np.squeeze(np.asarray(polWeights)[:,z])
        # Count nonzero
        dataLength = len( np.flatnonzero(w!=0) )
        # Calculate mean and standard deveation of mean
        weightedGyradiusSq[z]=np.average(gyradiusSq[:,z], weights=w)
        weightedGyradiusSqStd[z]=( (np.average((gyradiusSq[:,z] - weightedGyradiusSq[z])**2, weights=w)) / (dataLength))**(1/2)

    return weightedGyradiusSq, weightedGyradiusSqStd
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号