Created
February 20, 2020 12:16
-
-
Save fladd/e5424453c3ac298dc8674d574a194acd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def stimulus_size_as_visual_angles(stim_size, screen_size, screen_angles): | |
"""Convert stimulus size (in pixels) to visual viewing angle (in degree). | |
Parameters | |
---------- | |
stim_size : (int, int) | |
the size of the stimulus in pixels (width, height) | |
screen_dims : (int, int) | |
the pixel dimensions of the screen (width, height) | |
screen_angles : (float, float) | |
the visual viewing angles of the screen (width, height) | |
Returns | |
------- | |
angles : (float, float) | |
the visual viewing angle of the distance (width, height) | |
""" | |
return ((stim_size[0] / screen_size[0] * 100) / 100 * screen_angles[0], | |
(stim_size[1] / screen_size[1] * 100) / 100 * screen_angles[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment