Browse Source

增加难度选项

dk 1 year ago
parent
commit
98feff011e
2 changed files with 14 additions and 3 deletions
  1. 0 0
      backend/general_grasp_training.psyexp
  2. 14 3
      backend/general_grasp_training.py

File diff suppressed because it is too large
+ 0 - 0
backend/general_grasp_training.psyexp


+ 14 - 3
backend/general_grasp_training.py

@@ -2,7 +2,7 @@
 # -*- coding: utf-8 -*-
 # -*- coding: utf-8 -*-
 """
 """
 This experiment was created using PsychoPy3 Experiment Builder (v2023.2.3),
 This experiment was created using PsychoPy3 Experiment Builder (v2023.2.3),
-    on 十一月 22, 2023, at 14:37
+    on Tue Nov 28 19:22:54 2023
 If you publish work using this script the most relevant publication is:
 If you publish work using this script the most relevant publication is:
 
 
     Peirce J, Gray JR, Simpson S, MacAskill M, Höchenberger R, Sogo H, Kastman E, Lindeløv JK. (2019) 
     Peirce J, Gray JR, Simpson S, MacAskill M, Höchenberger R, Sogo H, Kastman E, Lindeløv JK. (2019) 
@@ -95,6 +95,11 @@ def parse_args():
         type=float
         type=float
     )
     )
     parser.add_argument(
     parser.add_argument(
+        '--difficulty',
+        help='Task difficultys',
+        type=str
+    )
+    parser.add_argument(
         '--model-path',
         '--model-path',
         dest='model_path',
         dest='model_path',
         help='Path to model file',
         help='Path to model file',
@@ -123,7 +128,13 @@ controller = Controller(args.virtual_feedback_rate,
                         args.model_path, 
                         args.model_path, 
                         state_change_threshold=args.state_change_threshold)
                         state_change_threshold=args.state_change_threshold)
 # Run 'Before Experiment' code from decision
 # Run 'Before Experiment' code from decision
+cnt_threshold_table = {
+    'easy': 3,
+    'mid': 4,
+    'hard': 5
+}
 
 
+cnt_threshold = cnt_threshold_table[args.difficulty]
 
 
 # --- Setup global variables (available in all functions) ---
 # --- Setup global variables (available in all functions) ---
 # Ensure that relative paths start from the same directory as this script
 # Ensure that relative paths start from the same directory as this script
@@ -199,7 +210,7 @@ def setupData(expInfo, dataDir=None):
     thisExp = data.ExperimentHandler(
     thisExp = data.ExperimentHandler(
         name=expName, version='',
         name=expName, version='',
         extraInfo=expInfo, runtimeInfo=None,
         extraInfo=expInfo, runtimeInfo=None,
-        originPath='C:\\Users\\asena\\Desktop\\kraken\\backend\\general_grasp_training.py',
+        originPath='/Users/dingkunliu/Projects/MI-BCI-Proj/kraken/backend/general_grasp_training.py',
         savePickle=True, saveWideText=True,
         savePickle=True, saveWideText=True,
         dataFileName=dataDir + os.sep + filename, sortColumns='time'
         dataFileName=dataDir + os.sep + filename, sortColumns='time'
     )
     )
@@ -904,7 +915,7 @@ def run(expInfo, thisExp, win, inputs, globalClock=None, thisSession=None):
             if d == current_true_label:
             if d == current_true_label:
                 cnt += 1
                 cnt += 1
         
         
-        if cnt >= 3:
+        if cnt >= cnt_threshold:
             feedback_time = 10
             feedback_time = 10
         else:
         else:
             feedback_time = 2
             feedback_time = 2

Some files were not shown because too many files changed in this diff