Private
Public Access
1
0

adding rscoreapprox

This commit is contained in:
2023-08-22 15:57:21 +02:00
parent 7f430723a9
commit 107983ab34
2 changed files with 22 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ from scipy.interpolate import griddata
from scipy import optimize
from rowers.mytypes import otwtypes, otetypes, rowtypes
from rowers.models import Workout
p0 = [190, 200, 33, 16000]
@@ -22,6 +23,26 @@ rpetotss = {
10: 140,
}
def rscore_approx(row):
if row['rscore'] > 0:
return row['rscore']
if row['rscore'] == 0:
if row['hrtss'] > 0:
return row['hrtss']
else:
dd = 3600*row['duration'].hour+60*row['duration'].minute+row['duration'].second
dd = dd/3600
return rpetotss[row['rpe']]*dd
if row['rscore'] < 0:
w = Workout.objects.get(id=row['id'])
trimp, hrtss = dataprep.workout_trimp(w)
rscore, normp = dataprep.workout_rscore(w)
if row['rpe'] and row['rpe'] > 0:
dd = 3600*row['duration'].hour+60*row['duration'].minute+row['duration'].second
dd = dd/3600
return rpetotss[row['rpe']]*dd
return 0
def updatecp(delta, cpvalues, r, workouttype='water'): # pragma: no cover
if workouttype in otwtypes: