code: def gradient(self, q, t=0.):
          
          q = self._remove_units_prepare_shape(q)
          orig_shape, q = self._get_c_valid_arr(q)
          t = self._validate_prepare_time(t, q)
          ret_unit = self.units['length'] / self.units['time']**2
          return (self._gradient(q, t=t).T.reshape(orig_shape) * ret_unit).to(self.units['acceleration'])
docs: Compute the gradient of the potential at the given position(s).
  
          Parameters
          ----------
          q : `~gala.dynamics.PhaseSpacePosition`, `~astropy.units.Quantity`, array_like
              The position to compute the value of the potential. If the
              input position object has no units (i.e. is an `~numpy.ndarray`),
              it is assumed to be in the same unit system as the potential.
  
          Returns
          -------
          grad : `~astropy.units.Quantity`
              The gradient of the potential. Will have the same shape as
              the input position.