Creating a conversion factor in psychopy

Hi! I am working on a working memory task where participants are staring at an 8x8 grid with dots appearing on the screen. They must remember where these dots are, and reply whether the probe dot was in the same position as one of the dots, or not. My issue is we created all the stimuli in degrees of visual angle, but need to use a conversion factor to convert from degrees to pixels because Pavlovia cannot use degrees.

My problem is that I’m not exactly sure how to insert this conversion factor into Builder - could I create another column on my csv file for the conversion factor, or is there a code component that I can create for this conversion factor? Please let me know if anyone has done a similar type of experiment! Thanks in advance!

The problem with doing this online is that you don’t know how far away from the screen participants are sat or how big the screen is - both of these are needed to accurately convert to and from degrees of visual angle. However, if you’re happy to make some assumptions (e.g. a common ratio of pixels to cm, participants are always x distance from the screen, etc.) then it’s just a mathematical operation. You could do this in Excel or you could add something in the Begin Experiment tab of a Code component to get the conversion function PsychoPy uses:

from import deg2pix

and then use it on your variables in Builder with some default parameters.