added HR drift, normalized power, training score
This commit is contained in:
@@ -74,6 +74,34 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="grid_8 omega">
|
||||
{% if otherstats %}
|
||||
<div class="grid_4 alpha">
|
||||
|
||||
</div>
|
||||
<div class="grid_4 omega">
|
||||
<h2>Other Stats</h2>
|
||||
<table width="100%" class="listtable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Metric</th>
|
||||
<th>Value</th>
|
||||
<th>Unit</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for key, value in otherstats.items %}
|
||||
<tr>
|
||||
<td>{{ value.verbose_name }}</td>
|
||||
<td>{{ value.value }}</td>
|
||||
<td>{{ value.unit }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="grid_8 alpha">
|
||||
{% if cordict %}
|
||||
<h2> Correlation matrix</h2>
|
||||
<p>This matrix indicates a positive (+) or negative (-) correlation between two parameters. The Spearman correlation coefficient has values between +1 and -1. Positive correlation between two metrics means that if one metric increases, the other value is also likely to increase. Negative is the opposite. The further from zero, the higher the likelyhood.
|
||||
@@ -112,6 +140,7 @@
|
||||
</table>
|
||||
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -4036,6 +4036,9 @@ def cumstats(request,theuser=0,
|
||||
# Stats page
|
||||
@login_required()
|
||||
def workout_stats_view(request,id=0,message="",successmessage=""):
|
||||
|
||||
r = Rower.objects.get(user=request.user)
|
||||
|
||||
workstrokesonly = True
|
||||
if request.method == 'POST' and 'workstrokesonly' in request.POST:
|
||||
workstrokesonly = request.POST['workstrokesonly']
|
||||
@@ -4093,6 +4096,56 @@ def workout_stats_view(request,id=0,message="",successmessage=""):
|
||||
|
||||
cordict[field1] = thedict
|
||||
|
||||
# additional non-automated stats
|
||||
otherstats = {}
|
||||
|
||||
# Normalized power & TSS
|
||||
duration = datadf['time'].max()-datadf['time'].min()
|
||||
duration /= 1.0e3
|
||||
pwr4 = datadf['power']**(4)
|
||||
normp = (pwr4.mean())**(0.25)
|
||||
if not np.isnan(normp):
|
||||
intensityfactor = datadf['power'].mean()/float(r.ftp)
|
||||
intensityfactor = normp/float(r.ftp)
|
||||
tss = 100.*((duration*normp*intensityfactor)/(3600.*r.ftp))
|
||||
|
||||
otherstats['np'] = {
|
||||
'verbose_name':'rPower',
|
||||
'value':int(10*normp)/10.,
|
||||
'unit':'Watt'
|
||||
}
|
||||
|
||||
otherstats['tss'] = {
|
||||
'verbose_name':'rScore',
|
||||
'value':int(tss),
|
||||
'unit':''
|
||||
}
|
||||
|
||||
# HR Drift
|
||||
tmax = datadf['time'].max()
|
||||
tmin = datadf['time'].min()
|
||||
thalf = tmin+0.5*(tmax-tmin)
|
||||
mask1 = datadf['time'] < thalf
|
||||
mask2 = datadf['time'] > thalf
|
||||
|
||||
hr1 = datadf.loc[mask1,'hr'].mean()
|
||||
hr2 = datadf.loc[mask2,'hr'].mean()
|
||||
|
||||
pwr1 = datadf.loc[mask1,'power'].mean()
|
||||
pwr2 = datadf.loc[mask2,'power'].mean()
|
||||
|
||||
try:
|
||||
hrdrift = ((pwr1/hr1)-(pwr2/hr2))/(pwr1/hr1)
|
||||
hrdrift *= 100.
|
||||
otherstats['hrdrift'] = {
|
||||
'verbose_name': 'Heart Rate Drift',
|
||||
'value': int(100*hrdrift)/100.,
|
||||
'unit': '%',
|
||||
}
|
||||
except ZeroDivisionError:
|
||||
pass
|
||||
|
||||
|
||||
return render(request,
|
||||
'workoutstats.html',
|
||||
{
|
||||
@@ -4101,6 +4154,7 @@ def workout_stats_view(request,id=0,message="",successmessage=""):
|
||||
'workout':row,
|
||||
'workstrokesonly':workstrokesonly,
|
||||
'cordict':cordict,
|
||||
'otherstats':otherstats,
|
||||
})
|
||||
|
||||
# The Advanced edit page
|
||||
|
||||
Reference in New Issue
Block a user