微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决如何使用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 举报,一经查实,本站将立刻删除。