Merge branch 'bugfix/stats' into develop
This commit is contained in:
@@ -1575,7 +1575,8 @@ def testdata(time, distance, pace, spm):
|
||||
# is not in DB, read from CSV file (and create DB entry)
|
||||
|
||||
|
||||
def getrowdata_db(id=0, doclean=False, convertnewtons=True):
|
||||
def getrowdata_db(id=0, doclean=False, convertnewtons=True,
|
||||
checkefficiency=True):
|
||||
data = read_df_sql(id)
|
||||
data['x_right'] = data['x_right'] / 1.0e6
|
||||
data['deltat'] = data['time'].diff()
|
||||
@@ -1591,7 +1592,7 @@ def getrowdata_db(id=0, doclean=False, convertnewtons=True):
|
||||
row = Workout.objects.get(id=id)
|
||||
|
||||
|
||||
if not data.empty and data['efficiency'].mean() == 0 and data['power'].mean() != 0:
|
||||
if not data.empty and data['efficiency'].mean() == 0 and data['power'].mean() != 0 and checkefficiency == True:
|
||||
data = add_efficiency(id=id)
|
||||
|
||||
if doclean:
|
||||
@@ -1946,7 +1947,10 @@ def fix_newtons(id=0, limit=3000):
|
||||
|
||||
|
||||
def add_efficiency(id=0):
|
||||
rowdata, row = getrowdata_db(id=id, doclean=False, convertnewtons=False)
|
||||
rowdata, row = getrowdata_db(id=id,
|
||||
doclean=False,
|
||||
convertnewtons=False,
|
||||
checkefficiency=False)
|
||||
power = rowdata['power']
|
||||
pace = rowdata['pace'] / 1.0e3
|
||||
velo = 500. / pace
|
||||
|
||||
@@ -631,11 +631,11 @@ def delete_strokedata(id,debug=False):
|
||||
conn.close()
|
||||
engine.dispose()
|
||||
|
||||
def update_strokedata(id,df,debug=False,bands=True,barchart=True,otwpower=True):
|
||||
def update_strokedata(id,df,debug=False):
|
||||
delete_strokedata(id,debug=debug)
|
||||
if debug:
|
||||
print "updating ",id
|
||||
rowdata = dataprep(df,id=id,bands=False,barchart=True,otwpower=True,
|
||||
rowdata = dataprep(df,id=id,bands=True,barchart=True,otwpower=True,
|
||||
debug=debug)
|
||||
|
||||
return rowdata
|
||||
@@ -1031,8 +1031,6 @@ def dataprep(rowdatadf,id=0,bands=True,barchart=True,otwpower=True,
|
||||
velo = 500./p
|
||||
|
||||
distanceperstroke = 60.*velo/spm
|
||||
if debug:
|
||||
print distanceperstroke.mean()
|
||||
|
||||
|
||||
|
||||
@@ -1212,8 +1210,6 @@ def dataprep(rowdatadf,id=0,bands=True,barchart=True,otwpower=True,
|
||||
ergpace[ergpace == np.inf] = 240.
|
||||
ergpace2 = ergpace.apply(lambda x: timedeltaconv(x))
|
||||
|
||||
efficiency = efficiency.replace([-np.inf,np.inf],np.nan)
|
||||
efficiency.fillna(method='ffill')
|
||||
|
||||
|
||||
data['ergpace'] = ergpace*1e3
|
||||
|
||||
Reference in New Issue
Block a user