Private
Public Access
1
0
This commit is contained in:
Sander Roosendaal
2017-05-23 22:05:25 +02:00
parent f6070e985f
commit eea087f4ee
2 changed files with 34 additions and 20 deletions

View File

@@ -111,6 +111,7 @@ def filter_df(datadf,fieldname,value,largerthan=True):
except KeyError:
return datadf
if largerthan:
mask = datadf[fieldname] < value
else:
@@ -144,6 +145,7 @@ def clean_df_stats(datadf,workstrokesonly=True,ignorehr=True,
datadf=datadf.clip(lower=0)
datadf.replace(to_replace=0,value=np.nan,inplace=True)
# return from positive domain to negative
try:
datadf['catch'] = -datadf['catch']
@@ -900,7 +902,7 @@ def getsmallrowdata_db(columns,ids=[],doclean=True,workstrokesonly=True,
convertnewtons=False):
prepmultipledata(ids)
data = read_cols_df_sql(ids,columns)
if convertnewtons:
if 'peakforce' in columns:
data['peakforce'] = data['peakforce']*lbstoN
@@ -1206,9 +1208,7 @@ def dataprep(rowdatadf,id=0,bands=True,barchart=True,otwpower=True,
driveenergy = drivelength*averageforce*lbstoN
distance = rowdatadf.ix[:,'cum_dist']
data = DataFrame(
dict(
time = t*1e3,
@@ -1231,7 +1231,6 @@ def dataprep(rowdatadf,id=0,bands=True,barchart=True,otwpower=True,
)
)
if bands:
# HR bands
data['hr_ut2'] = rowdatadf.ix[:,'hr_ut2']
@@ -1272,11 +1271,16 @@ def dataprep(rowdatadf,id=0,bands=True,barchart=True,otwpower=True,
except KeyError:
peakforceangle = 0*power
try:
driveenergy = rowdatadf.ix[:,'driveenergy']
except KeyError:
driveenergy = 0*power
if data['driveenergy'].mean() == 0:
try:
driveenergy = rowdatadf.ix[:,'driveenergy']
except KeyError:
driveenergy = 0*power
else:
driveenergy = data['driveenergy']
arclength = (inboard-0.05)*(np.radians(finish)-np.radians(catch))
if arclength.mean()>0:
drivelength = arclength
@@ -1336,7 +1340,7 @@ def dataprep(rowdatadf,id=0,bands=True,barchart=True,otwpower=True,
data = data.replace([-np.inf,np.inf],np.nan)
data = data.fillna(method='ffill')
# write data if id given
if id != 0:
data['workoutid'] = id