Private
Public Access
1
0

TSS calculation now always includes rest strokes

This commit is contained in:
Sander Roosendaal
2018-02-13 08:18:17 +01:00
parent 3a30c7dafc
commit ae0e0650e8
3 changed files with 19 additions and 29 deletions

View File

@@ -7468,24 +7468,15 @@ def workout_stats_view(request,id=0,message="",successmessage=""):
otherstats = {}
# Normalized power & TSS
duration = datadf['time'].max()-datadf['time'].min()
duration /= 1.0e3
pwr4 = datadf['power']**(4.0)
normp = (pwr4.mean())**(0.25)
if not np.isnan(normp):
ftp = float(r.ftp)
if w.workouttype in ('water','coastal'):
ftp = ftp*(100.-r.otwslack)/100.
intensityfactor = normp/float(ftp)
tss = 100.*((duration*normp*intensityfactor)/(3600.*ftp))
tss,normp = dataprep.workout_rscore(w)
if not np.isnan(tss):
otherstats['tss'] = {
'verbose_name':'rScore',
'value':int(tss),
'unit':''
}
if not np.isnan(tss) and tss != 0:
otherstats['tss'] = {
'verbose_name':'rScore',
'value':int(tss),
'unit':''
}
if not np.isnan(normp):
otherstats['np'] = {
@@ -7521,14 +7512,13 @@ def workout_stats_view(request,id=0,message="",successmessage=""):
pass
# TRIMP
if datadf['hr'].mean() > 0 and r.sex != 'not specified':
trimp = metrics.calc_trimp(datadf,r.sex,r.max,r.rest)
trimp = int(trimp)
otherstats['trimp'] = {
'verbose_name': 'TRIMP',
'value': trimp,
'unit': ''
}
trimp = dataprep.workout_trimp(w)
otherstats['trimp'] = {
'verbose_name': 'TRIMP',
'value': trimp,
'unit': ''
}
return render(request,
'workoutstats.html',