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
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,
))
with engine.connect() as conn, conn.begin():
@@ -108,8 +108,6 @@ def getrowdata_db(id=0):
# data['ergpace'] = data['ergpace']/1.0e6
# data['nowindpace'] = data['nowindpace']/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
if data.empty:
rowdata,row = getrowdata(id=id)
@@ -126,13 +124,6 @@ def getsmallrowdata_db(columns,ids=[]):
prepmultipledata(ids)
data = read_cols_df_sql(ids,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
@@ -293,11 +284,9 @@ def dataprep(rowdatadf,id=0,bands=False,barchart=False,otwpower=False):
data = DataFrame(
dict(
time = t2,
timesecs = t,
time = t*1e3,
hr = hr,
pace = p2,
pseconds=p,
pace = p*1e3,
spm = spm,
cumdist = cumdist,
ftime = niceformat(t2),

View File

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

View File

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