Browse Source

add python code

Jia, Jingyi 3 years ago
parent
commit
d8c0bfa634

BIN
.DS_Store


BIN
User Study/.DS_Store


BIN
User Study/Google Form/.DS_Store


+ 3 - 0
User Study/Google Form/Hector V2 Nutzerstudie.csv

@@ -0,0 +1,3 @@
+时间戳记,How old are you?,What is your gender?,What is or was your major (e.g. Computer Science)?,How much VR experience do you have?, I found it easy to move robot in desired position, I found it easy to concentrate on controlling the robot, I found it easy to perceive the details of the environment, I found it easy to move robot in desired position, I found it easy to concentrate on controlling the robot, I found it easy to perceive the details of the environment, I found it easy to move robot in desired position, I found it easy to concentrate on controlling the robot, I found it easy to perceive the details of the environment, I found it easy to move robot in desired position, I found it easy to concentrate on controlling the robot, I found it easy to perceive the details of the environment,Which operation mode do you like best? ,Why do you like it best? ,Which operation mode do you dislike the most?,Why do you dislike it the most? 
+2021/07/06 10:43:12 上午 GMT+2,22,Female,,5,2,3,4,2,4,1,2,4,4,1,4,4,Handle,,Lab,
+2021/07/06 10:44:10 上午 GMT+2,25,Male,,2,4,1,3,1,3,4,2,3,3,2,3,5,Handle,(Handle) because xxxxxx,Lab,(Lab) xxxxxxx

BIN
User Study/Google Form/I found it easy to concentrate on controlling the robot.jpg


BIN
User Study/Google Form/I found it easy to move robot in desired position.jpg


BIN
User Study/Google Form/I found it easy to perceive the details of the environment.jpg


+ 64 - 0
User Study/Google Form/statistic.py

@@ -0,0 +1,64 @@
+import glob
+import os
+from numpy.lib.function_base import append
+import pandas as pd
+import matplotlib.pyplot as plt
+import time
+import seaborn as sns
+import numpy as np
+import csv
+import joypy
+
+
+def draw(filename,start):
+    file = pd.read_csv(FileName,usecols=[start,start+3,start+6,start+9])
+    temp = file.values.tolist()
+    file = np.transpose(temp)
+
+    kwargs = {
+        "bins": 20,
+        "histtype": "stepfilled",
+        "alpha": 0.5
+    }
+    
+    fig,ax = plt.subplots(figsize=(10, 7))
+    for i in range(0,4):
+        ax.hist(file[i], color = colors[i],label=conditions[i], **kwargs)
+
+    ax.set_title(filename)
+    ax.legend()
+    plt.show()
+    
+def draw2(filename,start):
+    file = pd.read_csv(FileName,usecols=[start,start+3,start+6,start+9])
+    temp = file.values.tolist()
+    # Draw Stripplot
+    plt.figure(figsize=(10,5))
+    medianprops = dict(linestyle='-', linewidth=1, color='black')
+    f = plt.boxplot(file,patch_artist = True,medianprops=medianprops,labels=conditions)
+    
+    for box,c in zip(f['boxes'], colors):
+        box.set(color='black', linewidth=1)
+        box.set_alpha(a)
+        box.set( facecolor = c )
+    plt.title(filename, fontsize=15)
+    plt.savefig(filename+".jpg",dpi=300)
+    #plt.show()
+
+
+FileName = "Hector V2 Nutzerstudie.csv"
+file = pd.read_csv(FileName)
+colors = sns.color_palette()
+a = 0.6
+
+conditions = ["Handle","Lab","Remote","UI"]
+questions = ["I found it easy to move robot in desired position","I found it easy to concentrate on controlling the robot","I found it easy to perceive the details of the environment"]
+
+start = 5;
+for i in range(0,3):
+    #draw(questions[i],start+i)
+    draw2(questions[i],start+i)
+
+
+
+

BIN
User Study/TLX/effort.jpg


BIN
User Study/TLX/frustration.jpg


BIN
User Study/TLX/mental-demand.jpg


BIN
User Study/TLX/performance.jpg


BIN
User Study/TLX/physical-demand.jpg


+ 5 - 5
User Study/TLX/statistic.py

@@ -1,10 +1,10 @@
 import glob
 import os
-from numpy.lib.function_base import append
 import pandas as pd
 import matplotlib.pyplot as plt
 import time
 import numpy as np
+import seaborn as sns
 
 path = os.getcwd()
 
@@ -12,7 +12,7 @@ def draw(filename):
     conditions = file['condition']
     result = file[filename]
     plt.figure(figsize=(9, 6), dpi=100)
-    plt.bar(conditions, result, width=0.35, color=colors)
+    plt.bar(conditions, result, width=0.35, color=colors,alpha=a)
     plt.title(filename)
     plt.ylabel('score')
     plt.grid(alpha=0, linestyle=':')
@@ -29,7 +29,7 @@ def drawTogether():
         result = []
         for scale in scales:
             result.append(file.iloc[i][scale])
-        plt.bar(x+width*(i-1),result,width=width,color=colors[i],label=file.iloc[i]["condition"])
+        plt.bar(x+width*(i-1),result,width=width,color=colors[i],label=file.iloc[i]["condition"],alpha=a)
 
     plt.legend()
     
@@ -56,8 +56,8 @@ file.to_csv( "Mean.csv")
 
 file = pd.read_csv("Mean.csv")
 scales = ["mental-demand","physical-demand","temporal-demand","performance", "effort","frustration","total"]
-colors = ['lightcoral', 'gold','plum', 'paleturquoise']
-
+colors = sns.color_palette()
+a = 0.6
 for scale in scales:
     draw(scale)
 

BIN
User Study/TLX/summary.jpg


BIN
User Study/TLX/temporal-demand.jpg


BIN
User Study/TLX/total.jpg


BIN
User Study/TestResult/.DS_Store


+ 5 - 2
User Study/TestResult/0.csv

@@ -1,2 +1,5 @@
-participant,condition,Remained Time,Collision,Drive Distance,Total driving time,Adverage speed,Rescued Target,Remained Visible Target,Remained Unvisible Target,time,
-0,Simulation,0,0,0.08204317,0,0,0,0,10,2021/07/03 20:41,
+participant,condition,Remained Time,Collision,Drive Distance,Total driving time,Adverage speed,Rescued Target,Remained Visible Target,Remained Unvisible Target,time
+0,Handle,0,0,0.08204317,0,0,0,0,10,2021/7/3 20:41
+0,Lab,0,0,0.08204317,0,0,0,0,10,2021/7/3 20:41
+0,Remote,0,0,0.08204317,0,0,0,0,10,2021/7/3 20:41
+0,UI,0,0,0.08204317,0,0,0,0,10,2021/7/3 20:41

BIN
User Study/TestResult/Adverage speed.jpg


BIN
User Study/TestResult/Collision.jpg


BIN
User Study/TestResult/Drive Distance.jpg


+ 6 - 0
User Study/TestResult/Mean.csv

@@ -0,0 +1,6 @@
+condition,Unnamed: 0,Unnamed: 0.1,Unnamed: 0.1.1,participant,Remained Time,Collision,Drive Distance,Total driving time,Adverage speed,Rescued Target,Remained Visible Target,Remained Unvisible Target,Unnamed: 11
+Handle,4.5,1.0,,0.0,0.0,0.0,0.08204317,0.0,0.0,0.0,0.0,10.0,
+Lab,5.5,2.0,,0.0,0.0,0.0,0.08204317,0.0,0.0,0.0,0.0,10.0,
+Remote,6.5,3.0,,0.0,0.0,0.0,0.08204317,0.0,0.0,0.0,0.0,10.0,
+Simulation,4.916666666666667,1.25,0.0,0.0,0.0,0.0,0.08204317,0.0,0.0,0.0,0.0,10.0,
+UI,7.75,4.0,,0.0,0.0,0.0,0.08204317,0.0,0.0,0.0,0.0,10.0,

+ 25 - 0
User Study/TestResult/Merged.csv

