|
@@ -2,7 +2,7 @@
|
|
|
# -*- coding: utf-8 -*-
|
|
|
"""
|
|
|
This experiment was created using PsychoPy3 Experiment Builder (v2023.2.3),
|
|
|
- on Mon Nov 20 16:11:17 2023
|
|
|
+ on Mon Nov 20 21:55:44 2023
|
|
|
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)
|
|
@@ -88,6 +88,13 @@ def parse_args():
|
|
|
type=float
|
|
|
)
|
|
|
parser.add_argument(
|
|
|
+ '--state-change-threshold',
|
|
|
+ '-scth',
|
|
|
+ dest='state_change_threshold',
|
|
|
+ help='Threshold for HMM state change',
|
|
|
+ type=float
|
|
|
+ )
|
|
|
+ parser.add_argument(
|
|
|
'--model-path',
|
|
|
dest='model_path',
|
|
|
help='Path to model file',
|
|
@@ -111,7 +118,9 @@ trigger = TriggerNeuracle()
|
|
|
hand_device = FuboPneumaticFingerClient({'port': args.com})
|
|
|
|
|
|
# build bci controller
|
|
|
-controller = Controller(args.virtual_feedback_rate, args.model_path, state_change_threshold=0.8)
|
|
|
+controller = Controller(args.virtual_feedback_rate,
|
|
|
+ args.model_path,
|
|
|
+ state_change_threshold=args.state_change_threshold)
|
|
|
# Run 'Before Experiment' code from decision
|
|
|
|
|
|
|
|
@@ -872,6 +881,11 @@ def run(expInfo, thisExp, win, inputs, globalClock=None, thisSession=None):
|
|
|
data_from_buffer = receiver.get_trial_data(clear=False)
|
|
|
decision = controller.step_decision(data_from_buffer, current_true_label)
|
|
|
decision_buffer.append(decision)
|
|
|
+
|
|
|
+ # write decision to data
|
|
|
+ thisExp.addData('decision.class', decision)
|
|
|
+ if controller.real_feedback_model is not None:
|
|
|
+ thisExp.addData('decision.prob', controller.real_feedback_model.probability)
|
|
|
# using non-slip timing so subtract the expected duration of this Routine (unless ended on request)
|
|
|
if routineForceEnded:
|
|
|
routineTimer.reset()
|