如何使用JsPsych在nback任务中通过试用反馈进行试用

问题描述

我正在构建一个nback任务,并且除了练习试验期间的反馈以外,其他所有功能都可以使用。目前,我只会弹出“ incorrect”(不正确)消息,但无论试用条件如何,它始终会发生。 我希望时间表看起来像这样:

试用->反馈->试用->反馈等。

明细:参与者看到刺激,如果有匹配项,要么回应,要么不回应。如果当前形状与他们刚看到的形状匹配,则他们按空格键,如果不是,则不执行任何操作。因此有4种可能的结果:正确的响应1)形状匹配+按键,2)形状不匹配+没有按键,错误的响应3)形状匹配+没有按键,4)形状不匹配+按键。

任何建议都会受到欢迎

var timeline = [];

var sequence = [];

var feedback = {
  type:'html-keyboard-response',stimulus: function(){
    var trial_accuracy = jsPsych.data.get().last(1).values()[0];
    if(jsPsych.key_press== 32 & jsPsych.timelineVariable('match',true)){
      return "Correct!"
    }if(jsPsych.key_press== -1 & jsPsych.timelineVariable('match',false)) {
      return "Correct!"
    }else {
      return "Incorrect"
    }
  },choices:jsPsych.NO_KEYS,trial_duration:500
};

var practice_1 = {
  stimulus: "<p>For this practice block,you will need to respond whether the shape you currently see the same shape as the <strong>1</strong> before.</p>"+
    "If the shape matches the previous shape,press the <strong>spacebar</strong>,and if it doesn't match,do nothing until the next shape appears.</p>"+
    "<p> Press the <strong>spacebar</strong> to practice.",type: "html-keyboard-response",post_trial_gap: 750,response_ends_trial: true,choices: [32]
}
timeline.push(practice_1);

var practice_n1 = {
    type: 'image-keyboard-response',stimulus_height: 300,stimulus_width: 300,stimulus: function(){
        if(sequence.length < 1){
            var shape = jsPsych.randomization.sampleWithoutReplacement(n_back_set,1)[0]
        } else{
            if(jsPsych.timelineVariable('match',true)==true){
                var shape = sequence[sequence.length - 1]
            } else {
                var possible_shape = jsPsych.randomization.sampleWithoutReplacement(n_back_set,1);
                if(possible_shape[0] != sequence[sequence.length-1]){ /*This is to disreguard the first two trails*/
                    var shape = possible_shape[0];
                } else {
                    var shape = possible_shape[1];
                }
            }
        }
        sequence.push(shape);
        return shape
    },choices:[32],trial_duration: 500,response_ends_trial: false,post_trial_gap: 2500,data: {block: 'practice'}
}

practice_n1_variables = [
    {match: true},{match:false}
]


practice_n1_sequence = {
    timeline: [practice_n1,feedback],timeline_variables: practice_n1_variables,sample:{
        type:'with-replacement',size: 10,/*this changes depending on N of block*/
        weights: [7,3]
  }
}

timeline.push(practice_n1_sequence);

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...