From e1f937810749dde918a0fb7763008ef18ab58978 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Tue, 23 May 2017 20:19:11 +0200 Subject: [PATCH] bugfix drive length --- rowers/dataprep.py | 8 ++++++-- rowers/interactiveplots.py | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/rowers/dataprep.py b/rowers/dataprep.py index ec6a050e..411449cf 100644 --- a/rowers/dataprep.py +++ b/rowers/dataprep.py @@ -273,6 +273,7 @@ def clean_df_stats(datadf,workstrokesonly=True,ignorehr=True, pass + try: mask = datadf['catch'] > -30. datadf.loc[mask,'catch'] = np.nan @@ -899,7 +900,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 @@ -910,6 +911,8 @@ def getsmallrowdata_db(columns,ids=[],doclean=True,workstrokesonly=True, data = clean_df_stats(data,ignorehr=True, workstrokesonly=workstrokesonly) + + return data # Fetch both the workout and the workout stroke data (from CSV file) @@ -1228,6 +1231,7 @@ def dataprep(rowdatadf,id=0,bands=True,barchart=True,otwpower=True, ) ) + if bands: # HR bands data['hr_ut2'] = rowdatadf.ix[:,'hr_ut2'] @@ -1276,7 +1280,7 @@ def dataprep(rowdatadf,id=0,bands=True,barchart=True,otwpower=True, arclength = (inboard-0.05)*(np.radians(finish)-np.radians(catch)) if arclength.mean()>0: drivelength = arclength - else: + elif drivelength.mean() == 0: drivelength = driveenergy/(averageforce*4.44822) try: diff --git a/rowers/interactiveplots.py b/rowers/interactiveplots.py index 3f714568..7f640cee 100644 --- a/rowers/interactiveplots.py +++ b/rowers/interactiveplots.py @@ -1390,6 +1390,7 @@ def interactive_flex_chart2(id=0,promember=0, rowdata = dataprep.getsmallrowdata_db(columns,ids=[id],doclean=True, workstrokesonly=workstrokesonly) + try: tests = rowdata[yparam2] except KeyError: @@ -1442,7 +1443,8 @@ def interactive_flex_chart2(id=0,promember=0, tseconds = rowdata.ix[:,'time'] except KeyError: return '','No time data - cannot make flex plot','','' - + + try: rowdata['x1'] = rowdata.ix[:,xparam] except KeyError: