Skip to content

Commit

Permalink
Image-base also rotates
Browse files Browse the repository at this point in the history
  • Loading branch information
JorisVincent committed Dec 13, 2022
1 parent 6b91667 commit 2e1df0d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions stimuli/components/components.py
Expand Up @@ -6,7 +6,7 @@
from stimuli.utils import degrees_to_pixels, pad_to_shape, resolution


def image_base(visual_size=None, shape=None, ppd=None):
def image_base(visual_size=None, shape=None, ppd=None, rotation=0.0):
shape, visual_size, ppd = resolution.resolve(shape=shape, visual_size=visual_size, ppd=ppd)

# Image axes
Expand All @@ -23,9 +23,14 @@ def image_base(visual_size=None, shape=None, ppd=None):
radial = np.sqrt(xx**2 + yy**2)

# Angular distance
angular = -np.arctan2(xx, yy)
angular = np.arctan2(xx, yy)
angular -= np.deg2rad(rotation + 90)
angular %= 2 * np.pi

return {
"visual_size": visual_size,
"ppd": ppd,
"rotation": rotation,
"x": x,
"y": y,
"horizontal": xx,
Expand Down

0 comments on commit 2e1df0d

Please sign in to comment.