more autopep
This commit is contained in:
@@ -6,7 +6,6 @@ from scipy import optimize
|
||||
|
||||
from rowers.mytypes import otwtypes, otetypes, rowtypes
|
||||
|
||||
#p0 = [500,350,10,8000]
|
||||
p0 = [190, 200, 33, 16000]
|
||||
|
||||
# RPE to TSS
|
||||
@@ -73,10 +72,12 @@ def updatecp(delta, cpvalues, r, workouttype='water'): # pragma: no cover
|
||||
|
||||
def cpfit(powerdf, fraclimit=0.0001, nmax=1000):
|
||||
# Fit the data to thee parameter CP model
|
||||
def fitfunc(pars, x): return abs(
|
||||
pars[0])/(1+(x/abs(pars[2]))) + abs(pars[1])/(1+(x/abs(pars[3])))
|
||||
def fitfunc(pars, x):
|
||||
return abs(
|
||||
pars[0])/(1+(x/abs(pars[2]))) + abs(pars[1])/(1+(x/abs(pars[3])))
|
||||
|
||||
def errfunc(pars, x, y): return fitfunc(pars, x)-y
|
||||
def errfunc(pars, x, y):
|
||||
return fitfunc(pars, x)-y
|
||||
|
||||
p1 = p0
|
||||
|
||||
@@ -235,8 +236,6 @@ def getcp_new(dfgrouped, logarr): # pragma: no cover
|
||||
restime = np.array(restime)
|
||||
power = np.array(power)
|
||||
|
||||
#power[0] = power[1]
|
||||
|
||||
cpvalues = griddata(restime, power,
|
||||
logarr, method='linear', fill_value=0)
|
||||
|
||||
@@ -264,7 +263,6 @@ def getcp(dfgrouped, logarr):
|
||||
delta = []
|
||||
cpvalue = []
|
||||
avgpower = {}
|
||||
#avgpower[0] = 0
|
||||
|
||||
for id, group in dfgrouped:
|
||||
tt = group['time'].copy()
|
||||
@@ -273,7 +271,7 @@ def getcp(dfgrouped, logarr):
|
||||
# Remove data where PM is repeating final power value
|
||||
# of an interval during the rest
|
||||
rolling_std = ww.rolling(window=4).std()
|
||||
deltas = tt.diff()
|
||||
# deltas = tt.diff()
|
||||
|
||||
mask = rolling_std == 0
|
||||
ww.loc[mask] = 0
|
||||
@@ -281,7 +279,7 @@ def getcp(dfgrouped, logarr):
|
||||
mask = ww > 2000
|
||||
ww.loc[mask] = 0
|
||||
|
||||
tmax = tt.max()
|
||||
# tmax = tt.max()
|
||||
|
||||
try:
|
||||
avgpower[id] = int(ww.mean())
|
||||
@@ -389,13 +387,13 @@ def getfastest(df, thevalue, mode='distance'):
|
||||
dd = pd.Series(dd, dtype='float')
|
||||
|
||||
G = pd.concat([pd.Series([0]), dd])
|
||||
T = pd.concat([pd.Series([0]), dd])
|
||||
h = np.mgrid[0:len(tt)+1:1, 0:len(tt)+1:1]
|
||||
distances = pd.DataFrame(h[1]-h[0])
|
||||
# T = pd.concat([pd.Series([0]), dd])
|
||||
# h = np.mgrid[0:len(tt)+1:1, 0:len(tt)+1:1]
|
||||
# distances = pd.DataFrame(h[1]-h[0])
|
||||
ones = 1+np.zeros(len(G))
|
||||
Ghor = np.outer(ones, G)
|
||||
Thor = np.outer(ones, T)
|
||||
Tver = np.outer(T, ones)
|
||||
# Thor = np.outer(ones, T)
|
||||
# Tver = np.outer(T, ones)
|
||||
Gver = np.outer(G, ones)
|
||||
Gdif = Ghor-Gver
|
||||
Gdif = np.tril(Gdif.T).T
|
||||
@@ -428,8 +426,6 @@ def getfastest(df, thevalue, mode='distance'):
|
||||
# if restime[i]<thevalue*60*1000:
|
||||
# print(i,restime[i],distance[i],60*1000*thevalue)
|
||||
|
||||
d2 = 0
|
||||
|
||||
if mode == 'distance':
|
||||
duration = griddata(distance, restime, [
|
||||
thevalue], method='linear', rescale=True)
|
||||
|
||||
Reference in New Issue
Block a user