def cart2pol(x, y, units='deg'):
 radius = numpy.hypot(x, y)
 theta = numpy.arctan2(y, x)
 if (units in ('deg', 'degs')):
  theta = ((theta * 180) / numpy.pi)
 return (theta, radius)

def cart2pol ( x , y , units = 'deg' ) : radius = numpy . hypot ( x , y ) theta = numpy . arctan2 ( y , x ) if ( units in ( 'deg' , 'degs' ) ) : theta = ( ( theta * 180 ) / numpy . pi ) return ( theta , radius )
convert from cartesian to polar coordinates .