In [5]:
from psychopy import visual
import matplotlib.pyplot as plt
import numpy as np
from aibs.Core import *
from aibs.Projector.ProjectorWindow import *
class ConvertProjectorCoords(object):
"""
Converts stimulus coordinate space to corresponding warped coordinates on ProjectorWindow.
Use case: You have known 2D coordinates of a stimulus and wish to know where this is in spherical or cylindrical
warped space.
"""
def __init__(self):
pass
def StimulusToWarped2D (self, vertices, warp="disabled", eyepoint=(0.5, 0.5)):
'''
Warps X,Y coordinates from stimulus space to warped display coordinates.
Parameters
----------
vertices: 2D numpy array of X, Y coordinates in stimulus space
warp: defines the warping projection to be applied. Values can be:
"disabled" - no correction, same as default PsychoPy projection
"spherical" - correct using spherical projection (aka "Radial" or "Equirectangular)
"cylindrical" - correct using cylindrical projection
eyepoint: position of the eye in normalized coordinates
(0,0) is lower left, (1,1) is upper right, (0.5, 0.5) is the center (default)
'''
pass
if __name__ == "__main__":
cpc = ConvertProjectorCoords()
vertices = np.array([100, 100], [200,200])
cpc.StimulusToWarped2D (vertices,)
pass
In [ ]: