otw-bests somehow working
This commit is contained in:
@@ -2938,15 +2938,14 @@ def otwrankings_view(request,theuser=0,
|
||||
|
||||
|
||||
# create interactive plot
|
||||
if len(thedistances) !=0 :
|
||||
res = interactive_cpchart(thedistances,thesecs,theavpower,
|
||||
theworkouts,promember=promember)
|
||||
if len(powerdf) !=0 :
|
||||
res = interactive_otwcpchart(powerdf)
|
||||
script = res[0]
|
||||
div = res[1]
|
||||
paulslope = res[2]
|
||||
paulintercept = res[3]
|
||||
p1 = res[4]
|
||||
message = res[5]
|
||||
p1 = res[2]
|
||||
paulslope = 1
|
||||
paulintercept = 1
|
||||
message = res[3]
|
||||
else:
|
||||
script = ''
|
||||
div = '<p>No ranking pieces found.</p>'
|
||||
@@ -2983,23 +2982,6 @@ def otwrankings_view(request,theuser=0,
|
||||
t += rankingduration.second
|
||||
t += rankingduration.microsecond/1.e6
|
||||
|
||||
# Paul's model
|
||||
ratio = paulintercept/paulslope
|
||||
|
||||
u = ((2**(2+ratio))*(5.**(3+ratio))*t*np.log(10))/paulslope
|
||||
|
||||
d = 500*t*np.log(10.)
|
||||
d = d/(paulslope*lambertw(u))
|
||||
d = d.real
|
||||
|
||||
velo = d/t
|
||||
p = 500./velo
|
||||
pwr = 2.8*(velo**3)
|
||||
a = {'distance':int(d),
|
||||
'duration':timedeltaconv(t),
|
||||
'pace':timedeltaconv(p),
|
||||
'power':int(pwr)}
|
||||
predictions.append(a)
|
||||
|
||||
# CP model
|
||||
pwr = p1[0]/(1+t/p1[2])
|
||||
@@ -3008,28 +2990,20 @@ def otwrankings_view(request,theuser=0,
|
||||
if pwr <= 0:
|
||||
pwr = 50.
|
||||
|
||||
velo = (pwr/2.8)**(1./3.)
|
||||
|
||||
if np.isnan(velo) or velo <=0:
|
||||
velo = 1.0
|
||||
|
||||
d = t*velo
|
||||
p = 500./velo
|
||||
a = {'distance':int(d),
|
||||
'duration':timedeltaconv(t),
|
||||
'pace':timedeltaconv(p),
|
||||
'power':int(pwr)}
|
||||
a = {
|
||||
'duration':timedeltaconv(t),
|
||||
'power':int(pwr)}
|
||||
cpredictions.append(a)
|
||||
|
||||
print cpredictions
|
||||
|
||||
messages.error(request,message)
|
||||
return render(request, 'rankings.html',
|
||||
return render(request, 'otwrankings.html',
|
||||
{'rankingworkouts':theworkouts,
|
||||
'interactiveplot':script,
|
||||
'the_div':div,
|
||||
'predictions':predictions,
|
||||
'cpredictions':cpredictions,
|
||||
'nrdata':len(thedistances),
|
||||
'form':form,
|
||||
'dateform':dateform,
|
||||
'deltaform':deltaform,
|
||||
|
||||
Reference in New Issue
Block a user