code: def sequential_spherical(xyz):
      
      d_xyz = np.diff(xyz,axis=0)
      
      r = np.linalg.norm(d_xyz,axis=1)
      theta = np.arctan2(d_xyz[:,1], d_xyz[:,0])
      hyp = d_xyz[:,0]**2 + d_xyz[:,1]**2
      phi = np.arctan2(np.sqrt(hyp), d_xyz[:,2])
      
      return (r,theta,phi)
docs: Converts sequence of cartesian coordinates into a sequence of
      line segments defined by spherical coordinates.
      
      Args:
          xyz = 2d numpy array, each row specifies a point in
                cartesian coordinates (x,y,z) tracing out a
                path in 3D space.
      
      Returns:
          r = lengths of each line segment (1D array)
          theta = angles of line segments in XY plane (1D array)
          phi = angles of line segments down from Z axis (1D array)