parameters: (self, atol=1e-12, rtol=1e-12)
return_statement: return traj
docstring: Returns the trajectory data of time, states, costates, and controls.
  
          This method propagates the spacecrafts dynamics with a chosen ``atol``
          ``rtol`` from ``t0``, ``x0``, ``l0`` to ``t0``, then returns a `numpy.ndarray`
          with the number of rows corresponding to the number of data points
          along the trajectory (as determinded by ``atol`` and ``rtol``), and 19
          columns.
  
          Args:
              - atol (``float``, ``int``): Absolute integration solution tolerance.
              - rtol (``float``, ``int``): Relative integration solution tolerance.
  
          Returns:
              - ``numpy.ndarray``: Trajectory data array of shape ``(npts, 20)``, where
                ``npts`` is the number of data points along the trajectory, as determind by the integration
                error tolerances ``atol`` and ``rtol``.
  
              The returned array is characterised by:
              ::
  
                  [[t0, x0, y0, z0, vx0, vy0, vz0, m0, lx0, ly0, lz0, lvx0, lvy0, lvz0, lm0, obj, u0, ux0, uy0, uz0, H0],
                  ...
                   [tf, xf, yf, zf, vxf, vyf, vzf, mf, lxf, lyf, lzf, lvxf, lvyf, lvzf, lmf, obj, uf, uxf, uyf, uzf, Hf]]
  
          Raises:
              - TypeError: If either ``atol`` or ``rtol`` is supplied as neither an instance of ``float`` nor ``int``.
              - AttributeError: If boundary conditions ``t0``, ``x0``, ``l0``, ``tf``, and ``x0`` have not been set through either ``__init__`` or ``set``.
  
          .. note::
              The returned array has the units of
              [mjd2000, m, m, m, m/s, m/s, m/s, kg, ND, ND, ND, ND, ND, ND, ND, s, ND, ND, ND, ND, ND].
  
          .. note::
              Setting either ``atol`` or ``rtol`` smaller than ``1e-12`` may result in numerical integration difficulties.
  
          Examples:
              >>> l = leg(t0, x0, l0, tf, xf)
              >>> traj = l.get_states(atol=1e-12, rtol=1e-12)
              >>> t = traj[:, 0] # times
              >>> r = traj[:, 1:4] # positions
              >>> v = traj[:, 4:7] # velocities
              >>> m = traj[:, 7] # masses
              >>> lm = traj[:, 14] # mass costates
              >>> u = traj[:, 15] # control throttles
              >>> H = traj[:, 19] # Hamiltonians
              >>> plt.plot(t, u) # plot the control throttle history
              >>> plt.show()
