updated OTW CP plot
This commit is contained in:
@@ -2903,9 +2903,9 @@ def otwrankings_view(request,theuser=0,
|
||||
else:
|
||||
maxt = 1000.
|
||||
|
||||
|
||||
|
||||
maxlog10 = np.log10(maxt)
|
||||
logarr = np.arange(500)*maxlog10/500.
|
||||
logarr = np.arange(100)*maxlog10/100.
|
||||
logarr = [int(10.**(la)) for la in logarr]
|
||||
logarr = pd.Series(logarr)
|
||||
logarr.drop_duplicates(keep='first',inplace=True)
|
||||
@@ -2920,8 +2920,9 @@ def otwrankings_view(request,theuser=0,
|
||||
|
||||
dfgrouped = df.groupby(['workoutid'])
|
||||
for id,group in dfgrouped:
|
||||
tt = group['time']
|
||||
ww = group['power']
|
||||
tt = group['time'].copy()
|
||||
ww = group['power'].copy()
|
||||
|
||||
try:
|
||||
avgpower[id] = int(ww.mean())
|
||||
except ValueError:
|
||||
@@ -2931,19 +2932,20 @@ def otwrankings_view(request,theuser=0,
|
||||
dt = []
|
||||
cpw = []
|
||||
for i in range(length-2):
|
||||
w_roll = ww.rolling(i+2,min_periods=2).mean()
|
||||
# now goes with # data points - should be fixed seconds
|
||||
indexmax = w_roll.idxmax(axis=1)
|
||||
try:
|
||||
t_0 = tt.ix[indexmax]
|
||||
t_1 = tt.ix[indexmax-i-2]
|
||||
deltat = 1.0e-3*(t_0-t_1)
|
||||
wmax = w_roll.ix[indexmax]
|
||||
if not np.isnan(deltat) and not np.isnan(wmax):
|
||||
dt.append(deltat)
|
||||
cpw.append(wmax)
|
||||
except KeyError:
|
||||
pass
|
||||
w_roll = ww.rolling(i+2).mean().dropna()
|
||||
if len(w_roll):
|
||||
# now goes with # data points - should be fixed seconds
|
||||
indexmax = w_roll.idxmax(axis=1)
|
||||
try:
|
||||
t_0 = tt.ix[indexmax]
|
||||
t_1 = tt.ix[indexmax-i-2]
|
||||
deltat = 1.0e-3*(t_0-t_1)
|
||||
wmax = w_roll.ix[indexmax]
|
||||
if not np.isnan(deltat) and not np.isnan(wmax):
|
||||
dt.append(deltat)
|
||||
cpw.append(wmax)
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
|
||||
dt = pd.Series(dt)
|
||||
|
||||
Reference in New Issue
Block a user