flex chart work per stroke slider
This commit is contained in:
@@ -102,6 +102,11 @@ def clean_df_stats(datadf,workstrokesonly=True,ignorehr=True,
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
|
datadf['hr'] = datadf['hr']+10
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
datadf=datadf.clip(lower=0)
|
datadf=datadf.clip(lower=0)
|
||||||
datadf.replace(to_replace=0,value=np.nan,inplace=True)
|
datadf.replace(to_replace=0,value=np.nan,inplace=True)
|
||||||
|
|
||||||
@@ -116,6 +121,11 @@ def clean_df_stats(datadf,workstrokesonly=True,ignorehr=True,
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
|
datadf['hr'] = datadf['hr']-10
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
# clean data for useful ranges per column
|
# clean data for useful ranges per column
|
||||||
if not ignorehr:
|
if not ignorehr:
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -139,9 +139,10 @@ def interactive_forcecurve(theworkouts,workstrokesonly=False):
|
|||||||
|
|
||||||
columns = ['catch','slip','wash','finish','averageforce',
|
columns = ['catch','slip','wash','finish','averageforce',
|
||||||
'peakforceangle','peakforce','spm','distance',
|
'peakforceangle','peakforce','spm','distance',
|
||||||
'workoutstate']
|
'workoutstate','driveenergy']
|
||||||
|
|
||||||
rowdata = dataprep.getsmallrowdata_db(columns,ids=ids)
|
rowdata = dataprep.getsmallrowdata_db(columns,ids=ids)
|
||||||
|
rowdata.dropna(axis=1,how='all',inplace=True)
|
||||||
rowdata.dropna(axis=0,how='any',inplace=True)
|
rowdata.dropna(axis=0,how='any',inplace=True)
|
||||||
|
|
||||||
workoutstateswork = [1,4,5,8,9,6,7]
|
workoutstateswork = [1,4,5,8,9,6,7]
|
||||||
@@ -278,6 +279,7 @@ def interactive_forcecurve(theworkouts,workstrokesonly=False):
|
|||||||
var y = data['y']
|
var y = data['y']
|
||||||
var spm1 = data2['spm']
|
var spm1 = data2['spm']
|
||||||
var distance1 = data2['distance']
|
var distance1 = data2['distance']
|
||||||
|
var driveenergy1 = data2['driveenergy']
|
||||||
|
|
||||||
var thresholdforce = y[1]
|
var thresholdforce = y[1]
|
||||||
|
|
||||||
@@ -293,6 +295,8 @@ def interactive_forcecurve(theworkouts,workstrokesonly=False):
|
|||||||
var maxspm = maxspm.value
|
var maxspm = maxspm.value
|
||||||
var mindist = mindist.value
|
var mindist = mindist.value
|
||||||
var maxdist = maxdist.value
|
var maxdist = maxdist.value
|
||||||
|
var minwork = minwork.value
|
||||||
|
var maxwork = maxwork.value
|
||||||
|
|
||||||
var catchav = 0
|
var catchav = 0
|
||||||
var finishav = 0
|
var finishav = 0
|
||||||
@@ -307,6 +311,7 @@ def interactive_forcecurve(theworkouts,workstrokesonly=False):
|
|||||||
for (i=0; i<c.length; i++) {
|
for (i=0; i<c.length; i++) {
|
||||||
if (spm1[i]>=minspm && spm1[i]<=maxspm) {
|
if (spm1[i]>=minspm && spm1[i]<=maxspm) {
|
||||||
if (distance1[i]>=mindist && distance1[i]<=maxdist) {
|
if (distance1[i]>=mindist && distance1[i]<=maxdist) {
|
||||||
|
if (driveenergy1[i]>=minwork && driveenergy1[i]<=maxwork) {
|
||||||
catchav += c[i]
|
catchav += c[i]
|
||||||
finishav += finish[i]
|
finishav += finish[i]
|
||||||
slipav += slip[i]
|
slipav += slip[i]
|
||||||
@@ -318,6 +323,7 @@ def interactive_forcecurve(theworkouts,workstrokesonly=False):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
catchav /= count
|
catchav /= count
|
||||||
finishav /= count
|
finishav /= count
|
||||||
@@ -351,6 +357,15 @@ def interactive_forcecurve(theworkouts,workstrokesonly=False):
|
|||||||
title="Max SPM",callback=callback)
|
title="Max SPM",callback=callback)
|
||||||
callback.args["maxspm"] = slider_spm_max
|
callback.args["maxspm"] = slider_spm_max
|
||||||
|
|
||||||
|
slider_work_min = Slider(start=0, end=1500,value=0, step=10,
|
||||||
|
title="Min Work per Stroke",callback=callback)
|
||||||
|
callback.args["minwork"] = slider_work_min
|
||||||
|
|
||||||
|
|
||||||
|
slider_work_max = Slider(start=0, end=1500,value=1500, step=10,
|
||||||
|
title="Max Work per Stroke",callback=callback)
|
||||||
|
callback.args["maxwork"] = slider_work_max
|
||||||
|
|
||||||
distmax = 100+100*int(rowdata['distance'].max()/100.)
|
distmax = 100+100*int(rowdata['distance'].max()/100.)
|
||||||
|
|
||||||
slider_dist_min = Slider(start=0,end=distmax,value=0,step=1,
|
slider_dist_min = Slider(start=0,end=distmax,value=0,step=1,
|
||||||
@@ -366,6 +381,8 @@ def interactive_forcecurve(theworkouts,workstrokesonly=False):
|
|||||||
slider_spm_max,
|
slider_spm_max,
|
||||||
slider_dist_min,
|
slider_dist_min,
|
||||||
slider_dist_max,
|
slider_dist_max,
|
||||||
|
slider_work_min,
|
||||||
|
slider_work_max,
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
plot])
|
plot])
|
||||||
@@ -897,7 +914,8 @@ def interactive_cum_flex_chart2(theworkouts,promember=0,
|
|||||||
|
|
||||||
# datadf = dataprep.smalldataprep(theworkouts,xparam,yparam1,yparam2)
|
# datadf = dataprep.smalldataprep(theworkouts,xparam,yparam1,yparam2)
|
||||||
ids = [int(w.id) for w in theworkouts]
|
ids = [int(w.id) for w in theworkouts]
|
||||||
datadf = dataprep.getsmallrowdata_db([xparam,yparam1,yparam2],ids=ids,doclean=False)
|
columns = [xparam,yparam1,yparam2,'spm','driveenergy','distance']
|
||||||
|
datadf = dataprep.getsmallrowdata_db(columns,ids=ids,doclean=False)
|
||||||
|
|
||||||
yparamname1 = axlabels[yparam1]
|
yparamname1 = axlabels[yparam1]
|
||||||
if yparam2 != 'None':
|
if yparam2 != 'None':
|
||||||
@@ -1053,6 +1071,7 @@ def interactive_cum_flex_chart2(theworkouts,promember=0,
|
|||||||
var y2 = data['y2']
|
var y2 = data['y2']
|
||||||
var spm1 = data['spm']
|
var spm1 = data['spm']
|
||||||
var distance1 = data['distance']
|
var distance1 = data['distance']
|
||||||
|
var driveenergy1 = data['driveenergy']
|
||||||
var xname = data['xname'][0]
|
var xname = data['xname'][0]
|
||||||
var yname1 = data['yname1'][0]
|
var yname1 = data['yname1'][0]
|
||||||
var yname2 = data['yname2'][0]
|
var yname2 = data['yname2'][0]
|
||||||
@@ -1061,6 +1080,8 @@ def interactive_cum_flex_chart2(theworkouts,promember=0,
|
|||||||
var maxspm = maxspm.value
|
var maxspm = maxspm.value
|
||||||
var mindist = mindist.value
|
var mindist = mindist.value
|
||||||
var maxdist = maxdist.value
|
var maxdist = maxdist.value
|
||||||
|
var minwork = minwork.value
|
||||||
|
var maxwork = maxwork.value
|
||||||
var xm = 0
|
var xm = 0
|
||||||
var ym1 = 0
|
var ym1 = 0
|
||||||
var ym2 = 0
|
var ym2 = 0
|
||||||
@@ -1080,6 +1101,7 @@ def interactive_cum_flex_chart2(theworkouts,promember=0,
|
|||||||
for (i=0; i<x1.length; i++) {
|
for (i=0; i<x1.length; i++) {
|
||||||
if (spm1[i]>=minspm && spm1[i]<=maxspm) {
|
if (spm1[i]>=minspm && spm1[i]<=maxspm) {
|
||||||
if (distance1[i]>=mindist && distance1[i]<=maxdist) {
|
if (distance1[i]>=mindist && distance1[i]<=maxdist) {
|
||||||
|
if (driveenergy1[i]>=minwork && driveenergy1[i]<=maxwork) {
|
||||||
data2['x1'].push(x1[i])
|
data2['x1'].push(x1[i])
|
||||||
data2['y1'].push(y1[i])
|
data2['y1'].push(y1[i])
|
||||||
data2['y2'].push(y2[i])
|
data2['y2'].push(y2[i])
|
||||||
@@ -1089,7 +1111,7 @@ def interactive_cum_flex_chart2(theworkouts,promember=0,
|
|||||||
xm += x1[i]
|
xm += x1[i]
|
||||||
ym1 += y1[i]
|
ym1 += y1[i]
|
||||||
ym2 += y2[i]
|
ym2 += y2[i]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1120,6 +1142,15 @@ def interactive_cum_flex_chart2(theworkouts,promember=0,
|
|||||||
title="Max SPM",callback=callback)
|
title="Max SPM",callback=callback)
|
||||||
callback.args["maxspm"] = slider_spm_max
|
callback.args["maxspm"] = slider_spm_max
|
||||||
|
|
||||||
|
slider_work_min = Slider(start=0.0, end=1500,value=0.0, step=10,
|
||||||
|
title="Min Work per Stroke",callback=callback)
|
||||||
|
callback.args["minwork"] = slider_work_min
|
||||||
|
|
||||||
|
|
||||||
|
slider_work_max = Slider(start=0.0, end=1500,value=1500.0, step=10,
|
||||||
|
title="Max Work per Stroke",callback=callback)
|
||||||
|
callback.args["maxwork"] = slider_work_max
|
||||||
|
|
||||||
distmax = 100+100*int(datadf['distance'].max()/100.)
|
distmax = 100+100*int(datadf['distance'].max()/100.)
|
||||||
|
|
||||||
slider_dist_min = Slider(start=0,end=distmax,value=0,step=1,
|
slider_dist_min = Slider(start=0,end=distmax,value=0,step=1,
|
||||||
@@ -1135,6 +1166,8 @@ def interactive_cum_flex_chart2(theworkouts,promember=0,
|
|||||||
slider_spm_max,
|
slider_spm_max,
|
||||||
slider_dist_min,
|
slider_dist_min,
|
||||||
slider_dist_max,
|
slider_dist_max,
|
||||||
|
slider_work_min,
|
||||||
|
slider_work_max,
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
plot])
|
plot])
|
||||||
@@ -1166,7 +1199,9 @@ def interactive_flex_chart2(id=0,promember=0,
|
|||||||
'time','pace','workoutstate']
|
'time','pace','workoutstate']
|
||||||
|
|
||||||
rowdata = dataprep.getsmallrowdata_db(columns,ids=[id],doclean=True)
|
rowdata = dataprep.getsmallrowdata_db(columns,ids=[id],doclean=True)
|
||||||
|
|
||||||
rowdata.dropna(axis=1,how='all',inplace=True)
|
rowdata.dropna(axis=1,how='all',inplace=True)
|
||||||
|
rowdata.dropna(axis=0,how='any',inplace=True)
|
||||||
|
|
||||||
row = Workout.objects.get(id=id)
|
row = Workout.objects.get(id=id)
|
||||||
if rowdata.empty:
|
if rowdata.empty:
|
||||||
@@ -1492,12 +1527,12 @@ def interactive_flex_chart2(id=0,promember=0,
|
|||||||
title="Max SPM",callback=callback)
|
title="Max SPM",callback=callback)
|
||||||
callback.args["maxspm"] = slider_spm_max
|
callback.args["maxspm"] = slider_spm_max
|
||||||
|
|
||||||
slider_work_min = Slider(start=0.0, end=1000,value=0.0, step=10,
|
slider_work_min = Slider(start=0.0, end=1500,value=0.0, step=10,
|
||||||
title="Min Work per Stroke",callback=callback)
|
title="Min Work per Stroke",callback=callback)
|
||||||
callback.args["minwork"] = slider_work_min
|
callback.args["minwork"] = slider_work_min
|
||||||
|
|
||||||
|
|
||||||
slider_work_max = Slider(start=0.0, end=1000,value=1000.0, step=10,
|
slider_work_max = Slider(start=0.0, end=1500,value=1500.0, step=10,
|
||||||
title="Max Work per Stroke",callback=callback)
|
title="Max Work per Stroke",callback=callback)
|
||||||
callback.args["maxwork"] = slider_work_max
|
callback.args["maxwork"] = slider_work_max
|
||||||
|
|
||||||
@@ -1532,7 +1567,9 @@ def interactive_flex_chart2(id=0,promember=0,
|
|||||||
def interactive_bar_chart(id=0,promember=0):
|
def interactive_bar_chart(id=0,promember=0):
|
||||||
# check if valid ID exists (workout exists)
|
# check if valid ID exists (workout exists)
|
||||||
rowdata,row = dataprep.getrowdata_db(id=id)
|
rowdata,row = dataprep.getrowdata_db(id=id)
|
||||||
|
rowdata.dropna(axis=1,how='all',inplace=True)
|
||||||
rowdata.dropna(axis=0,how='any',inplace=True)
|
rowdata.dropna(axis=0,how='any',inplace=True)
|
||||||
|
|
||||||
if rowdata.empty:
|
if rowdata.empty:
|
||||||
return "","No Valid Data Available"
|
return "","No Valid Data Available"
|
||||||
|
|
||||||
@@ -1630,7 +1667,9 @@ def interactive_multiple_compare_chart(ids,xparam,yparam,plottype='line',
|
|||||||
'workoutid']
|
'workoutid']
|
||||||
|
|
||||||
datadf = dataprep.getsmallrowdata_db(columns,ids=ids)
|
datadf = dataprep.getsmallrowdata_db(columns,ids=ids)
|
||||||
|
datadf.dropna(axis=1,how='all',inplace=True)
|
||||||
datadf.dropna(axis=0,how='any',inplace=True)
|
datadf.dropna(axis=0,how='any',inplace=True)
|
||||||
|
|
||||||
tseconds = datadf.ix[:,'time']
|
tseconds = datadf.ix[:,'time']
|
||||||
|
|
||||||
yparamname = axlabels[yparam]
|
yparamname = axlabels[yparam]
|
||||||
@@ -1792,8 +1831,11 @@ def interactive_comparison_chart(id1=0,id2=0,xparam='distance',yparam='spm',
|
|||||||
rowdata1[n].fillna(value=0,inplace=True)
|
rowdata1[n].fillna(value=0,inplace=True)
|
||||||
rowdata2[n].fillna(value=0,inplace=True)
|
rowdata2[n].fillna(value=0,inplace=True)
|
||||||
|
|
||||||
|
rowdata1.dropna(axis=1,how='all',inplace=True)
|
||||||
rowdata1.dropna(axis=0,how='any',inplace=True)
|
rowdata1.dropna(axis=0,how='any',inplace=True)
|
||||||
|
rowdata2.dropna(axis=1,how='all',inplace=True)
|
||||||
rowdata2.dropna(axis=0,how='any',inplace=True)
|
rowdata2.dropna(axis=0,how='any',inplace=True)
|
||||||
|
|
||||||
row1 = Workout.objects.get(id=id1)
|
row1 = Workout.objects.get(id=id1)
|
||||||
row2 = Workout.objects.get(id=id2)
|
row2 = Workout.objects.get(id=id2)
|
||||||
|
|
||||||
@@ -1963,7 +2005,9 @@ def interactive_comparison_chart(id1=0,id2=0,xparam='distance',yparam='spm',
|
|||||||
def interactive_otw_advanced_pace_chart(id=0,promember=0):
|
def interactive_otw_advanced_pace_chart(id=0,promember=0):
|
||||||
# check if valid ID exists (workout exists)
|
# check if valid ID exists (workout exists)
|
||||||
rowdata,row = dataprep.getrowdata_db(id=id)
|
rowdata,row = dataprep.getrowdata_db(id=id)
|
||||||
|
rowdata.dropna(axis=1,how='all',inplace=True)
|
||||||
rowdata.dropna(axis=0,how='any',inplace=True)
|
rowdata.dropna(axis=0,how='any',inplace=True)
|
||||||
|
|
||||||
if rowdata.empty:
|
if rowdata.empty:
|
||||||
return "","No Valid Data Available"
|
return "","No Valid Data Available"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user