commenting out link to perf manager
This commit is contained in:
@@ -1638,22 +1638,33 @@ def getfatigues(
|
|||||||
fatigue = 0
|
fatigue = 0
|
||||||
fitness = 0
|
fitness = 0
|
||||||
|
|
||||||
|
impulses = []
|
||||||
|
for f in fatigues:
|
||||||
|
impulses.append(0)
|
||||||
|
|
||||||
lambda_a = 2/(kfatigue+1)
|
lambda_a = 2/(kfatigue+1)
|
||||||
lambda_c = 2/(kfitness+1)
|
lambda_c = 2/(kfitness+1)
|
||||||
nrdays = (enddate-startdate).days
|
nrdays = (enddate-startdate).days
|
||||||
|
|
||||||
|
factor = 1.0
|
||||||
|
if metricchoice == 'rscore':
|
||||||
|
factor = 2.0
|
||||||
|
|
||||||
for i in range(nrdays):
|
for i in range(nrdays):
|
||||||
date = startdate+datetime.timedelta(days=i)
|
date = startdate+datetime.timedelta(days=i)
|
||||||
ws = Workout.objects.filter(user=user.rower,date=date,duplicate=False)
|
ws = Workout.objects.filter(user=user.rower,date=date,duplicate=False)
|
||||||
weight = 0
|
weight = 0
|
||||||
for w in ws:
|
for w in ws:
|
||||||
weight += getattr(w,metricchoice)
|
weight += factor*getattr(w,metricchoice)
|
||||||
if getattr(w,metricchoice) == 0:
|
if getattr(w,metricchoice) == 0:
|
||||||
if metricchoice == 'rscore' and w.hrtss != 0:
|
if metricchoice == 'rscore' and w.hrtss != 0:
|
||||||
weight+= w.hrtss
|
weight+= factor*w.hrtss
|
||||||
else:
|
else:
|
||||||
trimp,hrtss = dataprep.workout_trimp(w)
|
trimp,hrtss = dataprep.workout_trimp(w)
|
||||||
rscore,normp = dataprep.workout_rscore(w)
|
rscore,normp = dataprep.workout_rscore(w)
|
||||||
|
|
||||||
|
impulses.append(weight)
|
||||||
|
|
||||||
|
|
||||||
fatigue = (1-lambda_a)*fatigue+weight*lambda_a
|
fatigue = (1-lambda_a)*fatigue+weight*lambda_a
|
||||||
fitness = (1-lambda_c)*fitness+weight*lambda_c
|
fitness = (1-lambda_c)*fitness+weight*lambda_c
|
||||||
@@ -1663,7 +1674,7 @@ def getfatigues(
|
|||||||
dates.append(datetime.datetime.combine(date,datetime.datetime.min.time()))
|
dates.append(datetime.datetime.combine(date,datetime.datetime.min.time()))
|
||||||
testpower.append(np.nan)
|
testpower.append(np.nan)
|
||||||
|
|
||||||
return fatigues,fitnesses,dates,testpower
|
return fatigues,fitnesses,dates,testpower,impulses
|
||||||
|
|
||||||
def performance_chart(user,startdate=None,enddate=None,kfitness=42,kfatigue=7,
|
def performance_chart(user,startdate=None,enddate=None,kfitness=42,kfatigue=7,
|
||||||
metricchoice='trimp',doform=False,dofatigue=False):
|
metricchoice='trimp',doform=False,dofatigue=False):
|
||||||
@@ -1684,7 +1695,7 @@ def performance_chart(user,startdate=None,enddate=None,kfitness=42,kfatigue=7,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
fatigues,fitnesses,dates,testpower = getfatigues(fatigues,
|
fatigues,fitnesses,dates,testpower,impulses = getfatigues(fatigues,
|
||||||
fitnesses,
|
fitnesses,
|
||||||
dates,
|
dates,
|
||||||
testpower,
|
testpower,
|
||||||
@@ -1699,6 +1710,7 @@ def performance_chart(user,startdate=None,enddate=None,kfitness=42,kfatigue=7,
|
|||||||
'testpower':testpower,
|
'testpower':testpower,
|
||||||
'fatigue':fatigues,
|
'fatigue':fatigues,
|
||||||
'fitness':fitnesses,
|
'fitness':fitnesses,
|
||||||
|
'impulse':impulses,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@@ -1724,12 +1736,13 @@ def performance_chart(user,startdate=None,enddate=None,kfitness=42,kfatigue=7,
|
|||||||
fitness = df['fitness'],
|
fitness = df['fitness'],
|
||||||
fatigue = df['fatigue'],
|
fatigue = df['fatigue'],
|
||||||
form = df['form'],
|
form = df['form'],
|
||||||
|
impulse = df['impulse']
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
plot = Figure(tools=TOOLS,x_axis_type='datetime',
|
plot = Figure(tools=TOOLS,x_axis_type='datetime',
|
||||||
plot_width=900,
|
plot_width=900,plot_height=300,
|
||||||
toolbar_location="above",
|
toolbar_location="above",
|
||||||
toolbar_sticky=False)
|
toolbar_sticky=False)
|
||||||
|
|
||||||
@@ -1783,7 +1796,7 @@ def performance_chart(user,startdate=None,enddate=None,kfitness=42,kfatigue=7,
|
|||||||
#plot.circle('date','testpower',source=source,fill_color='green',size=10,
|
#plot.circle('date','testpower',source=source,fill_color='green',size=10,
|
||||||
# legend_label=legend_label.format(fitnesstest=fitnesstest))
|
# legend_label=legend_label.format(fitnesstest=fitnesstest))
|
||||||
|
|
||||||
plot.xaxis.axis_label = 'Date'
|
plot.xaxis.axis_label = None
|
||||||
plot.yaxis.axis_label = yaxlabel
|
plot.yaxis.axis_label = yaxlabel
|
||||||
|
|
||||||
|
|
||||||
@@ -1816,27 +1829,29 @@ def performance_chart(user,startdate=None,enddate=None,kfitness=42,kfatigue=7,
|
|||||||
|
|
||||||
plot.legend.location = "top_left"
|
plot.legend.location = "top_left"
|
||||||
|
|
||||||
plot.xaxis.formatter = DatetimeTickFormatter(
|
#plot.xaxis.formatter = DatetimeTickFormatter(
|
||||||
days=["%d %B %Y"],
|
# days=["%d %B %Y"],
|
||||||
months=["%d %B %Y"],
|
# months=["%d %B %Y"],
|
||||||
years=["%d %B %Y"],
|
# years=["%d %B %Y"],
|
||||||
)
|
# )
|
||||||
|
|
||||||
plot.xaxis.major_label_orientation = pi/4
|
#plot.xaxis.major_label_orientation = pi/4
|
||||||
plot.sizing_mode = 'stretch_both'
|
plot.sizing_mode = 'scale_both'
|
||||||
|
|
||||||
#plot.y_range = Range1d(0,1.5*max(df['testpower']))
|
#plot.y_range = Range1d(0,1.5*max(df['testpower']))
|
||||||
startdate = datetime.datetime.combine(startdate,datetime.datetime.min.time())
|
startdate = datetime.datetime.combine(startdate,datetime.datetime.min.time())
|
||||||
enddate = datetime.datetime.combine(enddate,datetime.datetime.min.time())
|
enddate = datetime.datetime.combine(enddate,datetime.datetime.min.time())
|
||||||
|
|
||||||
plot.x_range = Range1d(
|
xrange = Range1d(
|
||||||
startdate,enddate+datetime.timedelta(days=5),
|
startdate,enddate,
|
||||||
)
|
)
|
||||||
|
plot.x_range = xrange
|
||||||
plot.y_range = Range1d(
|
plot.y_range = Range1d(
|
||||||
start=0,end=y1rangemax,
|
start=0,end=y1rangemax,
|
||||||
)
|
)
|
||||||
plot.title.text = 'Performance Manager '+user.first_name
|
plot.title.text = 'Performance Manager '+user.first_name
|
||||||
|
|
||||||
|
|
||||||
hover = plot.select(dict(type=HoverTool))
|
hover = plot.select(dict(type=HoverTool))
|
||||||
|
|
||||||
hover.tooltips = OrderedDict([
|
hover.tooltips = OrderedDict([
|
||||||
@@ -1847,8 +1862,25 @@ def performance_chart(user,startdate=None,enddate=None,kfitness=42,kfatigue=7,
|
|||||||
(formlabel,'@form')
|
(formlabel,'@form')
|
||||||
])
|
])
|
||||||
|
|
||||||
|
plot2 = Figure(tools=TOOLS,x_axis_type='datetime',
|
||||||
|
plot_width=900,plot_height=150,
|
||||||
|
toolbar_location=None,
|
||||||
|
toolbar_sticky=False)
|
||||||
|
|
||||||
|
plot2.x_range = xrange
|
||||||
|
plot2.y_range = Range1d(0,df['impulse'].max())
|
||||||
|
|
||||||
|
plot2.vbar(x = df['date'], top = df['impulse'],color='gray')
|
||||||
|
|
||||||
|
plot2.sizing_mode = 'scale_both'
|
||||||
|
plot2.yaxis.axis_label = 'Impulse'
|
||||||
|
plot2.xaxis.axis_label = 'Date'
|
||||||
|
|
||||||
|
layout = layoutcolumn([plot,plot2])
|
||||||
|
layout.sizing_mode = 'stretch_both'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
script,div = components(plot)
|
script,div = components(layout)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
df.dropna(inplace=True,axis=0,how='any')
|
df.dropna(inplace=True,axis=0,how='any')
|
||||||
return (
|
return (
|
||||||
@@ -1913,7 +1945,7 @@ def fitnessfit_chart(workouts,user,workoutmode='water',startdate=None,
|
|||||||
fatigues = df['fatigue'].values.tolist()
|
fatigues = df['fatigue'].values.tolist()
|
||||||
fitnesses = df['fitness'].values.tolist()
|
fitnesses = df['fitness'].values.tolist()
|
||||||
|
|
||||||
fatigues,fitnesses,dates,testpower = getfatigues(
|
fatigues,fitnesses,dates,testpower,impulses = getfatigues(
|
||||||
fatigues,fitnesses,dates,testpower,
|
fatigues,fitnesses,dates,testpower,
|
||||||
startdate,enddate,user,metricchoice,kfatigue,kfitness
|
startdate,enddate,user,metricchoice,kfatigue,kfitness
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<ul class="main-content">
|
<ul class="main-content">
|
||||||
|
<!--
|
||||||
<li class="rounder">
|
<li class="rounder">
|
||||||
<h2>Performance Manager</h2>
|
<h2>Performance Manager</h2>
|
||||||
<a href="/rowers/performancemanager/">
|
<a href="/rowers/performancemanager/">
|
||||||
@@ -23,6 +24,7 @@
|
|||||||
Manager Fitness, Fatigue and Freshness
|
Manager Fitness, Fatigue and Freshness
|
||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
|
-->
|
||||||
<li class="rounder">
|
<li class="rounder">
|
||||||
<h2>Compare Workouts</h2>
|
<h2>Compare Workouts</h2>
|
||||||
{% if team %}
|
{% if team %}
|
||||||
|
|||||||
Reference in New Issue
Block a user