psychopy.tools.coordinatetools

Functions and classes related to coordinate system conversion

cart2pol(x, y[, units])

Convert from cartesian to polar coordinates.

cart2sph(z, y, x)

Convert from cartesian coordinates (x,y,z) to spherical (elevation, azimuth, radius).

pol2cart(theta, radius[, units])

Convert from polar to cartesian coordinates.

sph2cart(*args)

Convert from spherical coordinates (elevation, azimuth, radius) to cartesian (x,y,z).

Function details

psychopy.tools.coordinatetools.cart2pol(x, y, units='deg')[source]

Convert from cartesian to polar coordinates.

Usage:

theta, radius = cart2pol(x, y, units=’deg’)

units refers to the units (rad or deg) for theta that should be returned

psychopy.tools.coordinatetools.cart2sph(z, y, x)[source]

Convert from cartesian coordinates (x,y,z) to spherical (elevation, azimuth, radius). Output is in degrees.

usage:

array3xN[el,az,rad] = cart2sph(array3xN[x,y,z]) OR elevation, azimuth, radius = cart2sph(x,y,z)

If working in DKL space, z = Luminance, y = S and x = LM

psychopy.tools.coordinatetools.pol2cart(theta, radius, units='deg')[source]

Convert from polar to cartesian coordinates.

usage:

x,y = pol2cart(theta, radius, units='deg')
psychopy.tools.coordinatetools.sph2cart(*args)[source]

Convert from spherical coordinates (elevation, azimuth, radius) to cartesian (x,y,z).

usage:

array3xN[x,y,z] = sph2cart(array3xN[el,az,rad]) OR x,y,z = sph2cart(elev, azim, radius)


Back to top