How to use the stonesoup.models.base.TimeVariantModel 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 / models / transition / linear.py View on Github external
return self.transition_matrix

    def covar(self, **kwargs):
        """Returns the transition model noise covariance matrix.

        Returns
        -------
        : :class:`stonesoup.types.state.CovarianceMatrix` of shape\
        (:py:attr:`~ndim_state`, :py:attr:`~ndim_state`)
            The process noise covariance.
        """

        return self.covariance_matrix


class ConstantVelocity(LinearGaussianTransitionModel, TimeVariantModel):
    r"""This is a class implementation of a time-variant 1D Linear-Gaussian
    Constant Velocity Transition Model.

    The target is assumed to move with (nearly) constant velocity, where
    target acceleration is model as white noise.

    The model is described by the following SDEs:

        .. math::
            :nowrap:

            \begin{eqnarray}
                dx_{pos} & = & x_{vel} d & | {Position \ on \
                X-axis (m)} \\
                dx_{vel} & = & q\cdot dW_t,\ W_t \sim \mathcal{N}(0,q^2) & | \
                Speed on\ X-axis (m/s)
github dstl / Stone-Soup / stonesoup / models / transition / linear.py View on Github external
Q_t & = & \begin{bmatrix}
                        \frac{dt^5}{20} & \frac{dt^4}{8} & \frac{dt^3}{6} \\
                        \frac{dt^4}{8} & \frac{dt^3}{3} & \frac{dt^2}{2} \\
                        \frac{dt^3}{6} & \frac{dt^2}{2} & dt
                      \end{bmatrix} q
    """
    noise_diff_coeff = Property(
        float, doc="The acceleration noise diffusion coefficient :math:`q`")

    @property
    def constant_derivative(self):
        """For constant acceleration, this is 2."""
        return 2


class Singer(LinearGaussianTransitionModel, TimeVariantModel):
    r"""This is a class implementation of a time-variant 1D Singer Transition
    Model.

    The target acceleration is modeled as a zero-mean Gauss-Markov random
    process.

    The model is described by the following SDEs:

        .. math::
            :nowrap:

            \begin{eqnarray}
                dx_{pos} & = & x_{vel} d & | {Position \ on \
                X-axis (m)} \\
                dx_{vel} & = & x_{acc} d & | {Speed \
                on\ X-axis (m/s)} \\
github dstl / Stone-Soup / stonesoup / models / transition / linear.py View on Github external
:class:`stonesoup.types.state.CovarianceMatrix` of shape\
        (:py:attr:`~ndim_state`, :py:attr:`~ndim_state`)
            The process noise covariance.
        """

        time_interval_sec = time_interval.total_seconds()

        covar = sp.array([[sp.power(time_interval_sec, 3)/3,
                           sp.power(time_interval_sec, 2)/2],
                          [sp.power(time_interval_sec, 2)/2,
                           time_interval_sec]])*self.noise_diff_coeff

        return CovarianceMatrix(covar)


class ConstantAcceleration(LinearGaussianTransitionModel, TimeVariantModel):
    r"""This is a class implementation of a time-variant 1D Constant
    Acceleration Transition Model.

    The target acceleration is modeled as a zero-mean white noise random
    process.

    The model is described by the following SDEs:

        .. math::
            :nowrap:

            \begin{eqnarray}
                dx_{pos} & = & x_{vel} d & | {Position \ on \
                X-axis (m)} \\
                dx_{vel} & = & x_{acc} d & | {Speed \
                on\ X-axis (m/s)} \\
github dstl / Stone-Soup / stonesoup / models / transition / linear.py View on Github external
covar = sp.array(
            [[sp.power(time_interval_sec, 5) / 20,
              sp.power(time_interval_sec, 4) / 8,
              sp.power(time_interval_sec, 3) / 6],
             [sp.power(time_interval_sec, 4) / 8,
              sp.power(time_interval_sec, 3) / 3,
              sp.power(time_interval_sec, 2) / 2],
             [sp.power(time_interval_sec, 3) / 6,
              sp.power(time_interval_sec, 2) / 2,
              time_interval_sec]]
        ) * self.noise_diff_coeff

        return CovarianceMatrix(covar)


class ConstantTurn(LinearGaussianTransitionModel, TimeVariantModel):
    r"""This is a class implementation of a time-variant 2D Constant Turn
    Model.

    The target is assumed to move with (nearly) constant velocity and also
    known (nearly) constant turn rate.

    The model is described by the following SDEs:

        .. math::
            :nowrap:

            \begin{eqnarray}
                dx_{pos} & = & x_{vel} d & | {Position \ on \
                X-axis (m)} \\
                dx_{vel} & = &-\omega y_{pos} d & | {Speed \
                on\ X-axis (m/s)} \\
github dstl / Stone-Soup / stonesoup / models / transition / linear.py View on Github external
covar = sp.array(
            [[sp.power(time_interval_sec, 5) / 20,
              sp.power(time_interval_sec, 4) / 8,
              sp.power(time_interval_sec, 3) / 6],
             [sp.power(time_interval_sec, 4) / 8,
              sp.power(time_interval_sec, 3) / 3,
              sp.power(time_interval_sec, 2) / 2],
             [sp.power(time_interval_sec, 3) / 6,
              sp.power(time_interval_sec, 2) / 2,
              time_interval_sec]]
        ) * self.noise_diff_coeff

        return CovarianceMatrix(covar)


class ConstantTurn(LinearGaussianTransitionModel, TimeVariantModel):
    r"""This is a class implementation of a time-variant 2D Constant Turn
    Model.

    The target is assumed to move with (nearly) constant velocity and also
    known (nearly) constant turn rate.

    The model is described by the following SDEs:

        .. math::
            :nowrap:

            \begin{eqnarray}
                dx_{pos} & = & x_{vel} d & | {Position \ on \
                X-axis (m)} \\
                dx_{vel} & = &-\omega y_{pos} d & | {Speed \
                on\ X-axis (m/s)} \\
github dstl / Stone-Soup / stonesoup / models / transition / linear.py View on Github external
dt = time_interval.total_seconds()

        exp_kdt = sp.exp(-k*dt)
        exp_2kdt = sp.exp(-2*k*dt)

        q11 = q*(dt - 2/k*(1 - exp_kdt) + 1/(2*k)*(1 - exp_2kdt))/(k**2)
        q12 = q*((1 - exp_kdt)/k - 1/(2*k)*(1 - exp_2kdt))/k
        q22 = q*(1 - exp_2kdt)/(2*k)

        covar = sp.array([[q11, q12],
                          [q12, q22]])

        return CovarianceMatrix(covar)


class ConstantNthDerivative(LinearGaussianTransitionModel, TimeVariantModel):
    r"""Model based on the Nth derivative with respect to time being constant,
    to set derivative use keyword argument :attr:`constant_derivative`

     The model is described by the following SDEs:

        .. math::
            :nowrap:

            \begin{eqnarray}
                dx^{(N-1)} & = & x^{(N)} dt & | {Position \ on \
                X-axis (m)} \\
                dx^{(N)} & = & q\cdot dW_t,\ W_t \sim \mathcal{N}(0,q^2) & | \
                Nth\ derivative\ on\ X-axis (m/s^{N})
            \end{eqnarray}

    It is hard to represent the matrix form of these due to the fact that they
github dstl / Stone-Soup / stonesoup / models / transition / linear.py View on Github external
return self.transition_matrix

    def covar(self, **kwargs):
        """Returns the transition model noise covariance matrix.

        Returns
        -------
        : :class:`stonesoup.types.state.CovarianceMatrix` of shape\
        (:py:attr:`~ndim_state`, :py:attr:`~ndim_state`)
            The process noise covariance.
        """

        return self.covariance_matrix


class OrnsteinUhlenbeck(LinearGaussianTransitionModel, TimeVariantModel):
    r"""This is a class implementation of a time-variant 1D Linear-Gaussian
    Ornstein Uhlenbeck Transition Model.

    The target is assumed to move with (nearly) constant velocity, which
    exponentially decays to zero over time, and target acceleration is
    modeled as white noise.

    The model is described by the following SDEs:

        .. math::
            :nowrap:

            \begin{eqnarray}
                dx_{pos} & = & x_{vel} dt & | {Position \ on \
                X-axis (m)} \\
                dx_{vel} & = & -K x_{vel} dt + q dW_t,
github dstl / Stone-Soup / stonesoup / models / transition / linear.py View on Github external
covar = sp.array(
            [[sp.power(time_interval_sec, 5) / 20,
              sp.power(time_interval_sec, 4) / 8,
              sp.power(time_interval_sec, 3) / 6],
             [sp.power(time_interval_sec, 4) / 8,
              sp.power(time_interval_sec, 3) / 3,
              sp.power(time_interval_sec, 2) / 2],
             [sp.power(time_interval_sec, 3) / 6,
              sp.power(time_interval_sec, 2) / 2,
              time_interval_sec]]) * sp.power(self.noise_diff_coeff, 2)

        return CovarianceMatrix(covar)


class Singer(LinearGaussianTransitionModel, TimeVariantModel):
    r"""This is a class implementation of a time-variant 1D Singer Transition
    Model.

    The target acceleration is modeled as a zero-mean Gauss-Markov random
    process.

    The model is described by the following SDEs:

        .. math::
            :nowrap:

            \begin{eqnarray}
                dx_{pos} & = & x_{vel} d & | {Position \ on \
                X-axis (m)} \\
                dx_{vel} & = & x_{acc} d & | {Speed \
                on\ X-axis (m/s)} \\