diff --git a/rowers/dataprep.py b/rowers/dataprep.py
index 816f08cf..1ca10023 100644
--- a/rowers/dataprep.py
+++ b/rowers/dataprep.py
@@ -478,6 +478,7 @@ def read_cols_df_sql(ids,columns):
connection = engine.raw_connection()
df = pd.read_sql_query(query,engine)
+ df = df.fillna(value=0)
engine.dispose()
return df
@@ -489,6 +490,7 @@ def read_df_sql(id):
id=id)), engine)
engine.dispose()
+ df = df.fillna(value=0)
return df
# Get the necessary data from the strokedata table in the DB.
@@ -562,7 +564,15 @@ def dataprep(rowdatadf,id=0,bands=True,barchart=True,otwpower=True,
forceratio = averageforce/peakforce
forceratio = forceratio.fillna(value=0)
-
+
+ try:
+ drivetime = rowdatadf.ix[:,' DriveTime (ms)']
+ recoverytime = rowdatadf.ix[:,' StrokeRecoveryTime (ms)']
+ rhythm = 100.*drivetime/(recoverytime+drivetime)
+ rhythm = rhythm.fillna(value=0)
+ except:
+ rhythm = 0.0*forceratio
+
f = rowdatadf['TimeStamp (sec)'].diff().mean()
windowsize = 2*(int(10./(f)))+1
if windowsize <= 3:
@@ -612,6 +622,7 @@ def dataprep(rowdatadf,id=0,bands=True,barchart=True,otwpower=True,
forceratio=forceratio,
distance=distance,
drivespeed=drivespeed,
+ rhythm=rhythm,
)
)
diff --git a/rowers/interactiveplots.py b/rowers/interactiveplots.py
index 0dc9ba73..0c4b1b49 100644
--- a/rowers/interactiveplots.py
+++ b/rowers/interactiveplots.py
@@ -68,6 +68,7 @@ axlabels = {
'finish': 'Finish (degrees)',
'wash': 'Wash (degrees)',
'peakforceangle': 'Peak Force Angle (degrees)',
+ 'rhythm': 'Stroke Rhythm (%)',
'None': '',
}
@@ -87,6 +88,7 @@ yaxminima = {
'finish': 20,
'wash': 0,
'peakforceangle': -20,
+ 'rhythm':20,
}
yaxmaxima = {
@@ -105,6 +107,7 @@ yaxmaxima = {
'finish': 55,
'wash': 30,
'peakforceangle': 20,
+ 'rhythm':55,
}
def tailwind(bearing,vwind,winddir):
diff --git a/rowers/models.py b/rowers/models.py
index d2ab57c9..430c474b 100644
--- a/rowers/models.py
+++ b/rowers/models.py
@@ -339,6 +339,7 @@ class StrokeData(models.Model):
finish = models.FloatField(default=0,null=True)
wash = models.FloatField(default=0,null=True)
peakforceangle = models.FloatField(default=0,null=True)
+ rhythm = models.FloatField(default=1.0,null=True)
# A wrapper around the png files
class GraphImage(models.Model):
diff --git a/rowers/templates/flexchart3.html b/rowers/templates/flexchart3.html
index 6a8b6d35..1fac349a 100644
--- a/rowers/templates/flexchart3.html
+++ b/rowers/templates/flexchart3.html
@@ -92,6 +92,7 @@
Drive Length
Work per Stroke
Drive Speed
+ Stroke Rhythm
{% else %}
Peak Force (Pro)
Average Force (Pro)
@@ -99,6 +100,7 @@
Drive Length (Pro)
Work per Stroke (Pro)
Drive Speed (Pro)
+ Stroke Rhytm (Pro)
{% endif %}
@@ -117,6 +119,7 @@
Drive Length
Work per Stroke
Drive Speed
+ Drive Rhythm
{% else %}
Peak Force (Pro)
Average Force (Pro)
@@ -124,6 +127,7 @@
Drive Length (Pro)
Work per Stroke (Pro)
Drive Speed (Pro)
+ Drive Rhythm (Pro)
{% endif %}
None
diff --git a/rowers/templates/flexchart3otw.html b/rowers/templates/flexchart3otw.html
index 67ab99b7..40738d31 100644
--- a/rowers/templates/flexchart3otw.html
+++ b/rowers/templates/flexchart3otw.html
@@ -104,6 +104,7 @@
Drive Length
Work per Stroke
Drive Speed
+ Drive Rhythm
Catch Angle
Finish Angle
@@ -117,6 +118,7 @@
Drive Length (Pro)
Work per Stroke (Pro)
Drive Speed (Pro)
+ Drive Rhythm (Pro)
Catch Angle (Pro)
Finish Angle(Pro)
@@ -141,6 +143,7 @@
Drive Length
Work per Stroke
Drive Speed
+ Drive Rhythm
Catch Angle
Finish Angle
@@ -154,6 +157,7 @@
Drive Length (Pro)
Work per Stroke (Pro)
Drive Speed (Pro)
+ Drive Rhythm (Pro)
Catch Angle (Pro)
Finish Angle (Pro)
Slip (Pro)