Private
Public Access
1
0
This commit is contained in:
Sander Roosendaal
2021-04-14 21:39:21 +02:00
parent eb32394d0b
commit 2f1c85427a
8 changed files with 118 additions and 77 deletions

View File

@@ -1900,9 +1900,6 @@ def performance_chart(user,startdate=None,enddate=None,kfitness=42,kfatigue=7,
df['date'] = df.index.values
#for row in df.iterrows():
# print(row)
source = ColumnDataSource(
data = dict(
testpower = df['testpower'],
@@ -3141,7 +3138,8 @@ def interactive_agegroupcpchart(age,normalized=False):
mlduration.append(duration)
mlpower.append(worldclasspower)
except ZeroDivisionError:
pass
mlduration.append(duration)
mlpower.append(np.nan)
for duration in durations:
worldclasspower = c2stuff.getagegrouprecord(
age,
@@ -3155,7 +3153,8 @@ def interactive_agegroupcpchart(age,normalized=False):
mlduration.append(60.*duration)
mlpower.append(worldclasspower)
except ValueError: # pragma: no cover
pass
mlduration.append(60.*duration)
mlpower.append(np.nan)
mhduration = []
@@ -3174,7 +3173,8 @@ def interactive_agegroupcpchart(age,normalized=False):
mhduration.append(duration)
mhpower.append(worldclasspower)
except ZeroDivisionError:
pass
mhduration.append(duration)
mhpower.append(np.nan)
for duration in durations:
worldclasspower = c2stuff.getagegrouprecord(
age,
@@ -3188,7 +3188,8 @@ def interactive_agegroupcpchart(age,normalized=False):
mhduration.append(60.*duration)
mhpower.append(worldclasspower)
except ValueError: # pragma: no cover
pass
mhduration.append(60.*duration)
mhpower.append(np.nan)
@@ -3247,23 +3248,43 @@ def interactive_agegroupcpchart(age,normalized=False):
source = ColumnDataSource(
sourcemh = ColumnDataSource(
data = dict(
mhduration = mhduration,
mhpower = mhpower,
)
)
sourcefl = ColumnDataSource(
data = dict(
flduration = flduration,
flpower = flpower,
)
)
sourcefh = ColumnDataSource(
data = dict(
fhduration = fhduration,
fhpower = fhpower,
)
)
sourceml = ColumnDataSource(
data = dict(
mlduration = mlduration,
mlpower = mlpower,
)
)
sourcefit = ColumnDataSource(
data = dict(
duration = fitt,
fitpowerfh = fitpowerfh,
fitpowerfl = fitpowerfl,
fitpowerml = fitpowerml,
fitpowermh = fitpowermh,
flduration = flduration,
flpower = flpower,
fhduration = fhduration,
fhpower = fhpower,
mlduration = mlduration,
mlpower = mlpower,
mhduration = mhduration,
mhpower = mhpower,
)
)
)
x_axis_type = 'log'
y_axis_type = 'linear'
@@ -3274,28 +3295,28 @@ def interactive_agegroupcpchart(age,normalized=False):
tools=TOOLS)
plot.sizing_mode = 'stretch_both'
plot.line('duration','fitpowerfh',source=source,
plot.line('duration','fitpowerfh',source=sourcefit,
legend_label='Female HW',color='blue')
plot.line('duration','fitpowerfl',source=source,
plot.line('duration','fitpowerfl',source=sourcefit,
legend_label='Female LW',color='red')
plot.line('duration','fitpowerml',source=source,
plot.line('duration','fitpowerml',source=sourcefit,
legend_label='Male LW',color='green')
plot.line('duration','fitpowermh',source=source,
plot.line('duration','fitpowermh',source=sourcefit,
legend_label='Male HW',color='orange')
plot.circle('flduration','flpower',source=source,
plot.circle('flduration','flpower',source=sourcefl,
fill_color='red',size=15)
plot.circle('fhduration','fhpower',source=source,
plot.circle('fhduration','fhpower',source=sourcefh,
fill_color='blue',size=15)
plot.circle('mlduration','mlpower',source=source,
plot.circle('mlduration','mlpower',source=sourceml,
fill_color='green',size=15)
plot.circle('mhduration','mhpower',source=source,
plot.circle('mhduration','mhpower',source=sourcemh,
fill_color='orange',size=15)
plot.title.text = 'age '+str(age)
@@ -3400,16 +3421,23 @@ def interactive_otwcpchart(powerdf,promember=0,rowername="",r=None,cpfit='data',
CPmax = ratio*fitpower,
duration = fitt/60.,
ftime = ftime,
workout = workouts,
# workout = workouts,
fitpowerwc = fitpowerwc,
fitpowerexcellent = fitpowerexcellent,
fitpowergood = fitpowergood,
fitpowerfair = fitpowerfair,
fitpoweraverage = fitpoweraverage,
url = urls,
# url = urls,
)
)
sourceannot= ColumnDataSource(
data = dict(
workout = workouts,
url = urls,
)
)
# making the plot
plot = Figure(tools=TOOLS,x_axis_type=x_axis_type,
plot_width=900,
@@ -3544,13 +3572,20 @@ def interactive_agegroup_plot(df,distance=2000,duration=None,
data = dict(
age = age,
power = power,
age2 = age2,
expo_vals = expo_vals,
#age2 = age2,
#expo_vals = expo_vals,
season = season,
name=name,
)
)
sourcefit = ColumnDataSource(
data = dict(
age2 = age2,
expo_vals = expo_vals,
)
)
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,crosshair'
plot = Figure(tools=TOOLS,plot_width=900)
@@ -3558,7 +3593,7 @@ def interactive_agegroup_plot(df,distance=2000,duration=None,
plot.circle('age','power',source=source,fill_color='red',size=15,
legend_label='World Record')
plot.line(age2,expo_vals)
plot.line('age2','expo_vals',source=sourcefit)
plot.xaxis.axis_label = "Age"
plot.yaxis.axis_label = "Concept2 power"
plot.title.text = plottitle