adding external yaml for rowing metrics
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
|
||||
from rowers.utils import lbstoN
|
||||
import numpy as np
|
||||
|
||||
import yaml
|
||||
import pandas as pd
|
||||
from scipy import optimize
|
||||
from django.utils import timezone
|
||||
@@ -44,335 +44,16 @@ nometrics = [
|
||||
'cum_dist.1'
|
||||
]
|
||||
|
||||
rowingmetrics = (
|
||||
('time', {
|
||||
'numtype': 'float',
|
||||
'null': True,
|
||||
'verbose_name': 'Time',
|
||||
'ax_min': 0,
|
||||
'ax_max': 1e5,
|
||||
'mode': 'both',
|
||||
'type': 'basic',
|
||||
'group': 'basic',
|
||||
'maysmooth': False,
|
||||
'sigfigs': -1}),
|
||||
|
||||
('hr', {
|
||||
'numtype': 'integer',
|
||||
'null': True,
|
||||
'verbose_name': 'Heart Rate (bpm)',
|
||||
'ax_min': 100,
|
||||
'ax_max': 200,
|
||||
'mode': 'both',
|
||||
'type': 'basic',
|
||||
'maysmooth': False,
|
||||
'group': 'athlete',
|
||||
'sigfigs': 0, }),
|
||||
|
||||
('pace', {
|
||||
'numtype': 'float',
|
||||
'null': True,
|
||||
'verbose_name': 'Pace (/500m)',
|
||||
'ax_min': 1.0e3*210,
|
||||
'ax_max': 1.0e3*75,
|
||||
'mode': 'both',
|
||||
'type': 'basic',
|
||||
'sigfigs': 1,
|
||||
'maysmooth': True,
|
||||
'group': 'basic'}),
|
||||
|
||||
('velo', {
|
||||
'numtype': 'float',
|
||||
'null': True,
|
||||
'verbose_name': 'Boat Speed (m/s)',
|
||||
'ax_min': 0,
|
||||
'ax_max': 8,
|
||||
'default': 0,
|
||||
'mode': 'both',
|
||||
'sigfigs': 1,
|
||||
'maysmooth': True,
|
||||
'type': 'pro',
|
||||
'group': 'basic'}),
|
||||
|
||||
# ('powerhr',{
|
||||
# 'numtype':'float',
|
||||
# 'null':True,
|
||||
# 'verbose_name': 'Power Heart Rate Efficiency (J/beat)',
|
||||
# 'ax_min':0,
|
||||
# 'ax_max':300,
|
||||
# 'mode':'both',
|
||||
# 'type':'pro',
|
||||
# 'group':'athlete'}),
|
||||
|
||||
('spm', {
|
||||
'numtype': 'float',
|
||||
'null': True,
|
||||
'verbose_name': 'Stroke Rate (spm)',
|
||||
'ax_min': 15,
|
||||
'ax_max': 45,
|
||||
'mode': 'both',
|
||||
'sigfigs': 1,
|
||||
'type': 'basic',
|
||||
'maysmooth': True,
|
||||
'group': 'basic'}),
|
||||
|
||||
('driveenergy', {
|
||||
'numtype': 'float',
|
||||
'null': True,
|
||||
'verbose_name': 'Work Per Stroke (J)',
|
||||
'ax_min': 0,
|
||||
'ax_max': 1000,
|
||||
'mode': 'both',
|
||||
'sigfigs': 0,
|
||||
'type': 'pro',
|
||||
'maysmooth': True,
|
||||
'group': 'forcepower'}),
|
||||
|
||||
('power', {
|
||||
'numtype': 'float',
|
||||
'null': True,
|
||||
'verbose_name': 'Power (W)',
|
||||
'ax_min': 0,
|
||||
'ax_max': 600,
|
||||
'mode': 'both',
|
||||
'sigfigs': 0,
|
||||
'type': 'basic',
|
||||
'maysmooth': True,
|
||||
'group': 'forcepower'}),
|
||||
|
||||
('averageforce', {
|
||||
'numtype': 'float',
|
||||
'null': True,
|
||||
'verbose_name': 'Average Drive Force (N)',
|
||||
'ax_min': 0,
|
||||
'ax_max': 1200,
|
||||
'mode': 'both',
|
||||
'sigfigs': 0,
|
||||
'maysmooth': True,
|
||||
'type': 'pro',
|
||||
'group': 'forcepower'}),
|
||||
|
||||
('peakforce', {
|
||||
'numtype': 'float',
|
||||
'null': True,
|
||||
'verbose_name': 'Peak Drive Force (N)',
|
||||
'ax_min': 0,
|
||||
'ax_max': 1500,
|
||||
'sigfigs': 0,
|
||||
'mode': 'both',
|
||||
'maysmooth': True,
|
||||
'type': 'pro',
|
||||
'group': 'forcepower'}),
|
||||
|
||||
('drivelength', {
|
||||
'numtype': 'float',
|
||||
'null': True,
|
||||
'verbose_name': 'Drive Length (m)',
|
||||
'ax_min': 0,
|
||||
'ax_max': 2.5,
|
||||
'mode': 'rower',
|
||||
'sigfigs': 2,
|
||||
'maysmooth': False,
|
||||
'type': 'pro',
|
||||
'group': 'stroke'}),
|
||||
|
||||
('forceratio', {
|
||||
'numtype': 'float',
|
||||
'null': True,
|
||||
'verbose_name': 'Average/Peak Force Ratio',
|
||||
'ax_min': 0,
|
||||
'ax_max': 1,
|
||||
'sigfigs': 2,
|
||||
'maysmooth': True,
|
||||
'mode': 'both',
|
||||
'type': 'pro',
|
||||
'group': 'forcepower'}),
|
||||
|
||||
('distance', {
|
||||
'numtype': 'float',
|
||||
'null': True,
|
||||
'verbose_name': 'Interval Distance (m)',
|
||||
'ax_min': 0,
|
||||
'ax_max': 1e5,
|
||||
'sigfigs': 0,
|
||||
'mode': 'both',
|
||||
'maysmooth': False,
|
||||
'type': 'basic',
|
||||
'group': 'basic'}),
|
||||
|
||||
('cumdist', {
|
||||
'numtype': 'float',
|
||||
'null': True,
|
||||
'verbose_name': 'Cumulative Distance (m)',
|
||||
'ax_min': 0,
|
||||
'ax_max': 1e5,
|
||||
'mode': 'both',
|
||||
'sigfigs': 0,
|
||||
'maysmooth': False,
|
||||
'type': 'basic',
|
||||
'group': 'basic'}),
|
||||
|
||||
('drivespeed', {
|
||||
'numtype': 'float',
|
||||
'null': True,
|
||||
'verbose_name': 'Drive Speed (m/s)',
|
||||
'ax_min': 0,
|
||||
'ax_max': 4,
|
||||
'default': 0,
|
||||
'sigfigs': 2,
|
||||
'maysmooth': True,
|
||||
'mode': 'both',
|
||||
'type': 'pro',
|
||||
'group': 'stroke'}),
|
||||
|
||||
|
||||
('catch', {
|
||||
'numtype': 'float',
|
||||
'null': True,
|
||||
'verbose_name': 'Catch Angle (degrees)',
|
||||
'ax_min': -40,
|
||||
'ax_max': -75,
|
||||
'default': 0,
|
||||
'sigfigs': 0,
|
||||
'mode': 'water',
|
||||
'maysmooth': True,
|
||||
'type': 'pro',
|
||||
'group': 'stroke'}),
|
||||
|
||||
('slip', {
|
||||
'numtype': 'float',
|
||||
'null': True,
|
||||
'verbose_name': 'Slip (degrees)',
|
||||
'ax_min': 0,
|
||||
'ax_max': 20,
|
||||
'default': 0,
|
||||
'sigfigs': 1,
|
||||
'maysmooth': True,
|
||||
'mode': 'water',
|
||||
'type': 'pro',
|
||||
'group': 'stroke'}),
|
||||
|
||||
('finish', {
|
||||
'numtype': 'float',
|
||||
'null': True,
|
||||
'verbose_name': 'Finish Angle (degrees)',
|
||||
'ax_min': 20,
|
||||
'ax_max': 55,
|
||||
'default': 0,
|
||||
'sigfigs': 0,
|
||||
'maysmooth': True,
|
||||
'mode': 'water',
|
||||
'type': 'pro',
|
||||
'group': 'stroke'}),
|
||||
|
||||
('wash', {
|
||||
'numtype': 'float',
|
||||
'null': True,
|
||||
'verbose_name': 'Wash (degrees)',
|
||||
'ax_min': 0,
|
||||
'ax_max': 30,
|
||||
'default': 0,
|
||||
'sigfigs': 1,
|
||||
'maysmooth': True,
|
||||
'mode': 'water',
|
||||
'type': 'pro',
|
||||
'group': 'stroke'}),
|
||||
|
||||
('peakforceangle', {
|
||||
'numtype': 'float',
|
||||
'null': True,
|
||||
'verbose_name': 'Peak Force Angle',
|
||||
'ax_min': -50,
|
||||
'ax_max': 50,
|
||||
'default': 0,
|
||||
'sigfigs': 0,
|
||||
'maysmooth': True,
|
||||
'mode': 'water',
|
||||
'type': 'pro',
|
||||
'group': 'stroke'}),
|
||||
|
||||
|
||||
('totalangle', {
|
||||
'numtype': 'float',
|
||||
'null': True,
|
||||
'verbose_name': 'Drive Length (deg)',
|
||||
'ax_min': 40,
|
||||
'ax_max': 140,
|
||||
'default': 0,
|
||||
'sigfigs': 0,
|
||||
'maysmooth': True,
|
||||
'mode': 'water',
|
||||
'type': 'pro',
|
||||
'group': 'stroke'}),
|
||||
|
||||
('check_factor', {
|
||||
'numtype': 'float',
|
||||
'null': True,
|
||||
'verbose_name': 'Check Factor',
|
||||
'ax_min': 0,
|
||||
'ax_max': 100,
|
||||
'default': 0,
|
||||
'sigfigs': 1,
|
||||
'maysmooth': True,
|
||||
'mode': 'water',
|
||||
'type': 'pro',
|
||||
'group': 'stroke'}),
|
||||
|
||||
|
||||
('effectiveangle', {
|
||||
'numtype': 'float',
|
||||
'null': True,
|
||||
'verbose_name': 'Effective Drive Length (deg)',
|
||||
'ax_min': 40,
|
||||
'ax_max': 140,
|
||||
'default': 0,
|
||||
'sigfigs': 0,
|
||||
'mode': 'water',
|
||||
'maysmooth': True,
|
||||
'type': 'pro',
|
||||
'group': 'stroke'}),
|
||||
|
||||
('rhythm', {
|
||||
'numtype': 'float',
|
||||
'null': True,
|
||||
'verbose_name': 'Stroke Rhythm',
|
||||
'ax_min': 20,
|
||||
'ax_max': 55,
|
||||
'default': 1.0,
|
||||
'sigfigs': 0,
|
||||
'mode': 'erg',
|
||||
'maysmooth': True,
|
||||
'type': 'pro',
|
||||
'group': 'stroke'}),
|
||||
|
||||
('efficiency', {
|
||||
'numtype': 'float',
|
||||
'null': True,
|
||||
'verbose_name': 'OTW Efficiency (%)',
|
||||
'ax_min': 0,
|
||||
'ax_max': 110,
|
||||
'default': 0,
|
||||
'sigfigs': 0,
|
||||
'mode': 'water',
|
||||
'maysmooth': True,
|
||||
'type': 'pro',
|
||||
'group': 'forcepower'}),
|
||||
|
||||
('distanceperstroke', {
|
||||
'numtype': 'float',
|
||||
'null': True,
|
||||
'verbose_name': 'Distance per Stroke (m)',
|
||||
'ax_min': 0,
|
||||
'ax_max': 15,
|
||||
'default': 0,
|
||||
'sigfigs': 1,
|
||||
'maysmooth': True,
|
||||
'mode': 'both',
|
||||
'type': 'basic',
|
||||
'group': 'basic'}),
|
||||
with open("rowingmetrics.yaml", "r") as file:
|
||||
td = yaml.safe_load(file)
|
||||
|
||||
rowingmetrics = tuple(
|
||||
(key, value)
|
||||
for key, value in td.items()
|
||||
)
|
||||
|
||||
|
||||
|
||||
metricsdicts = {}
|
||||
for key, dict in rowingmetrics:
|
||||
metricsdicts[key] = dict
|
||||
|
||||
Reference in New Issue
Block a user