added add_effiency and eff calc added to otw_physics
This commit is contained in:
@@ -460,7 +460,8 @@ def save_workout_database(f2,r,dosmooth=True,workouttype='rower',
|
||||
if consistencychecks:
|
||||
a_messages.error(r.user,'Failed consistency check: '+key+', autocorrected')
|
||||
else:
|
||||
a_messages.error(r.user,'Failed consistency check: '+key+', not corrected')
|
||||
pass
|
||||
# a_messages.error(r.user,'Failed consistency check: '+key+', not corrected')
|
||||
except ZeroDivisionError:
|
||||
pass
|
||||
|
||||
@@ -1259,6 +1260,27 @@ def datafusion(id1,id2,columns,offset):
|
||||
|
||||
return df
|
||||
|
||||
def add_efficiency(id=0):
|
||||
rowdata,row = getrowdata_db(id=id,doclean=False)
|
||||
power = rowdata['power']
|
||||
pace = rowdata['pace']/1.0e3
|
||||
velo = 500./pace
|
||||
ergpw = 2.8*velo**3
|
||||
efficiency = 100.*ergpw/power
|
||||
|
||||
efficiency = efficiency.replace([-np.inf,np.inf],np.nan)
|
||||
efficiency.fillna(method='ffill')
|
||||
rowdata['efficiency'] = efficiency
|
||||
delete_strokedata(id)
|
||||
if id != 0:
|
||||
rowdata['workoutid'] = id
|
||||
engine = create_engine(database_url, echo=False)
|
||||
with engine.connect() as conn, conn.begin():
|
||||
rowdata.to_sql('strokedata',engine,if_exists='append',index=False)
|
||||
conn.close()
|
||||
engine.dispose()
|
||||
return rowdata
|
||||
|
||||
# This is the main routine.
|
||||
# it reindexes, sorts, filters, and smooths the data, then
|
||||
# saves it to the stroke_data table in the database
|
||||
|
||||
Reference in New Issue
Block a user