Private
Public Access
1
0

Merge branch 'release/v2.41'

This commit is contained in:
Sander Roosendaal
2017-05-04 20:22:35 +02:00
7 changed files with 52 additions and 31 deletions
+20 -1
View File
@@ -35,6 +35,24 @@ database_url = 'mysql://{user}:{password}@{host}:{port}/{database_name}'.format(
database_url_debug = 'sqlite:///'+database_name database_url_debug = 'sqlite:///'+database_name
# mapping the DB column names to the CSV file column names
columndict = {
'time':'TimeStamp (sec)',
'hr':' HRCur (bpm)',
'pace':' Stroke500mPace (sec/500m)',
'spm':' Cadence (stokes/min)',
'power':' Power (watts)',
'averageforce':' AverageDriveForce (lbs)',
'drivelength':' DriveLength (meters)',
'peakforce':' PeakDriveForce (lbs)',
'distance':' Horizontal (meters)',
'catch':'catch',
'finish':'finish',
'peakforceangle':'peakforceangle',
'wash':'wash',
'slip':'wash',
'workoutstate':' WorkoutState',
}
from scipy.signal import savgol_filter from scipy.signal import savgol_filter
@@ -563,6 +581,7 @@ def dataprep(rowdatadf,id=0,bands=True,barchart=True,otwpower=True,
cumdist = rowdatadf.ix[:,'cum_dist'] cumdist = rowdatadf.ix[:,'cum_dist']
power = rowdatadf.ix[:,' Power (watts)'] power = rowdatadf.ix[:,' Power (watts)']
averageforce = rowdatadf.ix[:,' AverageDriveForce (lbs)'] averageforce = rowdatadf.ix[:,' AverageDriveForce (lbs)']
drivelength = rowdatadf.ix[:,' DriveLength (meters)'] drivelength = rowdatadf.ix[:,' DriveLength (meters)']
try: try:
@@ -580,7 +599,7 @@ def dataprep(rowdatadf,id=0,bands=True,barchart=True,otwpower=True,
if windowsize <= 3: if windowsize <= 3:
windowsize = 5 windowsize = 5
if windowsize > 3: if windowsize > 3 and windowsize<len(hr):
spm = savgol_filter(spm,windowsize,3) spm = savgol_filter(spm,windowsize,3)
hr = savgol_filter(hr,windowsize,3) hr = savgol_filter(hr,windowsize,3)
drivelength = savgol_filter(drivelength,windowsize,3) drivelength = savgol_filter(drivelength,windowsize,3)
-2
View File
@@ -2103,13 +2103,11 @@ def interactive_otw_advanced_pace_chart(id=0,promember=0):
plot.line('time','pace',source=source,legend="Pace",color="black") plot.line('time','pace',source=source,legend="Pace",color="black")
plot.line('time','nowindpace',source=source,legend="Corrected Pace",color="red") plot.line('time','nowindpace',source=source,legend="Corrected Pace",color="red")
plot.line('time','ergpace',source=source,legend="Equivalent Erg Pace",color="blue")
hover.tooltips = OrderedDict([ hover.tooltips = OrderedDict([
('Time','@ftime'), ('Time','@ftime'),
('Pace','@fpace'), ('Pace','@fpace'),
('Corrected Pace','@fnowindpace'), ('Corrected Pace','@fnowindpace'),
('Equiv. Erg Pace','@fergpace'),
('HR','@hr{int}'), ('HR','@hr{int}'),
('SPM','@spm{1.1}'), ('SPM','@spm{1.1}'),
]) ])
+3 -2
View File
@@ -164,7 +164,8 @@ def handle_otwsetpower(f1,boattype,weightvalue,
powermeasured = False powermeasured = False
try: try:
w = rowdata.df['wash'] w = rowdata.df['wash']
powermeasured = True if w.mean() != 0:
powermeasured = True
except KeyError: except KeyError:
pass pass
@@ -172,7 +173,7 @@ def handle_otwsetpower(f1,boattype,weightvalue,
powermeasured=powermeasured) powermeasured=powermeasured)
# save data # save data
rowdata.write_csv(f1) rowdata.write_csv(f1,gzip=True)
update_strokedata(workoutid,rowdata.df,debug=debug) update_strokedata(workoutid,rowdata.df,debug=debug)
# send email # send email
+3 -1
View File
@@ -217,7 +217,7 @@ def uploadactivity(access_token,filename,description='',
headers = { headers = {
"Content-Type": "application/json", 'Content-Type': 'application/json',
'Accept': 'application/json', 'Accept': 'application/json',
'Authorization': 'Bearer %s' % access_token 'Authorization': 'Bearer %s' % access_token
} }
@@ -247,6 +247,8 @@ def uploadactivity(access_token,filename,description='',
print "" print ""
return 0,resp.reason,resp.status_code,headers return 0,resp.reason,resp.status_code,headers
else: else:
print headers
print json.dumps(headers)
return resp.json()[0]["Id"],"ok",200,"" return resp.json()[0]["Id"],"ok",200,""
return 0 return 0
+23 -23
View File
@@ -489,30 +489,30 @@ def add_workout_from_strokedata(user,importid,data,strokedata,
timestr = strftime("%Y%m%d-%H%M%S") timestr = strftime("%Y%m%d-%H%M%S")
# auto smoothing # # auto smoothing
pace = df[' Stroke500mPace (sec/500m)'].values # pace = df[' Stroke500mPace (sec/500m)'].values
velo = 500./pace # velo = 500./pace
f = df['TimeStamp (sec)'].diff().mean() # f = df['TimeStamp (sec)'].diff().mean()
windowsize = 2*(int(10./(f)))+1 # windowsize = 2*(int(10./(f)))+1
if windowsize <= 3: # if windowsize <= 3:
windowsize = 5 # windowsize = 5
df['originalvelo'] = velo # df['originalvelo'] = velo
if windowsize > 3 and windowsize < len(velo): # if windowsize > 3 and windowsize < len(velo):
velo2 = savgol_filter(velo,windowsize,3) # velo2 = savgol_filter(velo,windowsize,3)
else: # else:
velo2=velo # velo2=velo
velo3 = pd.Series(velo2) # velo3 = pd.Series(velo2)
velo3 = velo3.replace([-np.inf,np.inf],np.nan) # velo3 = velo3.replace([-np.inf,np.inf],np.nan)
velo3 = velo3.fillna(method='ffill') # velo3 = velo3.fillna(method='ffill')
pace2 = 500./abs(velo3) # pace2 = 500./abs(velo3)
df[' Stroke500mPace (sec/500m)'] = pace2 # df[' Stroke500mPace (sec/500m)'] = pace2
df = df.fillna(0) # df = df.fillna(0)
# end autosmoothing # end autosmoothing
@@ -681,9 +681,9 @@ def add_workout_from_runkeeperdata(user,importid,data):
dt = np.diff(cum_time).mean() dt = np.diff(cum_time).mean()
wsize = round(5./dt) wsize = round(5./dt)
velo2 = stravastuff.ewmovingaverage(velo,wsize) # velo2 = stravastuff.ewmovingaverage(velo,wsize)
df[' Stroke500mPace (sec/500m)'] = 500./velo2 # df[' Stroke500mPace (sec/500m)'] = 500./velo2
df = df.fillna(0) df = df.fillna(0)
@@ -1015,9 +1015,9 @@ def add_workout_from_underarmourdata(user,importid,data):
dt = np.diff(cum_time).mean() dt = np.diff(cum_time).mean()
wsize = round(5./dt) wsize = round(5./dt)
velo2 = stravastuff.ewmovingaverage(velo,wsize) # velo2 = stravastuff.ewmovingaverage(velo,wsize)
df[' Stroke500mPace (sec/500m)'] = 500./velo2 # df[' Stroke500mPace (sec/500m)'] = 500./velo2
df = df.fillna(0) df = df.fillna(0)
@@ -3830,7 +3830,7 @@ def workout_otwsetpower_view(request,id=0,message="",successmessage=""):
if settings.DEBUG: if settings.DEBUG:
res = handle_otwsetpower.delay(f1,boattype,weightvalue, res = handle_otwsetpower.delay(f1,boattype,weightvalue,
first_name,last_name,emailaddress,id) first_name,last_name,emailaddress,id,debug=True)
else: else:
res = queuelow.enqueue(handle_otwsetpower,f1,boattype, res = queuelow.enqueue(handle_otwsetpower,f1,boattype,
weightvalue, weightvalue,
BIN
View File
Binary file not shown.
+2 -1
View File
@@ -233,7 +233,8 @@ SPORTTRACKS_REDIRECT_URI = "http://rowsandall.com/sporttracks_callback"
RUNKEEPER_CLIENT_ID = CFG['runkeeper_client_id'] RUNKEEPER_CLIENT_ID = CFG['runkeeper_client_id']
RUNKEEPER_CLIENT_SECRET = CFG['runkeeper_client_secret'] RUNKEEPER_CLIENT_SECRET = CFG['runkeeper_client_secret']
RUNKEEPER_REDIRECT_URI = "http://rowsandall.com/runkeeper_callback" RUNKEEPER_REDIRECT_URI = CFG['runkeeper_callback']
# Under Armour # Under Armour