pulse2percept.utils.geometry

cart2pol, pol2cart, delta_angle

Functions

cart2pol(x, y) Convert Cartesian to polar coordinates
delta_angle(source_angle, target_angle[, hi]) Returns the signed difference between two angles (rad)
pol2cart(theta, rho) Convert polar to Cartesian coordinates
pulse2percept.utils.geometry.cart2pol(x, y)[source]

Convert Cartesian to polar coordinates

Parameters:y (x,) – The x,y Cartesian coordinates
Returns:theta, rho (scalar or array-like) – The transformed polar coordinates
pulse2percept.utils.geometry.delta_angle(source_angle, target_angle, hi=6.283185307179586)[source]

Returns the signed difference between two angles (rad)

The difference is calculated as target_angle - source_angle. The difference will thus be positive if target_angle > source_angle.

New in version 0.7.

Parameters:
  • target_angle (source_angle,) – Input arrays with circular data in the range [0, hi]
  • hi (float, optional) – Sets the upper bounds of the range (e.g., 2*np.pi or 360). Lower bound is always 0
Returns:

The signed difference target_angle - source_angle in [0, hi]

pulse2percept.utils.geometry.pol2cart(theta, rho)[source]

Convert polar to Cartesian coordinates

Parameters:rho (theta,) – The polar coordinates
Returns:x, y (scalar or array-like) – The transformed Cartesian coordinates