code: def doprinc(data):
      
      ppars = {}
      rad = old_div(np.pi, 180.)
      X = dir2cart(data)
      # for rec in data:
      #    dir=[]
      #    for c in rec: dir.append(c)
      #    cart= (dir2cart(dir))
      #    X.append(cart)
  #   put in T matrix
  #
      T = np.array(Tmatrix(X))
  #
  #   get sorted evals/evects
  #
      t, V = tauV(T)
      Pdir = cart2dir(V[0])
      ppars['Edir'] = cart2dir(V[1])  # elongation direction
      dec, inc = doflip(Pdir[0], Pdir[1])
      ppars['dec'] = dec
      ppars['inc'] = inc
      ppars['N'] = len(data)
      ppars['tau1'] = t[0]
      ppars['tau2'] = t[1]
      ppars['tau3'] = t[2]
      Pdir = cart2dir(V[1])
      dec, inc = doflip(Pdir[0], Pdir[1])
      ppars['V2dec'] = dec
      ppars['V2inc'] = inc
      Pdir = cart2dir(V[2])
      dec, inc = doflip(Pdir[0], Pdir[1])
      ppars['V3dec'] = dec
      ppars['V3inc'] = inc
      return ppars
docs: Gets principal components from data in form of a list of [dec,inc] data.
  
      Parameters
      ----------
      data : nested list of dec, inc directions
  
      Returns
      -------
      ppars : dictionary with the principal components
          dec : principal directiion declination
          inc : principal direction inclination
          V2dec : intermediate eigenvector declination
          V2inc : intermediate eigenvector inclination
          V3dec : minor eigenvector declination
          V3inc : minor eigenvector inclination
          tau1 : major eigenvalue
          tau2 : intermediate eigenvalue
          tau3 : minor eigenvalue
          N  : number of points
          Edir : elongation direction [dec, inc, length]