If this template helps then use it. If not then just delete and start from scratch.
OS (e.g. Win10): 10
PsychoPy version (e.g. 1.84.x): 2022.25
Standard Standalone? (y/n) y
How do I change the calibration point on my project?
I am currently using gazepoint eye tracker and I am able to run through a calibration on Psychopy. Now, I want to restrict the calibration target points so that they can be positioned inside a certain area. How can I do that?
I have tried creating a textsim and creating adding a code but that did not work.
This is the code below:
from psychopy import visual, core
import random
Set up the window
win = visual.Window([800, 600], color=“white”, units=“deg”)
Create the TextStim (target) for the calibration point
target = visual.TextStim(win, text=‘+’, color=‘red’, height=0.05) # Smaller target
Define the custom calibration positions within a very small central area
calibration_positions = [
(-0.1, 0.1), # Top-left
(0, 0.1), # Top-center
(0.1, 0.1), # Top-right
(-0.1, 0), # Left-center
(0, 0), # Center
(0.1, 0), # Right-center
(-0.1, -0.1), # Bottom-left
(0, -0.1), # Bottom-center
(0.1, -0.1) # Bottom-right
]
Shuffle the positions for each new calibration cycle (optional)
random.shuffle(calibration_positions)
Set the number of frames to display each target
frames_per_target = 60 # 1 second per target, assuming 60 FPS
Start the experiment loop
frameN = 0
while frameN < len(calibration_positions) * frames_per_target:
target.setPos(calibration_positions[(frameN // frames_per_target) % len(calibration_positions)]) # Update target position
target.draw() # Draw the target for the current frame
win.flip() # Update the window to display the new target
frameN += 1 # Increment the frame counter
core.wait(1 / 60) # Simulate 60 FPS
Close the window when done
win.close()