Created
January 17, 2020 02:00
-
-
Save emdash/256e6f5dd2fd9e6a3e0fd5d04cc8cbcc to your computer and use it in GitHub Desktop.
BMR Calculator for various scenarios
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# source: | |
# https://www.bodybuilding.com/content/nutrient-ratios-and-aloric-needs.html | |
def body_fat_coef(body_fat_percentage): | |
if 10 <= body_fat_percentage <= 14: | |
return 1.0 | |
elif 14 <= body_fat_percentage <= 20: | |
return 0.95 | |
elif 20 <= body_fat_percentage <= 28: | |
return 0.90 | |
elif body_fat_percentage >= 28: | |
return 0.85 | |
def bmr_per_hr(weight_lbs, body_fat_percentage): | |
weight_kg = weight_lbs / 2.2 | |
return weight_kg * body_fat_coef(body_fat_percentage) | |
# source: https://www.youtube.com/watch?v=dfxH1a2ZxGE&t=315s | |
sedentary = bmr_per_hr(163, 30) | |
sitting = 80.4 | |
sitting_and_fidgeting = 117.6 | |
standing = 87 | |
standing_motionless = 87.6 | |
standing_and_fidgeting = 147.6 | |
walking_1mph = 196.2 | |
walking_2mph = 235.0 | |
walking_3mph = 305.0 | |
walking_time = 32 / 60 | |
stand_time = 24 - 8 | |
def scenario( | |
sit = 0, | |
sit_fidget = 0, | |
stand = 0, | |
stand_fidget = 0, | |
walk = 0, | |
workout = 0 | |
): | |
sedentary_time = 24 - sum([ | |
sit, | |
sit_fidget, | |
stand, | |
stand_fidget, | |
walk, | |
workout | |
]) | |
return sum([ | |
sedentary_time * sedentary, | |
sit * sitting, | |
sit_fidget * sitting_and_fidgeting, | |
stand * standing, | |
stand_fidget * standing_and_fidgeting, | |
walk * walking_2mph, | |
1.80 * sedentary * workout | |
]) | |
# comatose | |
print("Comatose", scenario()) | |
# A typical workday: | |
print("Typical Workday", scenario(walk = 32/60)) | |
# A fidgety workday: | |
print("Standing Workday", scenario(walk = 32/60, sit_fidget = 8)) | |
# A standing workday: | |
print("Standing Workday", scenario(walk = 32/60, stand = 8)) | |
# A workout + work day | |
print("Workout + Workday", scenario(walk = 32/60, workout = 1)) | |
# A workout + standing work day | |
print( | |
"Workout + Standing Workday", | |
scenario(walk = 32/60, workout = 1, stand = 8) | |
) | |
# A workout + fidgety standing work day | |
print( | |
"Workout + fidgety Standing Workday", | |
scenario(walk = 32/60, workout = 1, stand_fidget = 8) | |
) | |
# A day spent frantically running errands | |
print( | |
"Errand Day", | |
scenario(walk = 2, stand_fidget = 6) | |
) | |
# A day spent frantically running errands after a workout | |
print( | |
"Workout + Errand Day", | |
scenario(walk = 2, stand_fidget = 6, workout = 1) | |
) | |
# A day spent working in the shop | |
print( | |
"Shop Day", | |
scenario(stand_fidget = 8) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment