[chronojump] Fixed: 699951 - pyserial_pyper results == graph.R
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Fixed: 699951 - pyserial_pyper results == graph.R
- Date: Wed, 5 Jun 2013 09:37:24 +0000 (UTC)
commit f49e5a29d84b3f1d9814b9c5c49c444cd683631c
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed Jun 5 11:36:20 2013 +0200
Fixed: 699951 - pyserial_pyper results == graph.R
encoder/pyserial_pyper.py | 5 ++-
encoder/pyserial_pyper_windows.py | 42 ++++++++++++++++++++++++------------
2 files changed, 31 insertions(+), 16 deletions(-)
---
diff --git a/encoder/pyserial_pyper.py b/encoder/pyserial_pyper.py
index 0234597..74f5159 100644
--- a/encoder/pyserial_pyper.py
+++ b/encoder/pyserial_pyper.py
@@ -200,10 +200,10 @@ def calculate_all_in_r(temp, top_values, bottom_values, direction_now,
myR.run('accel$y <- accel$y * 1000') #input data is in mm, conversion to m
myR.run('propulsiveData <- which(accel$y <= -9.81)')
propulsiveData = myR.get('propulsiveData')
- print("propulsiveData:" + str(propulsiveData) + "; end:" + str(end) +
- ";min(propulsiveData):" + str(min(propulsiveData)))
propulsiveDataLength = myR.get('length(propulsiveData)')
if propulsiveDataLength > 0:
+ print("propulsiveData:" + str(propulsiveData) + "; end:" + str(end) +
+ ";min(propulsiveData):" + str(min(propulsiveData)))
end = start + min(propulsiveData)
@@ -523,6 +523,7 @@ if __name__ == '__main__':
#if ser.readable(): #commented because don't work on linux
byte_data = ser.read()
+
# conver HEX to INT value
signedChar_data = unpack('b' * len(byte_data), byte_data)[0]
diff --git a/encoder/pyserial_pyper_windows.py b/encoder/pyserial_pyper_windows.py
index cf59981..958aa78 100644
--- a/encoder/pyserial_pyper_windows.py
+++ b/encoder/pyserial_pyper_windows.py
@@ -54,19 +54,20 @@ mass = float(sys.argv[6])
smoothingOneEC = float(sys.argv[7])
smoothingOneC = float(sys.argv[8])
eccon = sys.argv[9] #contraction "ec" or "c"
-heightHigherCondition = int(sys.argv[10])
-heightLowerCondition = int(sys.argv[11])
-meanSpeedHigherCondition = float(sys.argv[12])
-meanSpeedLowerCondition = float(sys.argv[13])
-maxSpeedHigherCondition = float(sys.argv[14])
-maxSpeedLowerCondition = float(sys.argv[15])
-powerHigherCondition = int(sys.argv[16])
-powerLowerCondition = int(sys.argv[17])
-peakPowerHigherCondition = int(sys.argv[18])
-peakPowerLowerCondition = int(sys.argv[19])
-mainVariable = sys.argv[20]
-w_serial_port = sys.argv[21]
-r_path = sys.argv[22]
+analysisOptions = sys.argv[10] #["p","none"]: propulsive or none
+heightHigherCondition = int(sys.argv[11])
+heightLowerCondition = int(sys.argv[12])
+meanSpeedHigherCondition = float(sys.argv[13])
+meanSpeedLowerCondition = float(sys.argv[14])
+maxSpeedHigherCondition = float(sys.argv[15])
+maxSpeedLowerCondition = float(sys.argv[16])
+powerHigherCondition = int(sys.argv[17])
+powerLowerCondition = int(sys.argv[18])
+peakPowerHigherCondition = int(sys.argv[19])
+peakPowerLowerCondition = int(sys.argv[20])
+mainVariable = sys.argv[21]
+w_serial_port = sys.argv[22]
+r_path = sys.argv[23]
delete_initial_time = 20 #delete first records because there's encoder bug
#w_baudrate = 9600 # Setting the baudrate of Chronopic(9600)
@@ -195,7 +196,20 @@ def calculate_all_in_r(temp, top_values, bottom_values, direction_now,
for i in bcross:
if i < maxSpeedT:
x_ini = i #left adjust
-
+
+ #find propulsive
+ if analysisOptions == "p":
+ myR.run('accel <- predict( speed, deriv=1 )')
+ myR.run('accel$y <- accel$y * 1000') #input data is in mm, conversion to m
+ myR.run('propulsiveData <- which(accel$y <= -9.81)')
+ propulsiveData = myR.get('propulsiveData')
+ propulsiveDataLength = myR.get('length(propulsiveData)')
+ if propulsiveDataLength > 0:
+ print("propulsiveData:" + str(propulsiveData) + "; end:" + str(end) +
+ ";min(propulsiveData):" + str(min(propulsiveData)))
+ end = start + min(propulsiveData)
+
+
myR.assign('a',temp[start+x_ini:end])
print("start reduced (start+x_ini):" + str(start + x_ini) + " (x_ini:" + str(x_ini) +
"); end:" + str(end))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]