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:
  • x (scalar or array-like) – The x,y Cartesian coordinates

  • y (scalar or array-like) – The x,y Cartesian coordinates

Returns:

theta, rho – The transformed polar coordinates

Return type:

scalar or array-like

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

Convert polar to Cartesian coordinates

Parameters:
  • theta (scalar or array-like) – The polar coordinates

  • rho (scalar or array-like) – The polar coordinates

Returns:

x, y – The transformed Cartesian coordinates

Return type:

scalar or array-like

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.

Added in version 0.7.

Parameters:
  • source_angle (array_like) – Input arrays with circular data in the range [0, hi]

  • target_angle (array_like) – 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

Return type:

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