python-3.x - 怎么下载最新版的Heartpy==1.2.4
问题描述
我正在使用 Heartpy 分析嘈杂的心电图信号,但是当我在呼吸示例中运行下面的代码时,我收到了这个错误:
AttributeError:模块“HeartPy”没有属性“enhance_ecg_peaks”
我已经下载了heartpy使用
1-pip install heartpy==1.2.4
2点安装heartpy
3-我已经下载了呼吸:https ://github.com/paulvangentcom/heartrate_analysis_python.git
4-我已经克隆了它
filtered = hp.enhance_ecg_peaks(hp.scale_data(ecg), sample_rate,
iterations=4, aggregation='median', notch_filter=True)
#show filtered signal
plt.figure(figsize=(12,4))
plt.plot(filtered)
plt.show()
#zoom in on signal section and overlay filtered segment
plt.figure(figsize=(12,4))
plt.title('original signal zoom in')
plt.plot(hp.scale_data(ecg[15000:17000]), label='original data')
plt.title('processed signal zoom in')
plt.plot(hp.scale_data(filtered[15000:17000]), alpha=0.5, label='processed
data')
plt.legend()
plt.show()
解决方案
增强心电峰值:heartpy.enhance_ecg_peaks(hrdata,sample_rate,iterations=4,aggregation='mean',notch_filter=True)
这是一个错误,并创建了一个问题heartrate_analysis_python -> 缺少属性
修复步骤:
卸载现有的
heartpy
使用pip uninstall heartpy==1.2.4
克隆存储库
heartpy
并运行安装程序git clone https://github.com/paulvangentcom/heartrate_analysis_python.git cd heartrate_analysis_python python -m setup.py install
然后你可以简单地使用它,它工作得很好:
filtered = hp.enhance_ecg_peaks(hp.scale_data(ecg), sample_rate,
iterations=4, aggregation='median', notch_filter=True)
希望这会帮助你。
推荐阅读
- html - 如何更改马拉雅拉姆语 unicode 字体样式
- android - ADB:如何自动化完整的 BT 扫描、配对和连接
- android - How to use attribute Gravity inside any TextView in a LinearLayout
- c# - add a C++ delegate to C# event
- angular - Angular 4实例变量随局部变量改变
- javascript - Javascript click event on Android mobile device browser doesn't work
- angular - 在 Angular 中使用替代类提供程序时如何使服务类型化
- python - 无法通过命令提示符运行 Python 文件,文件未定义错误
- rest - Bing Maps REST Service Toolkit not working
- python - Python absolute value