Private
Public Access
1
0

fix obscure bug

This commit is contained in:
Sander Roosendaal
2020-10-26 20:53:52 +01:00
parent bbd41408da
commit b8cd01c1af
4 changed files with 1472 additions and 16 deletions

1452
powers.csv Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1052,7 +1052,7 @@ def setcp(workout,background=False):
job = myqueue(queuelow,handle_setcp,strokesdf,filename,workout.id) job = myqueue(queuelow,handle_setcp,strokesdf,filename,workout.id)
return job.id return job.id
if not strokesdf.empty: if not strokesdf.empty:
totaltime = strokesdf['time'].max() totaltime = strokesdf['time'].max()

View File

@@ -269,22 +269,24 @@ def getcp(dfgrouped,logarr):
mask = ww > 2000 mask = ww > 2000
ww.loc[mask] = 0 ww.loc[mask] = 0
tmax = tt.max() tmax = tt.max()
if tmax > 500000: # if tmax > 3600000:
newlen = int(tmax/2000.) # newlen = int(tmax/10000.)
else: # else:
newlen = len(tt) # newlen = len(tt)
if newlen < len(tt): # if newlen < len(tt):
newt = np.arange(newlen)*tmax/float(newlen) # newt = np.arange(newlen)*tmax/float(newlen)
ww = griddata(tt.values, # ww = griddata(tt.values,
ww.values, # ww.values,
newt,method='linear', # newt,method='nearest',
rescale=True) # rescale=True)
#
tt = pd.Series(newt) # tt = pd.Series(newt)
ww = pd.Series(ww) # ww = pd.Series(ww)
try: try:
@@ -303,7 +305,6 @@ def getcp(dfgrouped,logarr):
cpw.append(wmax) cpw.append(wmax)
dt = pd.Series(dt) dt = pd.Series(dt)
cpw = pd.Series(cpw) cpw = pd.Series(cpw)
if len(dt)>2: if len(dt)>2:
@@ -346,7 +347,7 @@ def getmaxwattinterval(tt,ww,i):
t_0 = tt.loc[indexmaxpos] t_0 = tt.loc[indexmaxpos]
t_1 = tt.loc[indexmaxpos-i] t_1 = tt.loc[indexmaxpos-i]
deltas = tt.loc[indexmaxpos-i:indexmaxpos].diff().dropna() deltas = tt.loc[indexmaxpos-i:indexmaxpos].diff().dropna()
testres = 1.0e-3*deltas.max() < 30. testres = 1.0e-3*deltas.max() < 30. and not deltas.isnull().values.any()
if testres: if testres:
deltat = 1.0e-3*(t_0-t_1) deltat = 1.0e-3*(t_0-t_1)
wmax = w_roll.loc[indexmaxpos] wmax = w_roll.loc[indexmaxpos]

View File

@@ -40,6 +40,7 @@ import pandas as pd
from dateutil import parser from dateutil import parser
import datetime import datetime
#from rules.contrib.models import RulesModel #from rules.contrib.models import RulesModel
from rowers.rower_rules import * from rowers.rower_rules import *
@@ -3000,6 +3001,8 @@ def auto_delete_file_on_delete(sender, instance, **kwargs):
except FileNotFoundError: except FileNotFoundError:
pass pass
@receiver(models.signals.post_delete,sender=Workout) @receiver(models.signals.post_delete,sender=Workout)
def update_duplicates_on_delete(sender, instance, **kwargs): def update_duplicates_on_delete(sender, instance, **kwargs):
if instance.id: if instance.id: