Private
Public Access
1
0

same basis of logarithmic delta axis

This commit is contained in:
Sander Roosendaal
2020-10-12 08:50:32 +02:00
parent a42c275a09
commit 60a68f5611
2 changed files with 21 additions and 16 deletions

View File

@@ -1034,10 +1034,10 @@ def fetchcp_new(rower,workouts):
except KeyError: except KeyError:
powermean = 0 powermean = 0
if powermean != 0: if powermean != 0:
thesecs = totaltime thesecs = totaltime
maxt = 1.05 * thesecs maxt = 1.05 * thesecs
if maxt > 0: if maxt > 0:
logarr = datautils.getlogarr(maxt) logarr = datautils.getlogarr(maxt)
dfgrouped = strokesdf.groupby(['workoutid']) dfgrouped = strokesdf.groupby(['workoutid'])
@@ -1052,6 +1052,8 @@ def fetchcp_new(rower,workouts):
data.append(df) data.append(df)
if len(data) == 0:
return pd.Series(),pd.Series(),0
if len(data)>1: if len(data)>1:
df = pd.concat(data,axis=0) df = pd.concat(data,axis=0)
@@ -1059,22 +1061,22 @@ def fetchcp_new(rower,workouts):
df = df.sort_values(['delta']).reset_index() df = df.sort_values(['delta']).reset_index()
dindex = df['id'].shift(1)-df['id'] #dindex = df['id'].shift(1)-df['id']
dpowerplus = df['cp'].shift(1)-df['cp'] #dpowerplus = df['cp'].shift(1)-df['cp']
dpowermin = df['cp'].shift(-1)-df['cp'] #dpowermin = df['cp'].shift(-1)-df['cp']
badrows = [] #badrows = []
badid = 0 #badid = 0
for index,row in df.iterrows(): #for index,row in df.iterrows():
if dindex[index] != 0 and dpowermin[index] > 0: # if dindex[index] != 0 and dpowermin[index] > 0:
badrows.append(index) # badrows.append(index)
badid = row['id'] # badid = row['id']
elif row['id'] == badid: # elif row['id'] == badid:
badrows.append(index) # badrows.append(index)
else: # else:
badid = 0 # badid = 0
df = df.drop(index = badrows) #df = df.drop(index = badrows)
return df['delta'],df['cp'],0 return df['delta'],df['cp'],0

View File

@@ -108,7 +108,10 @@ def cpfit(powerdf):
def getlogarr(maxt): def getlogarr(maxt):
maxlog10 = np.log10(maxt-5) maxlog10 = np.log10(maxt-5)
logarr = np.arange(50)*maxlog10/50. #print(maxlog10,round(maxlog10))
aantal = 10*round(maxlog10)
logarr = np.arange(aantal+1)/10.
res = [] res = []
for la in logarr: for la in logarr:
try: try: