diff --git a/rowers/dataprep.py b/rowers/dataprep.py index cac18cc6..96444570 100644 --- a/rowers/dataprep.py +++ b/rowers/dataprep.py @@ -198,7 +198,12 @@ def get_video_data(w,groups=['basic'],mode='water'): if dict(rowingmetrics)[c]['numtype'] == 'integer': data[c] = df2[c].astype(int).tolist() else: - data[c] = df2[c].values.tolist() + sigfigs = dict(rowingmetrics)[c]['sigfigs'] + if (c != 'pace'): + da = ((10**sigfigs)*df2[c]).astype(int)/(10**sigfigs) + else: + da = df2[c] + data[c] = da.values.tolist() metrics[c] = { 'name': dict(rowingmetrics)[c]['verbose_name'], 'metric': c, diff --git a/rowers/metrics.py b/rowers/metrics.py index 57d2ba77..242cfe56 100644 --- a/rowers/metrics.py +++ b/rowers/metrics.py @@ -56,7 +56,8 @@ rowingmetrics = ( 'ax_max': 1e5, 'mode':'both', 'type': 'basic', - 'group':'basic'}), + 'group':'basic', + 'sigfigs': -1}), ('hr',{ 'numtype':'integer', @@ -66,7 +67,8 @@ rowingmetrics = ( 'ax_max': 200, 'mode':'both', 'type': 'basic', - 'group':'athlete'}), + 'group':'athlete', + 'sigfigs':0,}), ('pace',{ 'numtype':'float', @@ -76,6 +78,7 @@ rowingmetrics = ( 'ax_max': 1.0e3*75, 'mode':'both', 'type': 'basic', + 'sigfigs': 1, 'group': 'basic'}), ('velo',{ @@ -86,6 +89,7 @@ rowingmetrics = ( 'ax_max': 8, 'default': 0, 'mode':'both', + 'sigfigs': 1, 'type':'pro', 'group': 'basic'}), @@ -106,6 +110,7 @@ rowingmetrics = ( 'ax_min': 15, 'ax_max': 45, 'mode':'both', + 'sigfigs': 1, 'type': 'basic', 'group':'basic'}), @@ -116,6 +121,7 @@ rowingmetrics = ( 'ax_min': 0, 'ax_max': 1000, 'mode':'both', + 'sigfigs': 0, 'type': 'pro', 'group':'forcepower'}), @@ -126,6 +132,7 @@ rowingmetrics = ( 'ax_min': 0, 'ax_max': 600, 'mode':'both', + 'sigfigs': 0, 'type': 'basic', 'group':'forcepower'}), @@ -136,6 +143,7 @@ rowingmetrics = ( 'ax_min': 0, 'ax_max': 1200, 'mode':'both', + 'sigfigs': 0, 'type': 'pro', 'group':'forcepower'}), @@ -145,6 +153,7 @@ rowingmetrics = ( 'verbose_name': 'Peak Drive Force (N)', 'ax_min': 0, 'ax_max': 1500, + 'sigfigs': 0, 'mode':'both', 'type': 'pro', 'group':'forcepower'}), @@ -156,6 +165,7 @@ rowingmetrics = ( 'ax_min': 0, 'ax_max': 2.5, 'mode':'rower', + 'sigfigs': 2, 'type': 'pro', 'group':'stroke'}), @@ -165,6 +175,7 @@ rowingmetrics = ( 'verbose_name': 'Average/Peak Force Ratio', 'ax_min': 0, 'ax_max': 1, + 'sigfigs': 2, 'mode':'both', 'type': 'pro', 'group': 'forcepower'}), @@ -175,6 +186,7 @@ rowingmetrics = ( 'verbose_name': 'Interval Distance (m)', 'ax_min': 0, 'ax_max': 1e5, + 'sigfigs': 0, 'mode':'both', 'type': 'basic', 'group':'basic'}), @@ -186,6 +198,7 @@ rowingmetrics = ( 'ax_min': 0, 'ax_max': 1e5, 'mode':'both', + 'sigfigs': 0, 'type': 'basic', 'group':'basic'}), @@ -196,10 +209,12 @@ rowingmetrics = ( 'ax_min': 0, 'ax_max': 4, 'default': 0, + 'sigfigs': 2, 'mode':'both', 'type': 'pro', 'group': 'stroke'}), + ('catch',{ 'numtype':'float', 'null':True, @@ -207,6 +222,7 @@ rowingmetrics = ( 'ax_min': -40, 'ax_max': -75, 'default': 0, + 'sigfigs': 0, 'mode':'water', 'type': 'pro', 'group': 'stroke'}), @@ -218,6 +234,7 @@ rowingmetrics = ( 'ax_min': 0, 'ax_max': 20, 'default': 0, + 'sigfigs': 1, 'mode':'water', 'type': 'pro', 'group': 'stroke'}), @@ -229,6 +246,7 @@ rowingmetrics = ( 'ax_min': 20, 'ax_max': 55, 'default': 0, + 'sigfigs': 0, 'mode':'water', 'type': 'pro', 'group': 'stroke'}), @@ -240,6 +258,7 @@ rowingmetrics = ( 'ax_min': 0, 'ax_max': 30, 'default': 0, + 'sigfigs': 0, 'mode':'water', 'type': 'pro', 'group': 'stroke'}), @@ -251,6 +270,7 @@ rowingmetrics = ( 'ax_min': -50, 'ax_max': 50, 'default': 0, + 'sigfigs': 0, 'mode':'water', 'type': 'pro', 'group':'stroke'}), @@ -263,6 +283,7 @@ rowingmetrics = ( 'ax_min': 40, 'ax_max': 140, 'default': 0, + 'sigfigs': 0, 'mode':'water', 'type': 'pro', 'group':'stroke'}), @@ -275,6 +296,7 @@ rowingmetrics = ( 'ax_min': 40, 'ax_max': 140, 'default': 0, + 'sigfigs': 0, 'mode':'water', 'type': 'pro', 'group':'stroke'}), @@ -286,6 +308,7 @@ rowingmetrics = ( 'ax_min': 20, 'ax_max': 55, 'default': 1.0, + 'sigfigs': 0, 'mode':'erg', 'type': 'pro', 'group':'stroke'}), @@ -297,6 +320,7 @@ rowingmetrics = ( 'ax_min': 0, 'ax_max': 110, 'default': 0, + 'sigfigs': 0, 'mode':'water', 'type': 'pro', 'group':'forcepower'}), @@ -308,6 +332,7 @@ rowingmetrics = ( 'ax_min': 0, 'ax_max': 15, 'default': 0, + 'sigfigs': 1, 'mode':'both', 'type': 'basic', 'group':'basic'}), diff --git a/rowers/templates/embedded_video.html b/rowers/templates/embedded_video.html index 374bc716..bc5df91e 100644 --- a/rowers/templates/embedded_video.html +++ b/rowers/templates/embedded_video.html @@ -314,15 +314,43 @@