docstring_summary: Returns the trajectory data of time, states, costates, and controls.
docstring_tokens: Returns the trajectory data of time states costates and controls .
function: def get_states(self, atol=1e-12, rtol=1e-12):
          """Returns the trajectory data of time, states, costates, and controls.
  
          This method propagates the spacecrafts dynamics with a chosen ``atol``
          ``rtol`` from ``t0``, ``x0``, ``l0`` to ``t0``, then returns a `numpy.ndarray`
          with the number of rows corresponding to the number of data points
          along the trajectory (as determinded by ``atol`` and ``rtol``), and 19
          columns.
  
          Args:
              - atol (``float``, ``int``): Absolute integration solution tolerance.
              - rtol (``float``, ``int``): Relative integration solution tolerance.
  
          Returns:
              - ``numpy.ndarray``: Trajectory data array of shape ``(npts, 20)``, where
                ``npts`` is the number of data points along the trajectory, as determind by the integration
                error tolerances ``atol`` and ``rtol``.
  
              The returned array is characterised by:
              ::
  
                  [[t0, x0, y0, z0, vx0, vy0, vz0, m0, lx0, ly0, lz0, lvx0, lvy0, lvz0, lm0, obj, u0, ux0, uy0, uz0, H0],
                  ...
                   [tf, xf, yf, zf, vxf, vyf, vzf, mf, lxf, lyf, lzf, lvxf, lvyf, lvzf, lmf, obj, uf, uxf, uyf, uzf, Hf]]
  
          Raises:
              - TypeError: If either ``atol`` or ``rtol`` is supplied as neither an instance of ``float`` nor ``int``.
              - AttributeError: If boundary conditions ``t0``, ``x0``, ``l0``, ``tf``, and ``x0`` have not been set through either ``__init__`` or ``set``.
  
          .. note::
              The returned array has the units of
              [mjd2000, m, m, m, m/s, m/s, m/s, kg, ND, ND, ND, ND, ND, ND, ND, s, ND, ND, ND, ND, ND].
  
          .. note::
              Setting either ``atol`` or ``rtol`` smaller than ``1e-12`` may result in numerical integration difficulties.
  
          Examples:
              >>> l = leg(t0, x0, l0, tf, xf)
              >>> traj = l.get_states(atol=1e-12, rtol=1e-12)
              >>> t = traj[:, 0] # times
              >>> r = traj[:, 1:4] # positions
              >>> v = traj[:, 4:7] # velocities
              >>> m = traj[:, 7] # masses
              >>> lm = traj[:, 14] # mass costates
              >>> u = traj[:, 15] # control throttles
              >>> H = traj[:, 19] # Hamiltonians
              >>> plt.plot(t, u) # plot the control throttle history
              >>> plt.show()
          """
  
          if not all([(isinstance(tol, float) or isinstance(tol, int)) for tol in [atol, rtol]]):
              raise TypeError(
                  "Both atol and rtol must be supplied as instances of either float or int.")
          if any([hasattr(self, atr) == False for atr in ["t0", "x0", "l0", "tf", "xf"]]):
              raise AttributeError(
                  "Cannot propagate dynamics, as boundary conditions t0, x0, l0, tf, and xf have not been set. Use set(t0, x0, l0, tf, xf) to set boundary conditions.")
          else:
              atol = float(atol)
              rtol = float(atol)
  
          # propagate trajectory
          self._propagate(atol, rtol)
  
          # nondimensional times
          t = np.copy(self.times)
          # mjs2000 times
          t *= self._dynamics.T
          # mjd2000 times
          t /= 24 * 60 * 60
          # reshape
          t = t.reshape(t.size, 1)
  
          # controls
          u = np.asarray([self._dynamics._pontryagin(fs)
                          for fs in self.trajectory])
  
          # get Hamiltonian
          H = np.asarray([self._dynamics._hamiltonian(fs)
                          for fs in self.trajectory])
          H = H.reshape(H.size, 1)
  
          # get trajectory
          traj = np.copy(self.trajectory)
          # redimensionalise trajectory
          traj[:, 0:3] *= self._dynamics.L
          traj[:, 3:6] *= self._dynamics.V
          traj[:,   6] *= self._dynamics.M
  
          # assemble full trajectory history
          traj = np.hstack((t, traj, u, H))
  
          return traj
function_tokens: def get_states ( self , atol = 1e-12 , rtol = 1e-12 ) : if not all ( [ ( isinstance ( tol , float ) or isinstance ( tol , int ) ) for tol in [ atol , rtol ] ] ) : raise TypeError ( "Both atol and rtol must be supplied as instances of either float or int." ) if any ( [ hasattr ( self , atr ) == False for atr in [ "t0" , "x0" , "l0" , "tf" , "xf" ] ] ) : raise AttributeError ( "Cannot propagate dynamics, as boundary conditions t0, x0, l0, tf, and xf have not been set. Use set(t0, x0, l0, tf, xf) to set boundary conditions." ) else : atol = float ( atol ) rtol = float ( atol ) # propagate trajectory self . _propagate ( atol , rtol ) # nondimensional times t = np . copy ( self . times ) # mjs2000 times t *= self . _dynamics . T # mjd2000 times t /= 24 * 60 * 60 # reshape t = t . reshape ( t . size , 1 ) # controls u = np . asarray ( [ self . _dynamics . _pontryagin ( fs ) for fs in self . trajectory ] ) # get Hamiltonian H = np . asarray ( [ self . _dynamics . _hamiltonian ( fs ) for fs in self . trajectory ] ) H = H . reshape ( H . size , 1 ) # get trajectory traj = np . copy ( self . trajectory ) # redimensionalise trajectory traj [ : , 0 : 3 ] *= self . _dynamics . L traj [ : , 3 : 6 ] *= self . _dynamics . V traj [ : , 6 ] *= self . _dynamics . M # assemble full trajectory history traj = np . hstack ( ( t , traj , u , H ) ) return traj