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
评论列表
文章目录