How to use the stonesoup.types.array.StateVector function in stonesoup

To help you get started, we’ve selected a few stonesoup examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dstl / Stone-Soup / stonesoup / types / orbitalstate.py View on Github external
.. math::

                    X = [e, a, i, \Omega, \omega, \\theta]^{T} \\

                where:
                :math:`e` is the orbital eccentricity (unitless),
                :math:`a` the semi-major axis ([length]),
                :math:`i` the inclination (rad),
                :math:`\Omega` is the longitude of the ascending node (rad),
                :math:`\omega` the argument of periapsis (rad), and
                :math:`\theta` the true anomaly (rad)

        """

        return StateVector(np.array([[self.eccentricity],
                           [self.semimajor_axis],
                           [self.inclination],
                           [self.longitude_ascending_node],
                           [self.argument_periapsis],
                           [self.true_anomaly]]))
github dstl / Stone-Soup / stonesoup / models / measurement / nonlinear.py View on Github external
\end{bmatrix}

    The :py:attr:`mapping` property of the model is a 3 element vector, \
    whose first (i.e. :py:attr:`mapping[0]`), second (i.e. \
    :py:attr:`mapping[1]`) and third (i.e. :py:attr:`mapping[2`) elements \
    contain the state index of the :math:`x`, :math:`y` and :math:`z`  \
    coordinates, respectively.

    Note
    ----
    The current implementation of this class assumes a 3D Cartesian plane.

    """  # noqa:E501

    translation_offset = Property(
        StateVector, default=StateVector(sp.array([[0], [0], [0]])),
        doc="A 3x1 array specifying the Cartesian origin offset in terms of :math:`x,y,z`\
            coordinates.")

    @property
    def ndim_meas(self):
        """ndim_meas getter method

        Returns
        -------
        :class:`int`
            The number of measurement dimensions
        """

        return 3

    def function(self, state_vector, noise=None, **kwargs):
github dstl / Stone-Soup / stonesoup / types / state.py View on Github external
def __init__(self, state_vector, *args, **kwargs):
        # Don't cast away subtype of state_vector if not necessary
        if state_vector is not None \
                and not isinstance(state_vector, StateVector):
            state_vector = StateVector(state_vector)
        super().__init__(state_vector, *args, **kwargs)
github dstl / Stone-Soup / stonesoup / types / orbitalstate.py View on Github external
-------
        : numpy.array
            The two line element input vector

                .. math::

                    X_{t_0} = [i, \Omega, e, \omega, M_0, n]^{T} \\

                where :math:`i` the inclination (rad),
                :math:`\Omega` is the longitude of the ascending node (rad),
                :math:`e` is the orbital eccentricity (unitless),
                :math:`\omega` the argument of periapsis (rad),
                :math:'M_0' the mean anomaly (rad)
                :math:`n` the mean motion (rad/[time])
        """
        return StateVector(np.array([[self.inclination],
                           [self.longitude_ascending_node],
                           [self.eccentricity],
                           [self.argument_periapsis],
                           [self.mean_anomaly],
                           [self.mean_motion]]))
github dstl / Stone-Soup / stonesoup / types / particle.py View on Github external
# -*- coding: utf-8 -*-

from ..base import Property
from .array import StateVector
from .base import Type


class Particle(Type):
    """
    Particle type

    A particle type which contains a state and weight
    """
    state_vector = Property(StateVector, doc="State vector")
    weight = Property(float, doc='Weight of particle')
    parent = Property(None, default=None, doc='Parent particle')

    def __init__(self, state_vector, weight, parent=None, *args, **kwargs):
        if parent:
            parent.parent = None
        super().__init__(state_vector, weight, parent, *args, **kwargs)
Particle.parent.cls = Particle  # noqa:E305
github dstl / Stone-Soup / stonesoup / types / orbitalstate.py View on Github external
:math:`h` is the horizontal component of the eccentricity
                :math:`e` (unitless),
                :math:`k` is the vertical component of the eccentricity
                :math:`e` (unitless),
                :math:`p` is the horizontal component of the inclination
                :math:`i` (unitless),
                :math:`q` is the vertical component of the inclination
                :math:`i` (unitless) and
                :math:'lambda' is the mean longitude (rad)

        Reference
        ---------
        Broucke, R. A. & Cefola, P. J. 1972, Celestial Mechanics, Volume 5, Issue 3, pp.303-310

        """
        return StateVector(np.array([[self.semimajor_axis],
                           [self.equinocital_h],
                           [self.equinocital_k],
                           [self.equinocital_p],
                           [self.equinocital_q],
                           [self.mean_longitude]]))
github dstl / Stone-Soup / stonesoup / models / measurement / nonlinear.py View on Github external
\end{bmatrix}

    The :py:attr:`mapping` property of the model is a 3 element vector, \
    whose first (i.e. :py:attr:`mapping[0]`), second (i.e. \
    :py:attr:`mapping[1]`) and third (i.e. :py:attr:`mapping[2]`) elements  \
    contain the state index of the :math:`x`, :math:`y` and :math:`z`  \
    coordinates, respectively.

    Note
    ----
    The current implementation of this class assumes a 3D Cartesian plane.

    """  # noqa:E501

    translation_offset = Property(
        StateVector, default=StateVector(sp.array([[0], [0], [0]])),
        doc="A 3x1 array specifying the origin offset in terms of :math:`x,y,z`\
            coordinates.")

    @property
    def ndim_meas(self):
        """ndim_meas getter method

        Returns
        -------
        :class:`int`
            The number of measurement dimensions
        """

        return 2

    def function(self, state_vector, noise=None, **kwargs):
github dstl / Stone-Soup / stonesoup / types / array.py View on Github external
def _cast(cls, val):
        # This tries to cast the result as either a StateVector or
        # Matrix type if applicable.
        if isinstance(val, np.ndarray):
            if val.ndim == 2:
                if val.shape[1] == 1:
                    return val.view(StateVector)
                else:
                    return val.view(Matrix)
            else:
                return val.view(Matrix)
        else:
            return val
github dstl / Stone-Soup / stonesoup / types / orbitalstate.py View on Github external
Returns
        -------
        : :class:~`StateVector`

            .. math::

                X_{t_0} = [r_x, r_y, r_z, \odot{r}_x, \odot{r}_y, \odot{r}_z]

            where:
            :math:`r_x, r_y, r_z` is the Cartesian position coordinate in Earth
            Centered Inertial (ECI) coordinates
            :math:`\odot{r}_x, \odot{r}_y, \odot{r}_z` is the velocity
            coordinate in ECI coordinates

        """
        return StateVector(self.state_vector)
github dstl / Stone-Soup / stonesoup / types / state.py View on Github external
def __init__(self, state_vector, *args, **kwargs):
        # Don't cast away subtype of state_vector if not necessary
        if state_vector is not None \
                and not isinstance(state_vector, StateVector):
            state_vector = StateVector(state_vector)
        super().__init__(state_vector, *args, **kwargs)