Private
Public Access
1
0

Merge branch 'release/v9.81'

This commit is contained in:
Sander Roosendaal
2019-04-28 12:42:10 +02:00
4 changed files with 48 additions and 43 deletions

View File

@@ -220,36 +220,36 @@ def add_c2_stroke_data_db(strokedata,workoutid,starttimeunix,csvfilename,
unixtime = cum_time+starttimeunix unixtime = cum_time+starttimeunix
# unixtime[0] = starttimeunix # unixtime[0] = starttimeunix
seconds = 0.1*strokedata.ix[:,'t'] seconds = 0.1*strokedata.loc[:,'t']
nr_rows = len(unixtime) nr_rows = len(unixtime)
try: try:
latcoord = strokedata.ix[:,'lat'] latcoord = strokedata.loc[:,'lat']
loncoord = strokedata.ix[:,'lon'] loncoord = strokedata.loc[:,'lon']
except: except:
latcoord = np.zeros(nr_rows) latcoord = np.zeros(nr_rows)
loncoord = np.zeros(nr_rows) loncoord = np.zeros(nr_rows)
try: try:
strokelength = strokedata.ix[:,'strokelength'] strokelength = strokedata.loc[:,'strokelength']
except: except:
strokelength = np.zeros(nr_rows) strokelength = np.zeros(nr_rows)
dist2 = 0.1*strokedata.ix[:,'d'] dist2 = 0.1*strokedata.loc[:,'d']
try: try:
spm = strokedata.ix[:,'spm'] spm = strokedata.loc[:,'spm']
except KeyError: except KeyError:
spm = 0*dist2 spm = 0*dist2
try: try:
hr = strokedata.ix[:,'hr'] hr = strokedata.loc[:,'hr']
except KeyError: except KeyError:
hr = 0*spm hr = 0*spm
pace = strokedata.ix[:,'p']/10. pace = strokedata.loc[:,'p']/10.
pace = np.clip(pace,0,1e4) pace = np.clip(pace,0,1e4)
pace = pace.replace(0,300) pace = pace.replace(0,300)
@@ -385,7 +385,7 @@ def save_workout_database(f2,r,dosmooth=True,workouttype='rower',
totaldist = row.df['cum_dist'].max() totaldist = row.df['cum_dist'].max()
if totaltime == 0: if totaltime == 0:
totaltime = row.df['TimeStamp (sec)'].max()-row.df['TimeStamp (sec)'].min() totaltime = row.df['TimeStamp (sec)'].max()-row.df['TimeStamp (sec)'].min()
totaltime = totaltime+row.df.ix[0,' ElapsedTime (sec)'] totaltime = totaltime+row.df.loc[0,' ElapsedTime (sec)']
@@ -968,38 +968,38 @@ def dataprep(rowdatadf,id=0,bands=True,barchart=True,otwpower=True,
print("dataprep",id) print("dataprep",id)
# rowdatadf.set_index([range(len(rowdatadf))],inplace=True) # rowdatadf.set_index([range(len(rowdatadf))],inplace=True)
t = rowdatadf.ix[:,'TimeStamp (sec)'] t = rowdatadf.loc[:,'TimeStamp (sec)']
t = pd.Series(t-rowdatadf.ix[0,'TimeStamp (sec)']) t = pd.Series(t-rowdatadf.loc[:,'TimeStamp (sec)'].iloc[0])
row_index = rowdatadf.ix[:,' Stroke500mPace (sec/500m)'] > 3000 row_index = rowdatadf.loc[:,' Stroke500mPace (sec/500m)'] > 3000
rowdatadf.loc[row_index,' Stroke500mPace (sec/500m)'] = 3000. rowdatadf.loc[row_index,' Stroke500mPace (sec/500m)'] = 3000.
p = rowdatadf.ix[:,' Stroke500mPace (sec/500m)'] p = rowdatadf.loc[:,' Stroke500mPace (sec/500m)']
try: try:
velo = rowdatadf.ix[:,' AverageBoatSpeed (m/s)'] velo = rowdatadf.loc[:,' AverageBoatSpeed (m/s)']
except KeyError: except KeyError:
velo = 500./p velo = 500./p
hr = rowdatadf.ix[:,' HRCur (bpm)'] hr = rowdatadf.loc[:,' HRCur (bpm)']
spm = rowdatadf.ix[:,' Cadence (stokes/min)'] spm = rowdatadf.loc[:,' Cadence (stokes/min)']
cumdist = rowdatadf.ix[:,'cum_dist'] cumdist = rowdatadf.loc[:,'cum_dist']
power = rowdatadf.ix[:,' Power (watts)'] power = rowdatadf.loc[:,' Power (watts)']
averageforce = rowdatadf.ix[:,' AverageDriveForce (lbs)'] averageforce = rowdatadf.loc[:,' AverageDriveForce (lbs)']
drivelength = rowdatadf.ix[:,' DriveLength (meters)'] drivelength = rowdatadf.loc[:,' DriveLength (meters)']
try: try:
workoutstate = rowdatadf.ix[:,' WorkoutState'] workoutstate = rowdatadf.loc[:,' WorkoutState']
except KeyError: except KeyError:
workoutstate = 0*hr workoutstate = 0*hr
peakforce = rowdatadf.ix[:,' PeakDriveForce (lbs)'] peakforce = rowdatadf.loc[:,' PeakDriveForce (lbs)']
forceratio = averageforce/peakforce forceratio = averageforce/peakforce
forceratio = forceratio.fillna(value=0) forceratio = forceratio.fillna(value=0)
try: try:
drivetime = rowdatadf.ix[:,' DriveTime (ms)'] drivetime = rowdatadf.loc[:,' DriveTime (ms)']
recoverytime = rowdatadf.ix[:,' StrokeRecoveryTime (ms)'] recoverytime = rowdatadf.loc[:,' StrokeRecoveryTime (ms)']
rhythm = 100.*drivetime/(recoverytime+drivetime) rhythm = 100.*drivetime/(recoverytime+drivetime)
rhythm = rhythm.fillna(value=0) rhythm = rhythm.fillna(value=0)
except: except:
@@ -1047,7 +1047,7 @@ def dataprep(rowdatadf,id=0,bands=True,barchart=True,otwpower=True,
else: else:
drivenergy = drivelength*averageforce drivenergy = drivelength*averageforce
distance = rowdatadf.ix[:,'cum_dist'] distance = rowdatadf.loc[:,'cum_dist']
velo = 500./p velo = 500./p
@@ -1081,23 +1081,23 @@ def dataprep(rowdatadf,id=0,bands=True,barchart=True,otwpower=True,
if bands: if bands:
# HR bands # HR bands
data['hr_ut2'] = rowdatadf.ix[:,'hr_ut2'] data['hr_ut2'] = rowdatadf.loc[:,'hr_ut2']
data['hr_ut1'] = rowdatadf.ix[:,'hr_ut1'] data['hr_ut1'] = rowdatadf.loc[:,'hr_ut1']
data['hr_at'] = rowdatadf.ix[:,'hr_at'] data['hr_at'] = rowdatadf.loc[:,'hr_at']
data['hr_tr'] = rowdatadf.ix[:,'hr_tr'] data['hr_tr'] = rowdatadf.loc[:,'hr_tr']
data['hr_an'] = rowdatadf.ix[:,'hr_an'] data['hr_an'] = rowdatadf.loc[:,'hr_an']
data['hr_max'] = rowdatadf.ix[:,'hr_max'] data['hr_max'] = rowdatadf.loc[:,'hr_max']
data['hr_bottom'] = 0.0*data['hr'] data['hr_bottom'] = 0.0*data['hr']
try: try:
tel = rowdatadf.ix[:,' ElapsedTime (sec)'] tel = rowdatadf.loc[:,' ElapsedTime (sec)']
except KeyError: except KeyError:
rowdatadf[' ElapsedTime (sec)'] = rowdatadf['TimeStamp (sec)'] rowdatadf[' ElapsedTime (sec)'] = rowdatadf['TimeStamp (sec)']
if barchart: if barchart:
# time increments for bar chart # time increments for bar chart
time_increments = rowdatadf.ix[:,' ElapsedTime (sec)'].diff() time_increments = rowdatadf.loc[:,' ElapsedTime (sec)'].diff()
time_increments[0] = time_increments[1] time_increments[0] = time_increments[1]
time_increments = 0.5*time_increments+0.5*np.abs(time_increments) time_increments = 0.5*time_increments+0.5*np.abs(time_increments)
x_right = (t2+time_increments.apply(lambda x:timedeltaconv(x))) x_right = (t2+time_increments.apply(lambda x:timedeltaconv(x)))
@@ -1106,29 +1106,29 @@ def dataprep(rowdatadf,id=0,bands=True,barchart=True,otwpower=True,
if empower: if empower:
try: try:
wash = rowdatadf.ix[:,'wash'] wash = rowdatadf.loc[:,'wash']
except KeyError: except KeyError:
wash = 0*t wash = 0*t
try: try:
catch = rowdatadf.ix[:,'catch'] catch = rowdatadf.loc[:,'catch']
except KeyError: except KeyError:
catch = 0*t catch = 0*t
try: try:
finish = rowdatadf.ix[:,'finish'] finish = rowdatadf.loc[:,'finish']
except KeyError: except KeyError:
finish = 0*t finish = 0*t
try: try:
peakforceangle = rowdatadf.ix[:,'peakforceangle'] peakforceangle = rowdatadf.loc[:,'peakforceangle']
except KeyError: except KeyError:
peakforceangle = 0*t peakforceangle = 0*t
if data['driveenergy'].mean() == 0: if data['driveenergy'].mean() == 0:
try: try:
driveenergy = rowdatadf.ix[:,'driveenergy'] driveenergy = rowdatadf.loc[:,'driveenergy']
except KeyError: except KeyError:
driveenergy = power*60/spm driveenergy = power*60/spm
else: else:
@@ -1142,7 +1142,7 @@ def dataprep(rowdatadf,id=0,bands=True,barchart=True,otwpower=True,
drivelength = driveenergy/(averageforce*4.44822) drivelength = driveenergy/(averageforce*4.44822)
try: try:
slip = rowdatadf.ix[:,'slip'] slip = rowdatadf.loc[:,'slip']
except KeyError: except KeyError:
slip = 0*t slip = 0*t
@@ -1216,11 +1216,11 @@ def dataprep(rowdatadf,id=0,bands=True,barchart=True,otwpower=True,
if otwpower: if otwpower:
try: try:
nowindpace = rowdatadf.ix[:,'nowindpace'] nowindpace = rowdatadf.loc[:,'nowindpace']
except KeyError: except KeyError:
nowindpace = p nowindpace = p
try: try:
equivergpower = rowdatadf.ix[:,'equivergpower'] equivergpower = rowdatadf.loc[:,'equivergpower']
except KeyError: except KeyError:
equivergpower = 0*p+50. equivergpower = 0*p+50.

View File

@@ -1468,7 +1468,7 @@ def handle_otwsetpower(self,f1, boattype, weightvalue,
delta, cpvalues, ps[0], ps[1], ps[2], ps[3], ratio) delta, cpvalues, ps[0], ps[1], ps[2], ps[3], ratio)
if res: if res:
handle_sendemail_breakthrough( handle_sendemail_breakthrough(
workoutid, email, encoder.decode_hex(workoutid), email,
first_name, first_name,
last_name, btvalues=btvalues.to_json()) last_name, btvalues=btvalues.to_json())

Binary file not shown.

View File

@@ -557,8 +557,13 @@ def get_job_status(jobid):
else: else:
try: try:
job = Job.fetch(jobid,connection=redis_connection) job = Job.fetch(jobid,connection=redis_connection)
try:
status = job.status
except AttributeError:
status = job.get_status()
summary = { summary = {
'status':job.status, 'status':status,
'result':job.result, 'result':job.result,
'started_at':job.started_at 'started_at':job.started_at
} }