calculates age group 2k
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user