Anaconda安装SpectralEntropy
https://github.com/YuanyueLi/SpectralEntropy
https://github.com/YuanyueLi/SpectralEntropy/releases/
1. 下载压缩包,解压;
2. 在解压得到的文件夹中 Shift+鼠标右键,在此处打开Powershell窗口,复制文件夹路径;
3. 以管理员身份运行Anaconda Promt,cd 路径(举例 >cd /d D:\Download\SpectralEntropy-1.0.0\SpectralEntropy-1.0.0)
4. 输入 python setup.py build_ext --inplace,回车键运行;
5. 完成上一步后输入 python setup.py install,回车键运行。
可以运行以下代码测试是否成功安装SpectralEntropy。
import numpy as np
import scipy.stats
import spectral_entropy
spectrum = np.array([[69.071, 7.917962], [86.066, 1.021589], [86.0969, 100.0]], dtype=np.float32)
spectrum = spectral_entropy.clean_spectrum(spectrum)
entropy = scipy.stats.entropy(spectrum[:, 1])
print("Spectral entropy is {}.".format(entropy))
# The output should be: Entropy similarity:0.2605222463607788.
print('-' * 30)