-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtreadmill_elevation_gain.py
39 lines (34 loc) · 1.24 KB
/
treadmill_elevation_gain.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#==========================================================================
# Program by Erik Johannes B. L. G. Husom on 2018-01-14 for Python 3.6.4
# Description: Calculating elevation gain on a treadmill
# USAGE:
#==========================================================================
# IMPORT STATEMENTS
import sys
import numpy as np
def elevationGain(incline, distance):
"""Calculates elevation gain on a treadmill"""
incline = incline/100
elevationGain = distance*np.cos(np.arctan(incline))*incline
return elevationGain*1000
def elevationGainRiseOverRun(incline, distance):
incline = incline/100
elevationGain = distance*incline
print(elevationGain*1000)
def elevationGainTime(incline, speed, time_in_min):
time_in_h = time_in_min / 60.0
distance = speed*time_in_h
incline = float(input("Incline (percentage)="))
distance = float(input("Distance (km)="))
#speed = float(input("Speed (km/h)="))
time = float(input("Time (min)="))
gain = elevationGain(incline, distance)
#time = distance/speed
time /= 60
speed = distance/time
print("Elevation gain: ", gain)
print("Speed: ", speed)
print("Vertical speed (m/min): ", gain/(time*60))
print("Vertical speed (m/hr): ", gain/time)