data fusion now working ...
This commit is contained in:
@@ -959,35 +959,41 @@ def smalldataprep(therows,xparam,yparam1,yparam2):
|
||||
# data fusion
|
||||
def datafusion(id1,id2,columns,offset):
|
||||
df1,w1 = getrowdata_db(id=id1)
|
||||
df1 = df1.drop(['cumdist',
|
||||
df1 = df1.drop([#'cumdist',
|
||||
'hr_ut2',
|
||||
'hr_ut1',
|
||||
'hr_at',
|
||||
'hr_tr',
|
||||
'hr_an',
|
||||
'hr_max',],
|
||||
'hr_max',
|
||||
'ftime',
|
||||
'fpace',
|
||||
'workoutid',
|
||||
'id'],
|
||||
1,errors='ignore')
|
||||
columns = ['time']+columns
|
||||
df2 = getsmallrowdata_db(columns,ids=[id2],doclean=False)
|
||||
|
||||
print df1['pace'].mean()/1000.,'mies'
|
||||
|
||||
df2 = getsmallrowdata_db(['time']+columns,ids=[id2],doclean=False)
|
||||
offsetmillisecs = offset.seconds*1000+offset.microseconds/1000.
|
||||
offsetmillisecs += offset.days*(3600*24*1000)
|
||||
df2['time'] = df2['time']+offsetmillisecs
|
||||
|
||||
keep1 = {c:c for c in set(df1.columns)}
|
||||
for c in columns:
|
||||
keep1.pop(c)
|
||||
|
||||
|
||||
for c in df1.columns:
|
||||
if not c in keep1:
|
||||
df1 = df1.drop(c,1,errors='ignore')
|
||||
|
||||
df = pd.concat([df1,df2],ignore_index=True)
|
||||
df = df.sort_values(['time'])
|
||||
df = df.interpolate(method='linear',axis=0,limit_direction='both')
|
||||
df = df.interpolate(method='linear',axis=0,limit_direction='both',
|
||||
limit=10)
|
||||
df.fillna(method='bfill',inplace=True)
|
||||
|
||||
df['time'] = df['time']/1000.
|
||||
df['pace'] = df['pace']/1000.
|
||||
print df['pace'].mean(),'noot'
|
||||
df['cum_dist'] = df['cumdist']
|
||||
|
||||
return df
|
||||
|
||||
@@ -1005,7 +1011,6 @@ def dataprep(rowdatadf,id=0,bands=True,barchart=True,otwpower=True,
|
||||
rowdatadf.loc[row_index,' Stroke500mPace (sec/500m)'] = 3000.
|
||||
|
||||
p = rowdatadf.ix[:,' Stroke500mPace (sec/500m)']
|
||||
print p.mean(),'aap'
|
||||
hr = rowdatadf.ix[:,' HRCur (bpm)']
|
||||
spm = rowdatadf.ix[:,' Cadence (stokes/min)']
|
||||
cumdist = rowdatadf.ix[:,'cum_dist']
|
||||
|
||||
Reference in New Issue
Block a user