tested split and flexchart
This commit is contained in:
@@ -433,6 +433,7 @@ def save_workout_database(f2,r,dosmooth=True,workouttype='rower',
|
|||||||
summary='',
|
summary='',
|
||||||
makeprivate=False,
|
makeprivate=False,
|
||||||
oarlength=2.89,inboard=0.88,
|
oarlength=2.89,inboard=0.88,
|
||||||
|
forceunit='lbs',
|
||||||
consistencychecks=False):
|
consistencychecks=False):
|
||||||
message = None
|
message = None
|
||||||
powerperc = 100*np.array([r.pw_ut2,
|
powerperc = 100*np.array([r.pw_ut2,
|
||||||
@@ -447,7 +448,6 @@ def save_workout_database(f2,r,dosmooth=True,workouttype='rower',
|
|||||||
powerperc=powerperc,powerzones=r.powerzones)
|
powerperc=powerperc,powerzones=r.powerzones)
|
||||||
row = rdata(f2,rower=rr)
|
row = rdata(f2,rower=rr)
|
||||||
|
|
||||||
|
|
||||||
dtavg = row.df['TimeStamp (sec)'].diff().mean()
|
dtavg = row.df['TimeStamp (sec)'].diff().mean()
|
||||||
|
|
||||||
if dtavg < 1:
|
if dtavg < 1:
|
||||||
@@ -640,6 +640,7 @@ def save_workout_database(f2,r,dosmooth=True,workouttype='rower',
|
|||||||
weightcategory=r.weightcategory,
|
weightcategory=r.weightcategory,
|
||||||
starttime=workoutstarttime,
|
starttime=workoutstarttime,
|
||||||
workoutsource=workoutsource,
|
workoutsource=workoutsource,
|
||||||
|
forceunit=forceunit,
|
||||||
csvfilename=f2,notes=notes,summary=summary,
|
csvfilename=f2,notes=notes,summary=summary,
|
||||||
maxhr=maxhr,averagehr=averagehr,
|
maxhr=maxhr,averagehr=averagehr,
|
||||||
startdatetime=workoutstartdatetime,
|
startdatetime=workoutstartdatetime,
|
||||||
@@ -925,7 +926,8 @@ def split_workout(r,parent,splitsecond,splitmode):
|
|||||||
id,message = new_workout_from_df(r,data1,
|
id,message = new_workout_from_df(r,data1,
|
||||||
title=parent.name+' (1)',
|
title=parent.name+' (1)',
|
||||||
parent=parent,
|
parent=parent,
|
||||||
setprivate=setprivate)
|
setprivate=setprivate,
|
||||||
|
forceunit='N')
|
||||||
messages.append(message)
|
messages.append(message)
|
||||||
ids.append(id)
|
ids.append(id)
|
||||||
if 'keep second' in splitmode:
|
if 'keep second' in splitmode:
|
||||||
@@ -938,12 +940,12 @@ def split_workout(r,parent,splitsecond,splitmode):
|
|||||||
setprivate = False
|
setprivate = False
|
||||||
|
|
||||||
dt = datetime.timedelta(seconds=splitsecond)
|
dt = datetime.timedelta(seconds=splitsecond)
|
||||||
|
|
||||||
id,message = new_workout_from_df(r,data2,
|
id,message = new_workout_from_df(r,data2,
|
||||||
title=parent.name+' (2)',
|
title=parent.name+' (2)',
|
||||||
parent=parent,
|
parent=parent,
|
||||||
setprivate=setprivate,
|
setprivate=setprivate,
|
||||||
dt=dt)
|
dt=dt,forceunit='N')
|
||||||
messages.append(message)
|
messages.append(message)
|
||||||
ids.append(id)
|
ids.append(id)
|
||||||
|
|
||||||
@@ -968,6 +970,7 @@ def new_workout_from_df(r,df,
|
|||||||
title='New Workout',
|
title='New Workout',
|
||||||
parent=None,
|
parent=None,
|
||||||
setprivate=False,
|
setprivate=False,
|
||||||
|
forceunit='lbs',
|
||||||
dt=datetime.timedelta()):
|
dt=datetime.timedelta()):
|
||||||
|
|
||||||
message = None
|
message = None
|
||||||
@@ -1001,7 +1004,10 @@ def new_workout_from_df(r,df,
|
|||||||
timestr = strftime("%Y%m%d-%H%M%S")
|
timestr = strftime("%Y%m%d-%H%M%S")
|
||||||
|
|
||||||
csvfilename ='media/df_'+timestr+'.csv'
|
csvfilename ='media/df_'+timestr+'.csv'
|
||||||
|
if forceunit == 'N':
|
||||||
|
# change to lbs for now
|
||||||
|
df['peakforce'] /= lbstoN
|
||||||
|
df['averageforce'] /= lbstoN
|
||||||
|
|
||||||
df.rename(columns = columndict,inplace=True)
|
df.rename(columns = columndict,inplace=True)
|
||||||
|
|
||||||
@@ -1179,18 +1185,6 @@ def getsmallrowdata_db(columns,ids=[],doclean=True,workstrokesonly=True):
|
|||||||
|
|
||||||
# convert newtons
|
# convert newtons
|
||||||
|
|
||||||
if 'peakforce' in columns:
|
|
||||||
funits = ((w.id,w.forceunit) for w in Workout.objects.filter(id__in=ids))
|
|
||||||
for id,u in funits:
|
|
||||||
if u=='lbs':
|
|
||||||
mask = data['workoutid']==id
|
|
||||||
data.loc[mask,'peakforce'] = data.loc[mask,'peakforce']*lbstoN
|
|
||||||
if 'averageforce' in columns:
|
|
||||||
funits = ((w.id,w.forceunit) for w in Workout.objects.filter(id__in=ids))
|
|
||||||
for id,u in funits:
|
|
||||||
if u=='lbs':
|
|
||||||
mask = data['workoutid']==id
|
|
||||||
data.loc[mask,'averageforce'] = data.loc[mask,'averageforce']*lbstoN
|
|
||||||
|
|
||||||
|
|
||||||
if doclean:
|
if doclean:
|
||||||
@@ -1298,7 +1292,7 @@ def read_cols_df_sql(ids,columns,convertnewtons=True):
|
|||||||
for id,u in funits:
|
for id,u in funits:
|
||||||
if u=='lbs':
|
if u=='lbs':
|
||||||
mask = df['workoutid']==id
|
mask = df['workoutid']==id
|
||||||
df.loc[mask,'peakforce'] = data.loc[mask,'peakforce']*lbstoN
|
df.loc[mask,'peakforce'] = df.loc[mask,'peakforce']*lbstoN
|
||||||
if 'averageforce' in columns:
|
if 'averageforce' in columns:
|
||||||
funits = ((w.id,w.forceunit) for w in Workout.objects.filter(id__in=ids))
|
funits = ((w.id,w.forceunit) for w in Workout.objects.filter(id__in=ids))
|
||||||
for id,u in funits:
|
for id,u in funits:
|
||||||
|
|||||||
@@ -5881,9 +5881,9 @@ def workout_flexchart3_view(request,*args,**kwargs):
|
|||||||
# create interactive plot
|
# create interactive plot
|
||||||
try:
|
try:
|
||||||
script,div,js_resources,css_resources,workstrokesonly = interactive_flex_chart2(id,xparam=xparam,yparam1=yparam1,
|
script,div,js_resources,css_resources,workstrokesonly = interactive_flex_chart2(id,xparam=xparam,yparam1=yparam1,
|
||||||
yparam2=yparam2,
|
yparam2=yparam2,
|
||||||
promember=promember,plottype=plottype,
|
promember=promember,plottype=plottype,
|
||||||
workstrokesonly=workstrokesonly)
|
workstrokesonly=workstrokesonly)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
script,div = interactive_flex_chart2(id,xparam=xparam,yparam1=yparam1,
|
script,div = interactive_flex_chart2(id,xparam=xparam,yparam1=yparam1,
|
||||||
yparam2=yparam2,
|
yparam2=yparam2,
|
||||||
|
|||||||
Reference in New Issue
Block a user