[chronojump] Added forceSensorCSVFixCalibration.py to fix forceSensor calibration on a dir
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc: 
- Subject: [chronojump] Added forceSensorCSVFixCalibration.py to fix forceSensor calibration on a dir
- Date: Tue, 13 Sep 2022 10:55:05 +0000 (UTC)
commit dbf1299ffd8638c2b8c30e02d7e38c9730860587
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Sep 13 12:54:21 2022 +0200
    Added forceSensorCSVFixCalibration.py to fix forceSensor calibration on a dir
 python-r-scripts/forceSensorCSVFixCalibration.py | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
---
diff --git a/python-r-scripts/forceSensorCSVFixCalibration.py 
b/python-r-scripts/forceSensorCSVFixCalibration.py
new file mode 100644
index 000000000..c8c24368b
--- /dev/null
+++ b/python-r-scripts/forceSensorCSVFixCalibration.py
@@ -0,0 +1,16 @@
+import pandas as pd
+from os import listdir
+from os import chdir
+
+chdir("forceSensorCSVFixCalibration_files_tofix")
+for filename in listdir():
+    #about pandas_read_csv(engine): https://stackoverflow.com/a/47922247
+    #df = pd.read_csv(filename, sep=";", decimal=",", engine='python')
+    df = pd.read_csv(filename, sep=";", decimal=",")
+    for i, row in df.iterrows():
+        current = float(df.at[i,'Force(N)'])
+        new = ((current -257.13) / 13.4) * 930.59 #obviously, change the values
+        df.at[i,'Force(N)'] = new
+        #print("row: " + str(i) + "; current: " + str(current) + "; new: " + str(new))
+    
+    df.to_csv("../forceSensorCSVFixCalibration_files_fixed/" + filename, sep=';', decimal=",")
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]