Private
Public Access
1
0

working, not tested asynchronous OTE ranking

This commit is contained in:
Sander Roosendaal
2017-10-26 16:39:02 +02:00
parent 704d7a9128
commit 0e185f9c2f
8 changed files with 104 additions and 36 deletions

View File

@@ -41,6 +41,7 @@ import pandas as pd
from pytz import timezone as tz,utc
from django.utils.timezone import get_current_timezone
from django.utils.timezone import activate
from django.utils import timezone
activate(settings.TIME_ZONE)
thetimezone = get_current_timezone()
@@ -1065,10 +1066,9 @@ def interactive_otwcpchart(powerdf,promember=0):
return [script,div,p1,ratio,message]
def interactive_cpchart(thedistances,thesecs,theavpower,
def interactive_cpchart(rower,thedistances,thesecs,theavpower,
theworkouts,promember=0):
message = 0
# plot tools
if (promember==1):
@@ -1086,7 +1086,7 @@ def interactive_cpchart(thedistances,thesecs,theavpower,
p = pd.Series(500./velo)
p2 = p.fillna(method='ffill').apply(lambda x: timedeltaconv(x))
source = ColumnDataSource(
data = dict(
dist = thedistances,
@@ -1108,6 +1108,7 @@ def interactive_cpchart(thedistances,thesecs,theavpower,
paulslope = 5.0/np.log10(2.0)
paulintercept = p[0]-paulslope*np.log10(thedistances[0])
fitx = pd.Series(np.arange(100)*2*max(np.log10(thedistances))/100.)
fitp = paulslope*fitx+paulintercept
@@ -1198,16 +1199,13 @@ def interactive_cpchart(thedistances,thesecs,theavpower,
plot.xaxis.axis_label = "Duration (seconds)"
plot.yaxis.axis_label = "Power (W)"
therows = []
for workout in theworkouts:
f1 = workout.csvfilename
rowdata = rdata(f1)
if rowdata != 0:
therows.append(rowdata)
cpdata = cumcpdata(therows)
cpdata = dataprep.fetchcperg(rower, theworkouts)
velo = cpdata['Distance']/cpdata['Delta']
if cpdata.empty:
return ['','',paulslope,paulintercept,p1,message]
velo = cpdata['distance']/cpdata['delta']
p = 500./velo
@@ -1215,12 +1213,12 @@ def interactive_cpchart(thedistances,thesecs,theavpower,
source2 = ColumnDataSource(
data = dict(
duration = cpdata['Delta'],
power = cpdata['CP'],
duration = cpdata['delta'],
power = cpdata['cp'],
tim = niceformat(
cpdata['Delta'].fillna(method='ffill').apply(lambda x: timedeltaconv(x))
cpdata['delta'].fillna(method='ffill').apply(lambda x: timedeltaconv(x))
),
dist = cpdata['Distance'],
dist = cpdata['distance'],
pace = nicepaceformat(p2),
)
)
@@ -1252,6 +1250,7 @@ def interactive_cpchart(thedistances,thesecs,theavpower,
script, div = components(plot)
return [script,div,paulslope,paulintercept,p1,message]
def interactive_windchart(id=0,promember=0):