fixed power time fitness chart
This commit is contained in:
@@ -201,8 +201,6 @@ def handle_strava_sync(stravatoken,workoutid,filename,name,activity_type,descrip
|
||||
failed = True
|
||||
except stravalib.exc.ObjectNotFound:
|
||||
failed = True
|
||||
except stravalib.exc.TimeoutExceeded:
|
||||
failed = True
|
||||
except ActivityUploadFailed:
|
||||
failed = True
|
||||
|
||||
@@ -2078,12 +2076,28 @@ def cp_from_workoutids(workoutids,debug=False):
|
||||
maxt = 1.05*df['time'].max()/1000.
|
||||
|
||||
logarr = datautils.getlogarr(maxt)
|
||||
data = []
|
||||
|
||||
delta,cpvalue,avgpower = datautils.getcp(dfgrouped,logarr)
|
||||
for id in workoutids:
|
||||
cpfile = 'media/cpdata_{id}.parquet.gz'.format(id=id)
|
||||
try:
|
||||
df = pd.read_parquet(cpfile)
|
||||
df['workout'] = str(id)
|
||||
data.append(df)
|
||||
except:
|
||||
pass # ignore for now
|
||||
|
||||
if len(data) == 0:
|
||||
return 0,0,0
|
||||
if len(data)>1:
|
||||
df = pd.concat(data,axis=0)
|
||||
|
||||
df = df[df['cp'] == df.groupby(['delta'])['cp'].transform('max')]
|
||||
df = df.sort_values(['delta']).reset_index()
|
||||
|
||||
powerdf = pd.DataFrame({
|
||||
'Delta':delta,
|
||||
'CP':cpvalue,
|
||||
'Delta':df['delta'],
|
||||
'CP':df['cp'],
|
||||
})
|
||||
|
||||
powerdf = powerdf[powerdf['CP']>0]
|
||||
|
||||
Reference in New Issue
Block a user