Change calibration threshold randomly by participant

PennController for IBEX Forums Support Change calibration threshold randomly by participant

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #7639
    Carlos
    Participant

    I’m planning an eye-tracking experiment. In the experiment, I want to change calibration threshold of the web-cam eye tracking system randomly by participant in order to verify how much increasing threshold affects the risks of losing participants.

    I want to randomly assign 30, 50, or 70 as the threshold to ??? in getEyeTracker("tracker").calibrate(???, 2), but I don’t know how to. Is there any way to achieve this?

    newTrial(
      "calibration",
      newFunction(() =>
        $(
          "div:contains(Not recording), .PennController-MediaRecorder-record"
        ).hide()
      ).call(),
      // Explain that the website uses the participant's web-cam, and that the calibration starts
      newText(`
    <p style="text-align:center">この実験では視線計測を行うために,お使いのパソコンのウェブカメラを使用します。</p>
                <p style="text-align:center">この実験の実施中,みなさまがパソコン画面のどこを見ているか記録します。</p>
                <p style="text-align:center">これから視線計測のための調整をします。</p>`)
        .center()
        .print(),
      // Permission to continue
      newButton("同意して続行")
        .center()
        .print()
        .wait(newEyeTracker("tracker").test.ready())
        .remove(),
      clear(),
      fullscreen(),
      // Start calibrating the eye-tracker, allow for up to 2 attempts
      // 50 means that calibration succeeds when 50% of the estimates match the click coordinates
      // Increase the threshold for better accuracy, but more risks of losing participants
      //
      // I want to randomly assign 30, 50, or 70 as the threshold
      getEyeTracker("tracker").calibrate(???, 2), 
      // Explain that participants are required to see a green ball during the calibration session
      newText(`<p>試行の前に,毎回●(丸印)が画面中央に表示されます。</p>
                <p>丸印をクリックしてから,丸印を一定時間見続けてください。</p>
                <p>視線が正しく計測できている場合,実験が自動的に始まります。</p>
                <p>視線が正しく計測できていない場合,再調整の案内が表示されます。</p>`)
        .center()
        .print(),
      // Click here to continue
      newButton("このボタンを押すと実験が始まります").center().print().wait()
    );
    
    • This topic was modified 2 years, 5 months ago by Carlos.
    • This topic was modified 2 years, 5 months ago by Carlos.
    • This topic was modified 2 years, 5 months ago by Carlos.
    #7653
    Jeremy
    Keymaster

    Hello,

    Apologies for the late reply. You can use 30+20*Math.floor(3*Math.random()) in place of ??? to randomly draw a number from 30, 50 and 70. However, in order to keep track of that number in your results file, you might want to do something like:

    caltresh = 30+20*Math.floor(3*Math.random());
    newTrial(
      "calibration",
      newFunction(() =>
        $(
          "div:contains(Not recording), .PennController-MediaRecorder-record"
        ).hide()
      ).call(),
      // Explain that the website uses the participant's web-cam, and that the calibration starts
      newText(`<p style="text-align:center">この実験では視線計測を行うために,お使いのパソコンのウェブカメラを使用します。</p>
               <p style="text-align:center">この実験の実施中,みなさまがパソコン画面のどこを見ているか記録します。</p>
               <p style="text-align:center">これから視線計測のための調整をします。</p>`)
        .center()
        .print(),
      // Permission to continue
      newButton("同意して続行")
        .center()
        .print()
        .wait(newEyeTracker("tracker").test.ready())
        .remove(),
      clear(),
      fullscreen(),
      // Start calibrating the eye-tracker, allow for up to 2 attempts
      // 50 means that calibration succeeds when 50% of the estimates match the click coordinates
      // Increase the threshold for better accuracy, but more risks of losing participants
      getEyeTracker("tracker").calibrate(caltresh, 2), 
      // Explain that participants are required to see a green ball during the calibration session
      newText(`<p>試行の前に,毎回●(丸印)が画面中央に表示されます。</p>
               <p>丸印をクリックしてから,丸印を一定時間見続けてください。</p>
               <p>視線が正しく計測できている場合,実験が自動的に始まります。</p>
               <p>視線が正しく計測できていない場合,再調整の案内が表示されます。</p>`)
        .center()
        .print(),
      // Click here to continue
      newButton("このボタンを押すと実験が始まります").center().print().wait()
    )
    .log("calibration", caltresh)
    

    Jeremy

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.