Private
Public Access
1
0

calculates age group 2k

This commit is contained in:
Sander Roosendaal
2017-12-12 21:59:28 +01:00
parent 228ea8f980
commit 86a72545e0
5 changed files with 44 additions and 3 deletions

View File

@@ -1,5 +1,7 @@
from utils import lbstoN
import numpy as np
from models import C2WorldClassAgePerformance
import pandas as pd
rowingmetrics = (
('time',{
@@ -316,3 +318,22 @@ def calc_trimp(df,sex,hrmax,hrmin):
trimp = trimpdata.sum()
return trimp
def getagegroup2k(age,sex='male',weightcategory='hwt'):
df = pd.DataFrame(
list(
C2WorldClassAgePerformance.objects.filter(
sex=sex,
weightcategory=weightcategory
).values()
)
)
ages = df['agemin']
powers = df['power']
poly_coefficients = np.polyfit(ages,powers,6)
power = np.polyval(poly_coefficients,age)
return power