Private
Public Access
1
0

adding axis labels to instroke plots for Quiske

This commit is contained in:
Sander Roosendaal
2023-01-03 08:19:56 +01:00
parent ac2ad454bb
commit 37d5a5439c
3 changed files with 31 additions and 7 deletions

View File

@@ -7,7 +7,7 @@ from scipy.stats import linregress, percentileofscore
from pytz import timezone as tz, utc from pytz import timezone as tz, utc
from rowers.models import course_spline, VirtualRaceResult, InStrokeAnalysis, ForceCurveAnalysis from rowers.models import course_spline, VirtualRaceResult, InStrokeAnalysis, ForceCurveAnalysis
from bokeh.palettes import Category20c, Category10 from bokeh.palettes import Category20c, Category10
from bokeh.layouts import layout, widgetbox from bokeh.layouts import layout
from bokeh.resources import CDN, INLINE from bokeh.resources import CDN, INLINE
from rowers.dataprep import timedeltaconv from rowers.dataprep import timedeltaconv
from pandas.core.groupby.groupby import DataError from pandas.core.groupby.groupby import DataError
@@ -1275,7 +1275,7 @@ def interactive_forcecurve(theworkouts, workstrokesonly=True, plottype='scatter'
plot.xaxis.axis_label = "Angle" plot.xaxis.axis_label = "Angle"
plot.yaxis.axis_label = "Force (N)" plot.yaxis.axis_label = "Force (N)"
plot.title.text = theworkouts[0].name plot.title.text = theworkouts[0].name
plot.title.text_font_size = value("1.0em") plot.title.text_font_size = "1.0em"
yrange1 = Range1d(start=0, end=900) yrange1 = Range1d(start=0, end=900)
plot.y_range = yrange1 plot.y_range = yrange1
@@ -4017,7 +4017,7 @@ def interactive_windchart(id=0, promember=0):
plot.line('dist', 'tw', source=source, plot.line('dist', 'tw', source=source,
legend_label="Tail (+)/Head (-) Wind (m/s)", color='black') legend_label="Tail (+)/Head (-) Wind (m/s)", color='black')
plot.title.text = row.name plot.title.text = row.name
# plot.title.text_font_size=value("1.0em") # plot.title.text_font_size="1.0em"
plot.title.text_font = "1.0em" plot.title.text_font = "1.0em"
plot.xaxis.axis_label = "Distance (m)" plot.xaxis.axis_label = "Distance (m)"
plot.yaxis.axis_label = "Wind Speed (m/s)" plot.yaxis.axis_label = "Wind Speed (m/s)"
@@ -4084,7 +4084,7 @@ def interactive_streamchart(id=0, promember=0):
) )
plot.line(dist, vstream, legend_label="River Stream Velocity (m/s)") plot.line(dist, vstream, legend_label="River Stream Velocity (m/s)")
plot.title.text = row.name plot.title.text = row.name
plot.title.text_font_size = value("1.0em") plot.title.text_font_size = "1.0em"
plot.xaxis.axis_label = "Distance (m)" plot.xaxis.axis_label = "Distance (m)"
plot.yaxis.axis_label = "River Current (m/s)" plot.yaxis.axis_label = "River Current (m/s)"
plot.y_range = Range1d(-2, 2) plot.y_range = Range1d(-2, 2)
@@ -4456,6 +4456,18 @@ def instroke_interactive_chart(df,metric, workout, spm_min, spm_max,
plot.add_tools(HoverTool(tooltips=TIPS)) plot.add_tools(HoverTool(tooltips=TIPS))
if metric == 'boat accelerator curve':
plot.yaxis.axis_label = "Boat acceleration (m/s^2)"
elif metric == 'instroke boat speed':
plot.yaxis.axis_label = "Boat Speed (m/s)"
vavg = mean_vals.median()
elif metric == 'oar angle velocity curve':
plot.yaxis.axis_label = "Oar Angular Velocity (degree/s)"
elif metric == 'seat curve':
plot.yaxis.axis_label = "Seat Speed (m/s)"
plot.xaxis.axis_label = 'Time (%)'
try: try:
script, div = components(plot) script, div = components(plot)
except ValueError: except ValueError:
@@ -4526,7 +4538,7 @@ def interactive_chart(id=0, promember=0, intervaldata={}):
plot.line('time', 'pace', source=source, legend_label="Pace", name="pace") plot.line('time', 'pace', source=source, legend_label="Pace", name="pace")
plot.title.text = row.name plot.title.text = row.name
plot.title.text_font_size = value("1.0em") plot.title.text_font_size = "1.0em"
plot.sizing_mode = 'stretch_both' plot.sizing_mode = 'stretch_both'
plot.xaxis.axis_label = "Time" plot.xaxis.axis_label = "Time"
plot.yaxis.axis_label = "Pace (/500m)" plot.yaxis.axis_label = "Pace (/500m)"
@@ -4825,7 +4837,7 @@ def interactive_multiflex(datadf, xparam, yparam, groupby, extratitle='',
plot.extra_x_ranges = {"watermark": watermarkrange} plot.extra_x_ranges = {"watermark": watermarkrange}
plot.title.text = title plot.title.text = title
plot.title.text_font_size = value("1.0em") plot.title.text_font_size = "1.0em"
plot.sizing_mode = 'stretch_both' plot.sizing_mode = 'stretch_both'
plot.image_url([watermarkurl], watermarkx, watermarky, plot.image_url([watermarkurl], watermarkx, watermarky,
@@ -5987,7 +5999,7 @@ def interactive_flex_chart2(id, r, promember=0,
line_color=None) line_color=None)
plot.title.text = row.name plot.title.text = row.name
plot.title.text_font_size = value("1.0em") plot.title.text_font_size = "1.0em"
plot.sizing_mode = 'stretch_both' plot.sizing_mode = 'stretch_both'
plot.xaxis.axis_label = xaxlabel plot.xaxis.axis_label = xaxlabel

View File

@@ -307,6 +307,8 @@ queuelow = django_rq.get_queue('low')
queuehigh = django_rq.get_queue('high') queuehigh = django_rq.get_queue('high')
g_acc = 9.80665
def get_totals(workouts): def get_totals(workouts):
totalseconds = 0 totalseconds = 0
totalmeters = 0 totalmeters = 0

View File

@@ -3166,11 +3166,16 @@ def instroke_data(request, metric='', spm_min=15, spm_max=45, activeminutesmin=0
except ValueError: except ValueError:
pass pass
factor = 1
if metric == 'boat accelerator curve':
factor = g_acc
data = rowdata.get_instroke_data(metric, spm_min=spm_min, data = rowdata.get_instroke_data(metric, spm_min=spm_min,
spm_max=spm_max, spm_max=spm_max,
activeminutesmin=activeminutesmin, activeminutesmin=activeminutesmin,
activeminutesmax=activeminutesmax, activeminutesmax=activeminutesmax,
factor=factor,
) )
filename = str(uuid4())+'.csv' filename = str(uuid4())+'.csv'
@@ -3375,12 +3380,17 @@ def instroke_chart_interactive(request, id=0, analysis=0, userid=0):
activesecondsmin = 60.*activeminutesmin activesecondsmin = 60.*activeminutesmin
activesecondsmax = 60.*activeminutesmax activesecondsmax = 60.*activeminutesmax
factor = 1
if metric == 'boat accelerator curve':
factor = g_acc
data = rowdata.get_instroke_data( data = rowdata.get_instroke_data(
metric, metric,
spm_min=spm_min, spm_min=spm_min,
spm_max=spm_max, spm_max=spm_max,
activeminutesmin=activeminutesmin, activeminutesmin=activeminutesmin,
activeminutesmax=activeminutesmax, activeminutesmax=activeminutesmax,
factor=factor,
) )