******************************************************************************************************************* ******************************************************************************************************************* *SCRIPT PURPOSE* This script runs a "mm to px" calibration procedure: It calculates how many pixels are needed on the current monitor (they differ) per mm and can be used to produce stimuli of absolute sizes on any computer screen. *TASK* A line of a specified pixel length (default: 500) is presented on the computer screen. Using a regular bank or insurance card, the line can be adjusted to be 3.37 inches (~8.56cm) long. Pressing '->' will increase the line by 2 pixels Pressing '<-' will decrease the line by 2 pixels The script then calculates how many pixels are needed per mm (-> expressions.ratio_pxpermm) for the current monitor. In the next step, the script presents a ball animation to determine the viewer's blind spot. On that basis, the participant's viewing distance is estimated. *************************************************************************************** ********************************************* Editable Values ********************************************* *************************************************************************************** /linelength_px: the length of the comparison line in pixels (default: 500) /nmeasurements: number of required distance measurements for the ball animation /linelength_px = 500 /nmeasurements = 5 /ballx = -1 /distpx = -1 /distmm = -1 /startx = 10px /starty = 10px /endx = 10px /endy = 10px *************************************************************************************** ********************************************* Editable Instructions ********************************************* *************************************************************************************** /1 = "Take a bank or insurance card and adjust the line on your screen to be 3.37 inches (~8.56cm) long. To increase the line: press '->' on your keyboard To decrease the line: press '<-' on your keyboard When you are done, press ." /1 = "1. Put your finger on space bar on the keyboard. 2. Close your right eye. (Tips: it might be easier to cover your right eye by hand!) 3. Using your left eye, focus on the black square. 4. Press to start the animation of the red ball. The red ball will disappear as it moves from right to left. Press the as soon as the ball disappears from your eye sight." / items = ("Hit <%values.nmeasurements%> more times!") / position = (25%, 75%) / erase = false ******************************************************************************************************************* ******************************************************************************************************************* REMAINING CODE: Customize after careful consideration only ******************************************************************************************************************* ******************************************************************************************************************* ******************************************************************************************************************* ******************************************************************************************************************* EXPRESSIONS ******************************************************************************************************************* ******************************************************************************************************************* /ratio_pxpermm: the calibration ratio to calculate how many pixels are needed per mm !This calibration ratio is crucial to define absolute sizes /ratio_pxpermm = values.linelength_px/85.6 / avg_dist_mm = list.balldistmm.mean / viewing_distance = expressions.avg_dist_mm/rad(13.5) ******************************************************************************************************************* ******************************************************************************************************************* INSTRUCTIONS ******************************************************************************************************************* ******************************************************************************************************************* /items = cardinstructions /position = (50%, 25%) / fontstyle = ("Arial", 3%, false, false, false, false, 5, 1) / txcolor = (0, 0, 0) /erase = false /items = ballinstructions /position = (50%, 25%) / fontstyle = ("Arial", 3%, false, false, false, false, 5, 1) / txcolor = (0, 0, 0) /erase = false ******************************************************************************************************************* ******************************************************************************************************************* STIMULI ******************************************************************************************************************* ******************************************************************************************************************* Note: size of calibration line needs to be explicitly defined in pixels (px) / shape = rectangle / color = (black) / erase = false / size = (1px*values.linelength_px,10px) / position = (10%, 50%) /halign = left /erase = false /shape = rectangle /color = white /position = (50%, 50%) /size = (100%, 100%) /erase = false /items = ("↓ Align corner here") / position = (9.9%, 48%) /halign = left /valign = bottom /erase = false / fontstyle = ("Arial", 1.5%, false, false, false, false, 5, 1) / txcolor = (0, 0, 0) / shape = rectangle / color = black / size = (30px, 30px) / position = (0.5px*display.canvaswidth+450px, 50%) / erase = false / shape = circle / color = red / size = (30px, 30px) / position = (0.5px*display.canvaswidth+180px,50%) / erase = false / shape = circle / color = red / size = (30px, 30px) / animation = path(7000, 1, values.startx, values.starty, values.endx, values.endy) ******************************************************************************************************************* ******************************************************************************************************************* TRIALS ******************************************************************************************************************* ******************************************************************************************************************* /stimulusframes = [1 = eraser, cardinstructions, line, arrow] /validresponse = (203, 205, 28) /ontrialend = [if (trial.changelinelength.response == 203) values.linelength_px -= 2] /ontrialend = [if (trial.changelinelength.response == 205) values.linelength_px += 2] /branch = [if (trial.changelinelength.response != 28) trial.changelinelength] / stimulusframes = [1 = eraser, ballinstructions, square, ball] / validresponse = (28) / branch = [ trial.moveball; ] / stimulusframes = [1=eraser, ballinstructions, square, reminder, ballanimate] / validresponse = (57) / isvalidresponse = [ if (trial.moveball.response == 57){ values.nmeasurements -= 1; values.ballx = shape.ballanimate.hposition; values.distpx = abs(shape.square.hposition - values.ballx); values.distmm = values.distpx/expressions.ratio_pxpermm; list.balldistmm.appenditem(values.distmm); true; } ] / timeout = 7100 / branch = [ if (values.nmeasurements > 0) { trial.moveball; } else { trial.end; } ] / stimulusframes = [1=eraser, endtext] / validresponse = (28) / items = ("Estimated viewing distance (cm): <%expressions.viewing_distance/10%>.~nPress .") / size = (75%, 25%) ******************************************************************************************************************* ******************************************************************************************************************* BLOCKS ******************************************************************************************************************* ******************************************************************************************************************* /trials = [1 = changelinelength] / onblockbegin = [ values.startx = 0.5px*display.canvaswidth+180px; values.starty = 0.5px*display.canvasheight; values.endx = 0.5px*display.canvaswidth-450px; values.endy = 0.5px*display.canvasheight; ] / trials = [1 = startball] / blocks = [1=cardtask; 2=balltask] ******************************************************************************************************************* End of File *******************************************************************************************************************