Reply To: Change calibration threshold randomly by participant

PennController for IBEX Forums Support Change calibration threshold randomly by participant Reply To: Change calibration threshold randomly by participant

#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