nmrDataMod.py 文件源码

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

项目:pyNMR 作者: bennomeier 项目源码 文件源码
def __entropy(self, spectrum, m):
        """Calculates get m-th derivative of the real part of spectrum and
        returns entropy of its absolute value. """
        assert type(m) is int, 'm should be a (possitive) integer'
        assert m > 0, 'need m > 0'

        #get the real part of the spectrum
        spect = np.array(spectrum)
        spect = spect.real

        # calculate the m-th derivative of the real part of the spectrum
        spectrumDerivative = spect
        for i in range(m):
            spectrumDerivative = np.gradient(spectrumDerivative)

        # now get the entropy of the abslolute value of the m-th derivative:
        entropy = sp.stats.entropy(np.abs(spectrumDerivative))
        return entropy
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号