Skip to content
0jonjoPublic

About

A Ruby gem for runners: pace, time, and distance calculations, unit conversions, race predictions, GPS track analysis, age grading, VO2max estimation, and training zones.

Topics

Resources

Stars

15 stars

Watchers

1 watching

Forks

Repository files navigation

calcpace logo

Calcpace Gem Version

A Ruby gem for runners: pace, time, and distance calculations, unit conversions, race predictions (including personalized ones), GPS track analysis with grade-adjusted pace, heat, humidity and altitude adjustments, age grading, VO2max estimation and norms, and training zones.

  • Built on published models: Riegel, Cameron, Daniels & Gilbert, El Helou, Minetti, FRIEND and the 2025 age-grading tables. The guide names the source behind each number and says where the published data ends and an extrapolation begins.
  • Checked: the single-line examples in this README and in the usage guide run in the test suite against the real code.
  • No runtime dependencies. Ruby >= 3.3.

See it in action: calcpace.app — free running calculators, race predictors and a training log in 16 languages, all powered by this gem. Also on Android: Google Play.

Installation

gem 'calcpace', '~> 2.1'

Quick tour

require 'calcpace'
calc = Calcpace.new

calc.clock_pace('01:00:00', 10)                          # => "00:06:00"
calc.predict_time_clock('5k', '00:27:12', 'marathon')    # => "04:20:52"
calc.calculate_penalty(temperature: 30, humidity: 90)[:total_penalty_percent]  # => 12.16
calc.race_splits('10k', target_time: '00:40:00', split_distance: '5k', strategy: :negative)  # => ["00:20:12", "00:40:00"]
calc.estimate_vo2max(10.0, '00:40:00')                   # => 51.9
calc.age_grade(10.0, '00:45:00', age: 55, sex: :male)[:age_grade_percent]  # => 68.9
calc.training_paces(50.0)[:threshold].fast_clock         # => "00:04:15"

What's in it

Every method, with examples, is in the usage guide:

Area What it does
Basic calculations Pace, time, distance and velocity, in seconds or HH:MM:SS
Environmental adjustments Heat, humidity and altitude penalties, applied to a time or a prediction
Unit and pace conversions 40+ conversions between distance and speed units; pace per km ↔ per mile
Race pace & time Any named race or plain distance
Race splits Even, negative or positive splits
Race time predictions Riegel and Cameron
Personalized predictions Tanda marathon from training volume, personal Riegel exponent
GPS track analysis Distance, elevation gain, per-km splits, grade-adjusted pace (Minetti)
Age grading 2025 road tables
VO2max estimation Daniels & Gilbert, FRIEND age/sex norms, effort and elevation context
Training zones Daniels paces, Karvonen and %HRmax zones, time in zones
Lap analysis Reads an interval session (reps, work and rest paces) from laps
Stride & cadence Stride length from pace and cadence, and back
Fitness predictor Race times from a VO2max
Other utilities and errors Helpers and the error classes

Testing

bundle exec rake

Requires Ruby >= 3.3.0. Tested with Ruby 3.3, 3.4, and 4.0.

Contributing

Clone the repo and submit a pull request. Please include tests.

License

MIT License

About

A Ruby gem for runners: pace, time, and distance calculations, unit conversions, race predictions, GPS track analysis, age grading, VO2max estimation, and training zones.

Topics

Resources

Stars

15 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages