Private
Public Access
1
0

using upper limit for OTW breakthrough detection

This commit is contained in:
Sander Roosendaal
2017-06-27 04:10:53 +02:00
parent a8b8083b0f
commit 0f71ee9481
9 changed files with 25 additions and 13 deletions

View File

@@ -2955,14 +2955,16 @@ def otwrankings_view(request,theuser=0,
script = res[0]
div = res[1]
p1 = res[2]
ratio = res[3]
r.p0 = p1[0]
r.p1 = p1[1]
r.p2 = p1[2]
r.p3 = p1[3]
r.cpratio = ratio
r.save()
paulslope = 1
paulintercept = 1
message = res[3]
message = res[4]
else:
script = ''
div = '<p>No ranking pieces found.</p>'
@@ -2977,18 +2979,20 @@ def otwrankings_view(request,theuser=0,
clean = form.is_valid()
value = form.cleaned_data['value']
hourvalue,value = divmod(value,60)
hourvalue = int(hourvalue)
minutevalue = int(value)
value = int(60*(value-minutevalue))
if hourvalue >= 24:
hourvalue = 23
rankingdurations.append(datetime.time(minute=value,hour=hourvalue))
rankingdurations.append(datetime.time(minute=minutevalue,
hour=hourvalue,
second=value))
else:
form = PredictedPieceForm()
predictions = []
cpredictions = []
for rankingduration in rankingdurations:
t = 3600.*rankingduration.hour
t += 60.*rankingduration.minute
@@ -3000,13 +3004,17 @@ def otwrankings_view(request,theuser=0,
pwr = p1[0]/(1+t/p1[2])
pwr += p1[1]/(1+t/p1[3])
if pwr <= 0:
pwr = 50.
if not np.isnan(pwr):
pwr2 = pwr*ratio
a = {
'duration':timedeltaconv(t),
'power':int(pwr)}
'power':int(pwr),
'upper':int(pwr2)}
cpredictions.append(a)
@@ -3017,7 +3025,6 @@ def otwrankings_view(request,theuser=0,
{'rankingworkouts':theworkouts,
'interactiveplot':script,
'the_div':div,
'predictions':predictions,
'cpredictions':cpredictions,
'avgpower':avgpower,
'form':form,