Private
Public Access
1
0

all forces now in newton

This commit is contained in:
Sander Roosendaal
2017-04-26 11:26:04 +02:00
parent c2264857b5
commit a6cb3d5140
5 changed files with 34 additions and 9 deletions

View File

@@ -43,12 +43,15 @@ from sqlalchemy import create_engine
import sqlalchemy as sa
import sys
from utils import lbstoN
import django_rq
queue = django_rq.get_queue('default')
queuelow = django_rq.get_queue('low')
queuehigh = django_rq.get_queue('default')
user = settings.DATABASES['default']['USER']
password = settings.DATABASES['default']['PASSWORD']
database_name = settings.DATABASES['default']['NAME']
@@ -825,6 +828,7 @@ def testdata(time,distance,pace,spm):
def getrowdata_db(id=0,doclean=False):
data = read_df_sql(id)
data['x_right'] = data['x_right']/1.0e6
if data.empty:
rowdata,row = getrowdata(id=id)
if rowdata:
@@ -836,13 +840,22 @@ def getrowdata_db(id=0,doclean=False):
if doclean:
data = clean_df_stats(data,ignorehr=True)
data['averageforce'] = data['averageforce']*lbstoN
data['peakforce'] = data['peakforce']*lbstoN
return data,row
# Fetch a subset of the data from the DB
def getsmallrowdata_db(columns,ids=[],doclean=True,workstrokesonly=True):
prepmultipledata(ids)
data = read_cols_df_sql(ids,columns)
if 'peakforce' in columns:
data['peakforce'] = data['peakforce']*lbstoN
if 'averageforce' in columns:
data['averageforce'] = data['averageforce']*lbstoN
if doclean:
data = clean_df_stats(data,ignorehr=True,
workstrokesonly=workstrokesonly)
@@ -990,6 +1003,12 @@ def smalldataprep(therows,xparam,yparam1,yparam2):
except IOError:
pass
try:
df['peakforce'] = df['peakforce']*lbstoN
df['averageforce'] = df['averageforce']*lbstoN
except KeyError:
pass
return df
# data fusion
@@ -1100,7 +1119,7 @@ def dataprep(rowdatadf,id=0,bands=True,barchart=True,otwpower=True,
drivespeed = 0.0*rowdatadf['TimeStamp (sec)']
drivespeed = drivespeed.fillna(value=0)
driveenergy = drivelength*averageforce*4.44822
driveenergy = drivelength*averageforce*lbstoN
distance = rowdatadf.ix[:,'cum_dist']