psychopy.org | Reference | Downloads | Github

Converting pixels to height unit

Hi,

Perhaps a silly question but I am trying to get my head around this.
I will be presenting images and using “norm” units seems to result in some distortion of the images.

I now want to give it a try with “height” units but I am not sure how to convert pixels to height units.
If of any help, my screen resolution is 1366 x 768 (which I believe it makes it a 16:9 aspect ratio) and each image is 286 x 397.

I had a look at Units for the window and stimuli — PsychoPy v2021.2 but didn’t help.

Thanks in advance.
Yiannis

Hi There!

Pixels can be considered a proportion of height. So 1 unit of height should equate to win.size[1] in pixels 0.5 height should correspond to win.size[1]/2 and so on. In the newest release (2021.2) you can try the inbuilt demo which gives a nice visualisation of different units. This can be accessed from builder using Demos > Understanding PsychoPy > spatial Units. You shouldn’t need to apply any conversion using code and PsychoPy should apply this anyway when units are height.

Hope this helps!
Becca

Thanks @Becca for your prompt reply. I think I get it.
Unfortunately I cannot upgrade psychopy just yet as my exp does not run with this newest version - too much code to find out why it does not, it’s an online staircase exp.

Aha no prob you can also access that demo by downloading the “examples.zip” from the navbar here https://workshops.psychopy.org/

Becca

1 Like