首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >jsPsych中的固定交叉

jsPsych中的固定交叉
EN

Stack Overflow用户
提问于 2016-03-06 20:27:10
回答 1查看 457关注 0票数 1

我正试着在jsPsych的实验中添加一个固定十字。我是js的新手。

这就是我所拥有的:

代码语言:javascript
复制
var test_stimuli = [
      {
        image: "img/blau_links.png",
        data: { correct_response: 37 }
      },
      {
        image: "img/blau_rechts.png",
        data: { correct_response: 37 }
      },
      {
        image: "img/gruen_links.png",
        data: { correct_response: 39 }
      },
      {
        image: "img/gruen_rechts.png",
        data: { correct_response: 39 }
      }
];



var all_tests = jsPsych.randomization.repeat(test_stimuli, 50, true);

var post_test_gap = function() {
    return Math.floor( Math.random() * 1500 ) + 750;
}

var test_block = {
    type: "single-stim",
    stimuli: all_tests.image,
    choices: [37, 39],
    data: all_tests.data,
    timing_response: 1500,
    timing_post_test: post_test_gap
};

var fixation_trial = {
    type: 'single-stim',
    stimuli: ['<p style='text-align:center'>+</p>'],
    is_html: true,
    timing_response: 500,
    timing_post_trial: 0,
    choices: 'none'
}

var experiment = [];
    experiment.push(instructions_block);
    experiment.push(trial_block);
    experiment.push(posttrial_block);
    experiment.push(fixation_trial);
    experiment.push(test_block);
    experiment.push(debrief_block);

    /* start the experiment */
    jsPsych.init({experiment_structure: experiment,
      on_finish: function() {
        jsPsych.data.displayData();
      }

我现在想要的是在每次测试之前添加一个固定十字。在当前形式中,它在所有刺激之后只显示一次。任何帮助都是非常感谢的。

EN

回答 1

Stack Overflow用户

发布于 2019-05-22 13:55:54

下面是一个使用jsPsych-6.0.5和“html-keyboard-response”插件(而不是“single-stim”)编写的工作固定代码块:

代码语言:javascript
复制
var fixation = {
  type: 'html-keyboard-response',
  stimulus: '<div style="font-size:60px">+</div>',
  choices: jsPsych.NO_KEYS,
  trial_duration: 800 // in ms
}; 

此固定块可通过push功能包含在您的时间线中:

代码语言:javascript
复制
experiment.push(fixation);
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35826810

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档