This repository has been archived by the owner on May 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathone_rep_estimation.py
72 lines (57 loc) · 2.24 KB
/
one_rep_estimation.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# from database_methods import get_most_recent_bodyweight
# import database_methods
# class OneRepEstimation:
# # * https://en.wikipedia.org/wiki/One-repetition_maximum
# # * Brzycki Formula
# @staticmethod
# def estimate_one_rep_max(weight, reps):
# MAX_REP_LIMIT = 20
# if reps <= 0 or reps > MAX_REP_LIMIT:
# return 0
# return 36 * weight / (37 - reps)
# @staticmethod
# def estimate_weight(one_rep_max, reps):
# MAX_REP_LIMIT = 20
# if reps <= 0 or reps > MAX_REP_LIMIT:
# return 0
# return (37 - reps) * one_rep_max / 36
# @staticmethod
# def estimate_reps(one_rep_max, weight):
# MAX_REP_LIMIT = 20
# rep_estimation = 37 - 36 * weight / one_rep_max
# if rep_estimation <= 0 or rep_estimation > MAX_REP_LIMIT:
# return 0
# return rep_estimation
# # * For bodyweight workouts, use weight = bodyweight + weight added
# @staticmethod
# def bodyweight_estimate_one_rep_max(
# session, user_name, weight_added, reps
# ):
# MAX_REP_LIMIT = 20
# curr_bodyweight = get_most_recent_bodyweight(session, user_name)
# total_weight = weight_added + curr_bodyweight
# if reps <= 0 or reps > MAX_REP_LIMIT:
# return 0
# return 36 * total_weight / (37 - reps) - curr_bodyweight
# @staticmethod
# def bodyweight_estimate_weight(
# session, user_name, one_rep_max, reps
# ):
# MAX_REP_LIMIT = 20
# curr_bodyweight = get_most_recent_bodyweight(session, user_name)
# total_weight = one_rep_max + curr_bodyweight
# if reps <= 0 or reps > MAX_REP_LIMIT:
# return 0
# return (37 - reps) * total_weight / 36 - curr_bodyweight
# @staticmethod
# def bodyweight_estimate_reps(
# session, user_name, one_rep_max, weight_added
# ):
# MAX_REP_LIMIT = 20
# curr_bodyweight = get_most_recent_bodyweight(session, user_name)
# rep_estimation = 37 - 36 * (weight_added + curr_bodyweight) / (
# one_rep_max + curr_bodyweight
# )
# if rep_estimation <= 0 or rep_estimation > MAX_REP_LIMIT:
# return 0
# return rep_estimation