Garmin TCX文件简单解析器
项目描述
python-tcxparser是Garmin的TCX文件格式的最小解析器。它并不全面。
- 提取的数据
锻炼起点纬度和经度
锻炼类型(跑步、散步等)
完成锻炼的时间(ISO UTC时间)
锻炼距离(米)
锻炼持续时间(秒)
锻炼中消耗的卡路里(设备估算)
锻炼中的平均、最大和最小心率
锻炼中的平均配速
锻炼中的平均海拔
锻炼中的上升和下降
最大和最小海拔
每个数据点的时间戳(ISO UTC时间)
平均和最大踏频(骑行活动)
心率区间的百分比和花费时间
平均和最大功率
总步数(也称为划水次数)
安装
从PyPI安装
pip install python-tcxparser
用法
基本用法示例
>>> import tcxparser
>>> tcx = tcxparser.TCXParser('/home/vinod/Downloads/20121226-212953.tcx')
>>> # Duration of workout in seconds
... tcx.duration
1992.78
>>> # latitude/longitude at start of workout
... tcx.latitude
35.951880198
>>> tcx.longitude
-79.0931872185
>>> tcx.activity_type
'running'
>>> # ISO UTC timestamp when workout completed
... tcx.completed_at
'2012-12-26T22:03:05Z'
>>> # distance of workout in meters
... tcx.distance
4686.31103516
>>> tcx.distance_units
'meters'
>>> # calories burned (as reported by device)
... tcx.calories
379
>>> # percentage of workout spent in each user-defined heart rate zone
... tcx.hr_percent_in_zones({"Z0": (0, 99), "Z1": (100, 129), "Z2": (130, 200)})
{"Z0": 14, "Z1": 36, "Z2": 50}
兼容性
Python 3.7+,见tox.ini。
许可证
BSD
维护者信息
我们使用Github Actions进行代码风格检查(使用pre-commit、black、isort和flake8),测试(使用tox和tox-gh-actions),并计算覆盖率(使用coverage)。
我们有一个本地脚本进行这些操作,命名为maintain.sh
$ ./maintain.sh
当在GitHub中创建新的发布版本时,GitHub Action工作流程还会构建并推送新的包到PyPI。这使用了一个项目特定的PyPI令牌,具体请参阅PyPI文档。该令牌已保存在本仓库的PYPI_PASSWORD设置中,但未在其他地方保存,因此如果需要,应删除当前令牌并生成新的一个。
一如既往,在创建发布版本之前,请确保在setup.py中提升版本,以确保将正确的版本推送到PyPI。
联系方式
如有任何疑问,请与我联系:Vinod Kurup (vinod@kurup.com)
项目详情
关闭
哈希值 for python_tcxparser-2.3.0-py2.py3-none-any.whl
| 算法 | 哈希摘要 | |
|---|---|---|
| SHA256 | a223cc2c4f5e9e054cd68158008564e986eb7191247b55c254650bc8662451fd |
|
| MD5 | 83b7e4a385a586fc5763477c7304aefa |
|
| BLAKE2b-256 | 1ec43d78e89b672c6f16118d3da29afe8e9fe397184d5059358cb7fe850903eb |