@@ -0,0 +1,25 @@
+,Unnamed: 0,Unnamed: 0.1,Unnamed: 0.1.1,participant,condition,Remained Time,Collision,Drive Distance,Total driving time,Adverage speed,Rescued Target,Remained Visible Target,Remained Unvisible Target,time,Unnamed: 11
+0,0.0,0.0,0.0,0.0,Simulation,0.0,0.0,0.08204317,0.0,0.0,0.0,0.0,10.0,2021/07/03 20:41,
+1,1.0,1.0,,0.0,Handle,0.0,0.0,0.08204317,0.0,0.0,0.0,0.0,10.0,2021/7/3 20:41,
+2,2.0,2.0,,0.0,Lab,0.0,0.0,0.08204317,0.0,0.0,0.0,0.0,10.0,2021/7/3 20:41,
+3,3.0,3.0,,0.0,Remote,0.0,0.0,0.08204317,0.0,0.0,0.0,0.0,10.0,2021/7/3 20:41,
+4,4.0,4.0,,0.0,UI,0.0,0.0,0.08204317,0.0,0.0,0.0,0.0,10.0,2021/7/3 20:41,
+5,5.0,5.0,,0.0,Simulation,0.0,0.0,0.08204317,0.0,0.0,0.0,0.0,10.0,,
+6,6.0,,,0.0,Handle,0.0,0.0,0.08204317,0.0,0.0,0.0,0.0,10.0,2021/7/3 20:41,
+7,7.0,,,0.0,Lab,0.0,0.0,0.08204317,0.0,0.0,0.0,0.0,10.0,2021/7/3 20:41,
+8,8.0,,,0.0,Remote,0.0,0.0,0.08204317,0.0,0.0,0.0,0.0,10.0,2021/7/3 20:41,
+9,9.0,,,0.0,UI,0.0,0.0,0.08204317,0.0,0.0,0.0,0.0,10.0,2021/7/3 20:41,
+10,10.0,,,0.0,Handle,0.0,0.0,0.08204317,0.0,0.0,0.0,0.0,10.0,,
+11,11.0,,,0.0,Lab,0.0,0.0,0.08204317,0.0,0.0,0.0,0.0,10.0,,
+12,12.0,,,0.0,Remote,0.0,0.0,0.08204317,0.0,0.0,0.0,0.0,10.0,,
+13,13.0,0.0,,0.0,Simulation,0.0,0.0,0.08204317,0.0,0.0,0.0,0.0,10.0,,
+14,14.0,,,0.0,UI,0.0,0.0,0.08204317,0.0,0.0,0.0,0.0,10.0,,
+15,,,,0.0,Handle,0.0,0.0,0.08204317,0.0,0.0,0.0,0.0,10.0,2021/7/3 20:41,
+16,,,,0.0,Lab,0.0,0.0,0.08204317,0.0,0.0,0.0,0.0,10.0,2021/7/3 20:41,
+17,,,,0.0,Remote,0.0,0.0,0.08204317,0.0,0.0,0.0,0.0,10.0,2021/7/3 20:41,
+18,,,,0.0,UI,0.0,0.0,0.08204317,0.0,0.0,0.0,0.0,10.0,2021/7/3 20:41,
+19,1.0,,,0.0,Handle,0.0,0.0,0.08204317,0.0,0.0,0.0,0.0,10.0,,
+20,2.0,,,0.0,Lab,0.0,0.0,0.08204317,0.0,0.0,0.0,0.0,10.0,,
+21,3.0,,,0.0,Remote,0.0,0.0,0.08204317,0.0,0.0,0.0,0.0,10.0,,
+22,1.6666666666666667,0.0,,0.0,Simulation,0.0,0.0,0.08204317,0.0,0.0,0.0,0.0,10.0,,
+23,4.0,,,0.0,UI,0.0,0.0,0.08204317,0.0,0.0,0.0,0.0,10.0,,

BIN
User Study/TestResult/Remained Unvisible Target.jpg


BIN
User Study/TestResult/Remained Visible Target.jpg


BIN
User Study/TestResult/Rescued Target.jpg


BIN
User Study/TestResult/Total driving time.jpg


+ 65 - 0
User Study/TestResult/statistic.py

@@ -0,0 +1,65 @@
+import glob
+import os
+import pandas as pd
+import matplotlib.pyplot as plt
+import time
+import numpy as np
+import seaborn as sns
+
+path = os.getcwd()
+
+def draw(filename):
+    conditions = file['condition']
+    result = file[filename]
+    plt.figure(figsize=(9, 6), dpi=100)
+    plt.bar(conditions, result, width=0.35, color=colors,alpha=a)
+    plt.title(filename)
+    plt.ylabel('score')
+    plt.grid(alpha=0, linestyle=':')
+    plt.savefig(filename + ".jpg", dpi=300)
+    #plt.show()
+
+def drawTogether():
+    plt.figure(figsize=(20,7))
+    x = np.arange(len(scales))
+    total_width, n = 0.8, 4
+    width = total_width / n
+    
+    for i in range(0,4):
+        result = []
+        for scale in scales:
+            result.append(file.iloc[i][scale])
+        plt.bar(x+width*(i-1),result,width=width,color=colors[i],label=file.iloc[i]["condition"],alpha=a)
+
+    plt.legend()
+    
+    plt.xticks(x+width/2,scales)
+    #plt.show()
+    
+    plt.savefig("summary.jpg",dpi=300)
+
+
+
+# Merge all the .csv file 
+all_files = glob.glob(os.path.join(path, "*.csv"))
+df_from_each_file = (pd.read_csv(f, sep=',') for f in all_files)
+df_merged = pd.concat(df_from_each_file, ignore_index=True)
+
+# Save the file to Merged.csv in the same folder
+df_merged.to_csv( "Merged.csv")
+
+# save the results in csv
+file = df_merged.groupby(["condition"]).mean() 
+file.to_csv( "Mean.csv")
+
+
+file = pd.read_csv("Mean.csv")
+scales = ["Collision","Drive Distance","Total driving time","Adverage speed","Rescued Target", "Remained Visible Target","Remained Unvisible Target"]
+colors = sns.color_palette()
+a = 0.6
+for scale in scales:
+    draw(scale)
+
+drawTogether()
+
+

BIN
User Study/TestResult/summary.jpg