code: def find_actions(orbit, N_max, force_harmonic_oscillator=False, toy_potential=None):
      r
  
      if orbit.norbits == 1:
          return _single_orbit_find_actions(
              orbit, N_max,
              force_harmonic_oscillator=force_harmonic_oscillator,
              toy_potential=toy_potential)
  
      else:
          norbits = orbit.norbits
          actions = np.zeros((3, norbits))
          angles = np.zeros((3, norbits))
          freqs = np.zeros((3, norbits))
          for n in range(norbits):
              aaf = _single_orbit_find_actions(
                  orbit[:, n], N_max,
                  force_harmonic_oscillator=force_harmonic_oscillator,
                  toy_potential=toy_potential)
              actions[n] = aaf['actions'].value
              angles[n] = aaf['angles'].value
              freqs[n] = aaf['freqs'].value
  
      return dict(actions=actions*aaf['actions'].unit,
                  angles=angles*aaf['angles'].unit,
                  freqs=freqs*aaf['freqs'].unit,
                  Sn=actions[3:], dSn=angles[6:], nvecs=aaf['nvecs'])
docs: r"""
      Find approximate actions and angles for samples of a phase-space orbit.
      Uses toy potentials with known, analytic action-angle transformations to
      approximate the true coordinates as a Fourier sum.
  
      This code is adapted from Jason Sanders'
      `genfunc <https://github.com/jlsanders/genfunc>`_
  
      Parameters
      ----------
      orbit : `~gala.dynamics.Orbit`
      N_max : int
          Maximum integer Fourier mode vector length, :math:`|\boldsymbol{n}|`.
      force_harmonic_oscillator : bool (optional)
          Force using the harmonic oscillator potential as the toy potential.
      toy_potential : Potential (optional)
          Fix the toy potential class.
  
      Returns
      -------
      aaf : dict
          A Python dictionary containing the actions, angles, frequencies, and
          value of the generating function and derivatives for each integer
          vector. Each value of the dictionary is a :class:`numpy.ndarray` or
          :class:`astropy.units.Quantity`.