TSS calculation now always includes rest strokes
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user