some improvements
This commit is contained in:
@@ -1185,7 +1185,6 @@ def interactive_cpchart(rower,thedistances,thesecs,theavpower,
|
|||||||
# fitting the data to three parameter CP model
|
# fitting the data to three parameter CP model
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
p1 = p0
|
p1 = p0
|
||||||
if len(thesecs)>=4:
|
if len(thesecs)>=4:
|
||||||
p1, success = optimize.leastsq(errfunc, p0[:], args = (thesecs,theavpower))
|
p1, success = optimize.leastsq(errfunc, p0[:], args = (thesecs,theavpower))
|
||||||
@@ -1271,7 +1270,7 @@ def interactive_cpchart(rower,thedistances,thesecs,theavpower,
|
|||||||
|
|
||||||
if cpdata.empty:
|
if cpdata.empty:
|
||||||
message = 'Calculations are running in the background. Please refresh this page to see updated results'
|
message = 'Calculations are running in the background. Please refresh this page to see updated results'
|
||||||
return ['','',paulslope,paulintercept,p1,message]
|
return ['','',paulslope,paulintercept,p1,message,p1wc]
|
||||||
|
|
||||||
velo = cpdata['distance']/cpdata['delta']
|
velo = cpdata['distance']/cpdata['delta']
|
||||||
|
|
||||||
@@ -1338,7 +1337,7 @@ def interactive_cpchart(rower,thedistances,thesecs,theavpower,
|
|||||||
script, div = components(plot)
|
script, div = components(plot)
|
||||||
|
|
||||||
|
|
||||||
return [script,div,paulslope,paulintercept,p1,message]
|
return [script,div,paulslope,paulintercept,p1,message,p1wc]
|
||||||
|
|
||||||
def interactive_windchart(id=0,promember=0):
|
def interactive_windchart(id=0,promember=0):
|
||||||
# check if valid ID exists (workout exists)
|
# check if valid ID exists (workout exists)
|
||||||
|
|||||||
@@ -343,11 +343,14 @@ def getagegrouprecord(age,sex='male',weightcategory='hwt',
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if not df.empty:
|
||||||
ages = df['age']
|
ages = df['age']
|
||||||
powers = df['power']
|
powers = df['power']
|
||||||
|
|
||||||
poly_coefficients = np.polyfit(ages,powers,6)
|
poly_coefficients = np.polyfit(ages,powers,6)
|
||||||
|
|
||||||
power = np.polyval(poly_coefficients,age)
|
power = np.polyval(poly_coefficients,age)
|
||||||
|
else:
|
||||||
|
power = 0
|
||||||
|
|
||||||
return power
|
return power
|
||||||
|
|||||||
@@ -160,15 +160,21 @@
|
|||||||
|
|
||||||
{{ the_div|safe }}
|
{{ the_div|safe }}
|
||||||
|
|
||||||
<p>The dashed lines are based on the Concept2 rankings for your age, gender
|
{% if age %}
|
||||||
and weight category. World class means within 5% of World Record in terms
|
<p>The dashed lines are based on the
|
||||||
|
<a href="https://log.concept2.com/rankings">Concept2</a>
|
||||||
|
rankings for your age, gender
|
||||||
|
and weight category. World class means within 5% of
|
||||||
|
<a href="http://www.concept2.com/indoor-rowers/racing/records/world">
|
||||||
|
World Record</a> in terms
|
||||||
of power. Excellent, Good, and Fair indicate the power levels of the top
|
of power. Excellent, Good, and Fair indicate the power levels of the top
|
||||||
10%, 25% and 50% of the Concept2 rankings. Average is taken
|
10%, 25% and 50% of the Concept2 rankings. Average is taken
|
||||||
as being in the top 75%, given that the Concept2 rankings probably
|
as being in the top 75%, which is quite good,
|
||||||
|
given that the Concept2 rankings probably
|
||||||
represent the more competitive sub-group of all people who erg.
|
represent the more competitive sub-group of all people who erg.
|
||||||
Please note that this is a prediction for people of exactly your age,
|
Please note that this is a prediction for people of exactly your age,
|
||||||
and your actual place in the Concept2 Ranking may be different.</p>
|
and your actual place in the Concept2 Ranking may be different.</p>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="predictions" class="grid_12 alpha">
|
<div id="predictions" class="grid_12 alpha">
|
||||||
|
|||||||
@@ -3543,7 +3543,6 @@ def rankings_view2(request,theuser=0,
|
|||||||
age = calculate_age(r.birthdate)
|
age = calculate_age(r.birthdate)
|
||||||
durations = [1,4,30,60]
|
durations = [1,4,30,60]
|
||||||
distances = [100,500,1000,2000,5000,6000,10000,21097,42195]
|
distances = [100,500,1000,2000,5000,6000,10000,21097,42195]
|
||||||
print r.weightcategory,r.sex,age,'aap'
|
|
||||||
for distance in distances:
|
for distance in distances:
|
||||||
worldclasspower = metrics.getagegrouprecord(
|
worldclasspower = metrics.getagegrouprecord(
|
||||||
age,
|
age,
|
||||||
@@ -3552,9 +3551,12 @@ def rankings_view2(request,theuser=0,
|
|||||||
weightcategory=r.weightcategory
|
weightcategory=r.weightcategory
|
||||||
)
|
)
|
||||||
velo = (worldclasspower/2.8)**(1./3.)
|
velo = (worldclasspower/2.8)**(1./3.)
|
||||||
|
try:
|
||||||
duration = distance/velo
|
duration = distance/velo
|
||||||
wcdurations.append(duration)
|
wcdurations.append(duration)
|
||||||
wcpower.append(worldclasspower)
|
wcpower.append(worldclasspower)
|
||||||
|
except ZeroDivisionError:
|
||||||
|
pass
|
||||||
for duration in durations:
|
for duration in durations:
|
||||||
worldclasspower = metrics.getagegrouprecord(
|
worldclasspower = metrics.getagegrouprecord(
|
||||||
age,
|
age,
|
||||||
@@ -3562,12 +3564,16 @@ def rankings_view2(request,theuser=0,
|
|||||||
duration=duration,
|
duration=duration,
|
||||||
weightcategory=r.weightcategory
|
weightcategory=r.weightcategory
|
||||||
)
|
)
|
||||||
wcdurations.append(60.*duration)
|
try:
|
||||||
velo = (worldclasspower/2.8)**(1./3.)
|
velo = (worldclasspower/2.8)**(1./3.)
|
||||||
distance = int(60*duration*velo)
|
distance = int(60*duration*velo)
|
||||||
|
wcdurations.append(60.*duration)
|
||||||
wcpower.append(worldclasspower)
|
wcpower.append(worldclasspower)
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
else:
|
else:
|
||||||
worldclasspower = None
|
worldclasspower = None
|
||||||
|
age = 0
|
||||||
|
|
||||||
result = request.user.is_authenticated() and ispromember(request.user)
|
result = request.user.is_authenticated() and ispromember(request.user)
|
||||||
if result:
|
if result:
|
||||||
@@ -3702,6 +3708,10 @@ def rankings_view2(request,theuser=0,
|
|||||||
paulintercept = res[3]
|
paulintercept = res[3]
|
||||||
p1 = res[4]
|
p1 = res[4]
|
||||||
message = res[5]
|
message = res[5]
|
||||||
|
try:
|
||||||
|
testcalc = float(pd.Series(res[6]))
|
||||||
|
except TypeError:
|
||||||
|
age = 0
|
||||||
else:
|
else:
|
||||||
script = ''
|
script = ''
|
||||||
div = '<p>No ranking pieces found.</p>'
|
div = '<p>No ranking pieces found.</p>'
|
||||||
@@ -3840,6 +3850,9 @@ def rankings_view2(request,theuser=0,
|
|||||||
'deltaform':deltaform,
|
'deltaform':deltaform,
|
||||||
'id': theuser,
|
'id': theuser,
|
||||||
'theuser':uu,
|
'theuser':uu,
|
||||||
|
'age':age,
|
||||||
|
'sex':r.sex,
|
||||||
|
'weightcategory':r.weightcategory,
|
||||||
'startdate':startdate,
|
'startdate':startdate,
|
||||||
'enddate':enddate,
|
'enddate':enddate,
|
||||||
'teams':get_my_teams(request.user),
|
'teams':get_my_teams(request.user),
|
||||||
|
|||||||
Reference in New Issue
Block a user