Private
Public Access
1
0

Fixed dataprep

This commit is contained in:
Sander Roosendaal
2016-11-27 20:18:11 +01:00
parent b2267ca524
commit 75ddb92349
3 changed files with 10 additions and 24 deletions

View File

@@ -85,7 +85,7 @@ def rdata(file,rower=rrower()):
return res return res
def delete_strokedata(id): def delete_strokedata(id):
query = sa.text('DELETE FROM strokedata WHERE workoutid={id};'.format( query = sa.text('DELETE FROM strokedata * WHERE workoutid={id};'.format(
id=id, id=id,
)) ))
with engine.connect() as conn, conn.begin(): with engine.connect() as conn, conn.begin():
@@ -108,8 +108,6 @@ def getrowdata_db(id=0):
# data['ergpace'] = data['ergpace']/1.0e6 # data['ergpace'] = data['ergpace']/1.0e6
# data['nowindpace'] = data['nowindpace']/1.0e6 # data['nowindpace'] = data['nowindpace']/1.0e6
# data['time'] = data['time']/1.0e6 # data['time'] = data['time']/1.0e6
data['pace'] = data['pseconds']*1.0e3
data['time'] = data['timesecs']*1.0e3
data['x_right'] = data['x_right']/1.0e6 data['x_right'] = data['x_right']/1.0e6
if data.empty: if data.empty:
rowdata,row = getrowdata(id=id) rowdata,row = getrowdata(id=id)
@@ -126,13 +124,6 @@ def getsmallrowdata_db(columns,ids=[]):
prepmultipledata(ids) prepmultipledata(ids)
data = read_cols_df_sql(ids,columns) data = read_cols_df_sql(ids,columns)
print columns print columns
for column in columns:
if column == 'time':
data['time'] = data['timesecs']*1.0e3
# data['time'] = data['time']/1.0e6
if column == 'pace':
# data['pace'] = data['pace']/1.0e6
data['pace'] = data['pseconds']*1.0e3
return data return data
@@ -293,11 +284,9 @@ def dataprep(rowdatadf,id=0,bands=False,barchart=False,otwpower=False):
data = DataFrame( data = DataFrame(
dict( dict(
time = t2, time = t*1e3,
timesecs = t,
hr = hr, hr = hr,
pace = p2, pace = p*1e3,
pseconds=p,
spm = spm, spm = spm,
cumdist = cumdist, cumdist = cumdist,
ftime = niceformat(t2), ftime = niceformat(t2),

View File

@@ -929,10 +929,9 @@ def interactive_flex_chart2(id=0,promember=0,
pass pass
rowdata['x1'] = rowdata.ix[:,xparam] rowdata['x1'] = rowdata.ix[:,xparam]
rowdata['y1'] = rowdata.ix[:,yparam1] rowdata['y1'] = rowdata.ix[:,yparam1]
tseconds = rowdata.ix[:,'timesecs'] tseconds = rowdata.ix[:,'time']
if yparam2 != 'None': if yparam2 != 'None':
rowdata['y2'] = rowdata.ix[:,yparam2] rowdata['y2'] = rowdata.ix[:,yparam2]
@@ -940,8 +939,8 @@ def interactive_flex_chart2(id=0,promember=0,
rowdata['y2'] = rowdata['y1'] rowdata['y2'] = rowdata['y1']
if xparam=='time': if xparam=='time':
xaxmax = 1.0e3*tseconds.max() xaxmax = tseconds.max()
xaxmin = 1.0e3*tseconds.min() xaxmin = tseconds.min()
elif xparam=='distance': elif xparam=='distance':
xaxmax = rowdata['x1'].max() xaxmax = rowdata['x1'].max()
xaxmin = rowdata['x1'].min() xaxmin = rowdata['x1'].min()
@@ -975,7 +974,7 @@ def interactive_flex_chart2(id=0,promember=0,
if yparam1 == 'pace': if yparam1 == 'pace':
y_axis_type = 'datetime' y_axis_type = 'datetime'
y1mean = rowdata.ix[:,'pseconds'].mean() y1mean = rowdata.ix[:,'pace'].mean()
rowdata['xname'] = xparam rowdata['xname'] = xparam

View File

@@ -160,12 +160,10 @@ class StrokeData(models.Model):
db_table = 'strokedata' db_table = 'strokedata'
workoutid = models.IntegerField(null=True) workoutid = models.IntegerField(null=True)
time = models.TimeField(null=True) time = models.FloatField(null=True)
timesecs = models.FloatField(null=True)
hr = models.IntegerField(null=True) hr = models.IntegerField(null=True)
pace = models.TimeField(null=True) pace = models.FloatField(null=True)
workoutstate = models.IntegerField(null=True,default=1) workoutstate = models.IntegerField(null=True,default=1)
pseconds = models.FloatField(null=True)
spm = models.FloatField(null=True) spm = models.FloatField(null=True)
cumdist = models.FloatField(null=True) cumdist = models.FloatField(null=True)
ftime = models.CharField(max_length=30) ftime = models.CharField(max_length=30)