split seems to be working now
This commit is contained in:
@@ -828,7 +828,34 @@ def split_workout(r,parent,splitsecond,splitmode):
|
||||
data1 = data[data['time']<=splitsecond].copy()
|
||||
data2 = data[data['time']>splitsecond].copy()
|
||||
|
||||
data1 = data1.sort_values(['time'])
|
||||
data1 = data1.interpolate(method='linear',axis=0,limit_direction='both',
|
||||
limit=10)
|
||||
data1.fillna(method='bfill',inplace=True)
|
||||
|
||||
# Some new stuff to try out
|
||||
data1 = data1.groupby('time',axis=0).mean()
|
||||
data1['time'] = data1.index
|
||||
data1.reset_index(drop=True,inplace=True)
|
||||
|
||||
|
||||
data2 = data2.sort_values(['time'])
|
||||
data2 = data2.interpolate(method='linear',axis=0,limit_direction='both',
|
||||
limit=10)
|
||||
data2.fillna(method='bfill',inplace=True)
|
||||
|
||||
# Some new stuff to try out
|
||||
data2 = data2.groupby('time',axis=0).mean()
|
||||
data2['time'] = data2.index
|
||||
data2.reset_index(drop=True,inplace=True)
|
||||
|
||||
data1['pace'] = data1['pace']/1000.
|
||||
data2['pace'] = data2['pace']/1000.
|
||||
|
||||
|
||||
data1.drop_duplicates(subset='time',inplace=True)
|
||||
data2.drop_duplicates(subset='time',inplace=True)
|
||||
|
||||
messages = []
|
||||
ids = []
|
||||
|
||||
@@ -839,8 +866,9 @@ def split_workout(r,parent,splitsecond,splitmode):
|
||||
messages.append(message)
|
||||
ids.append(id)
|
||||
if 'keep second' in splitmode:
|
||||
data2['cumdist'] = data2['cumdist'] - data2['cumdist'].min()
|
||||
data2['time'] = data2['time'] - data2['time'].min()
|
||||
data2['cumdist'] = data2['cumdist'] - data2.ix[0,'cumdist']
|
||||
data2['distance'] = data2['distance'] - data2.ix[0,'distance']
|
||||
data2['time'] = data2['time'] - data2.ix[0,'time']
|
||||
id,message = new_workout_from_df(r,data2,
|
||||
title=parent.name+' Second Part',
|
||||
parent=parent)
|
||||
@@ -893,6 +921,7 @@ def new_workout_from_df(r,df,
|
||||
|
||||
starttimeunix = mktime(startdatetime.utctimetuple())
|
||||
df[' ElapsedTime (sec)'] = df['TimeStamp (sec)']
|
||||
print df[' ElapsedTime (sec)'].values
|
||||
df['TimeStamp (sec)'] = df['TimeStamp (sec)']+starttimeunix
|
||||
|
||||
row = rrdata(df=df)
|
||||
|
||||
Reference in New Issue
Block a user