def rotation(self, times, target='ECLIPJ2000'): '''Get the rotation matrix for rotating this object from its own reference frame to that of the observer. :type times: ``Iterable`` | has ``__float__()`` :arg times: The point(s) in time for which to calculate rotations. :type observer: :py:class:`~spiceminer.bodies.Body` | ``str`` :arg observer: Object/reference frame to transform to. :return: (``list``) -- The list of 3x3 rotation matrizes. :raises: (``TypeError``) -- If an argument doesn't conform to the type requirements. (:py:class:`~spiceminer._spicewrapper.SpiceError`) -- If there is necessary information missing. ''' if isinstance(target, Body): target = target._frame or target.name if isinstance(times, numbers.Real): times = [float(times)] if isinstance(times, collections.Iterable): result = [] valid_times = [] for time in times: with ignored(spice.SpiceError): result.append(spice.pxform(self._frame or self.name, target, Time.fromposix(time).et())) valid_times.append(time) return numpy.array(valid_times), [numpy.array(item).reshape(3, 3) for item in result] msg = 'rotation() Real or Iterable argument expected, got {}.' raise TypeError(msg.format(type(times)))
def single_rotation(self, time, target='ECLIPJ2000'): if isinstance(target, Body): target = target._frame or destination.name return numpy.array(spice.pxform(self._frame or self.name, target, Time.fromposix(time).et())).reshape(3, 3)