项目作者: tare

项目描述 :
Grammar-based generation of structured cycling workouts
高级语言: Python
项目地址: git://github.com/tare/zwog.git
创建时间: 2020-07-25T22:42:44Z
项目社区:https://github.com/tare/zwog

开源协议:BSD 3-Clause "New" or "Revised" License

下载


Zwift workout generator

Have you ever been frustrated by any WYSIWYG workout editor, such as the Zwift Workout editor and the TrainingPeaks Workout Builder?

ZWOG makes it easier to generate structured workouts using a syntax similar to the one used on What’s on Zwift?.

Installation

PyPI

Install the latest stable version from PyPI

  1. $ pip install zwog

GitHub

Install the version from the main branch

  1. $ pip install git+https://github.com/tare/zwog.git

Syntax

The basic building blocks are ramp intervals

  1. 10min from 30 to 60% FTP

and steady state intervals

  1. 2hrs 10min @ 60% FTP

Interval durations can be given in seconds (sec,s), minutes (min,m), and hours (hrs,h).

Moreover, it is possible to create repeated intervals

  1. 4x 5min @ 95% FTP, 5min @ 85% FTP

Finally, a complete workout can be defined as follows

  1. 10min from 40 to 85% FTP
  2. 3x 5min @ 95% FTP, 5min @ 86% FTP
  3. 5min @ 50% FTP
  4. 3x 5min @ 95% FTP, 5min @ 86% FTP
  5. 10min from 75 to 55% FTP

The parser is rather robust when it comes to newlines and other whitespaces.

Usage

You can use the command line application

  1. $ zwog --help
  2. usage: zwog [-h] -i INPUT_FILE [-o OUTPUT_FILE] [-a AUTHOR] [-n NAME]
  3. [-c CATEGORY] [-s SUBCATEGORY] [-v]
  4. Zwift workout generator
  5. optional arguments:
  6. -h, --help show this help message and exit
  7. -i INPUT_FILE, --input_file INPUT_FILE
  8. input filename
  9. -o OUTPUT_FILE, --output_file OUTPUT_FILE
  10. output filename
  11. -a AUTHOR, --author AUTHOR
  12. author name
  13. -n NAME, --name NAME workout name
  14. -c CATEGORY, --category CATEGORY
  15. category
  16. -s SUBCATEGORY, --subcategory SUBCATEGORY
  17. subcategory
  18. -v, --version show program's version number and exit

or call it from Python

  1. import zwog
  2. workout_text = "15min from 10 to 50% FTP 5min from 50 to 70% FTP 2x 0.5hrs @ 100% FTP, 0.5hrs @ 50% FTP, 10min from 80 to 90% FTP 2min @ 50% FTP\n2min @ 50% FTP\n 10min @ 50% FTP, 10min @ 60% FTP 10min from 50 to 10% FTP"
  3. workout = zwog.ZWOG(workout_text)
  4. workout.save_zwo('workout.xml')
  5. print(workout)
  6. print(f"{round(workout.tss)} TSS")

Limitations