Private
Public Access
1
0

All Interactive plots now use the dataprep functions

This commit is contained in:
sanderroosendaal
2016-11-03 10:26:59 +01:00
parent 902357ba5c
commit 8a0518d7eb
4 changed files with 125 additions and 248 deletions

View File

@@ -79,7 +79,7 @@ def getrowdata(id=0):
return rowdata,row
def dataprep(rowdatadf):
def dataprep(rowdatadf,bands=False,barchart=False,otwpower=False):
rowdatadf.set_index([range(len(rowdatadf))],inplace=True)
t = rowdatadf.ix[:,'TimeStamp (sec)']
t = pd.Series(t-rowdatadf.ix[0,'TimeStamp (sec)'])
@@ -120,6 +120,9 @@ def dataprep(rowdatadf):
driveenergy = drivelength*averageforce*4.44822
distance = rowdatadf.ix[:,'cum_dist']
data = DataFrame(
dict(
time = t2,
@@ -137,8 +140,50 @@ def dataprep(rowdatadf):
drivelength=drivelength,
peakforce=peakforce,
distance=distance,
drivespeed=drivespeed
drivespeed=drivespeed,
)
)
if bands:
# HR bands
data['hr_ut2'] = rowdatadf.ix[:,'hr_ut2']
data['hr_ut1'] = rowdatadf.ix[:,'hr_ut1']
data['hr_at'] = rowdatadf.ix[:,'hr_at']
data['hr_tr'] = rowdatadf.ix[:,'hr_tr']
data['hr_an'] = rowdatadf.ix[:,'hr_an']
data['hr_max'] = rowdatadf.ix[:,'hr_max']
data['hr_bottom'] = 0.0*data['hr']
if barchart:
# time increments for bar chart
time_increments = rowdatadf.ix[:,' ElapsedTime (sec)'].diff()
time_increments[0] = time_increments[1]
time_increments = 0.5*time_increments+0.5*np.abs(time_increments)
x_right = (t2+time_increments.apply(lambda x:timedeltaconv(x)))
data['x_right'] = x_right
if otwpower:
try:
nowindpace = rowdatadf.ix[:,'nowindpace']
except KeyError:
nowindpace = p
try:
equivergpower = rowdatadf.ix[:,'equivergpower']
except KeyError:
equivergpower = 0*p+50.
nowindpace = nowindpace.apply(lambda x: timedeltaconv(x))
ergvelo = (equivergpower/2.8)**(1./3.)
ergpace = 500./ergvelo
ergpace[ergpace == np.inf] = 240.
ergpace = ergpace.apply(lambda x: timedeltaconv(x))
data['ergpace'] = ergpace
data['nowindpace'] = nowindpace
data['equivergpower'] = equivergpower
data['fergpace'] = nicepaceformat(ergpace)
data['fnowindpace'] = nicepaceformat(nowindpace)
return data