Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
input of the function.
Parameters
----------
state_vector: :class:`~.StateVector`
Input state vector (non-linear format)
Returns
-------
: :class:`numpy.ndarray`
The linear co-ordinates
"""
pass
class TimeVariantModel(Model):
"""TimeVariantModel class
Base/Abstract class for all time-variant models"""
class TimeInvariantModel(Model):
"""TimeInvariantModel class
Base/Abstract class for all time-invariant models"""
class GaussianModel(Model):
"""GaussianModel class
Base/Abstract class for all Gaussian models"""
# -*- coding: utf-8 -*-
from abc import abstractmethod
import scipy as sp
from ..base import Model
from ...base import Property
class ControlModel(Model):
"""Control Model base class"""
ndim_state = Property(int, doc="Number of state dimensions")
mapping = Property(
sp.ndarray, doc="Mapping between control and state dims")
@property
@abstractmethod
def ndim_ctrl(self):
"""Number of control input dimensions"""
pass
def function(self, state_vector, noise=None):
""" Model function"""
pass
@abstractmethod
def rvs(self, num_samples=1):
"""Model noise/sample generation method"""
pass
@abstractmethod
def pdf(self, state_vector1, state_vector2):
"""Model pdf/likelihood evaluator method"""
pass
class LinearModel(Model):
"""LinearModel class
Base/Abstract class for all linear models"""
@abstractmethod
def matrix(self):
""" Model matrix"""
pass
def function(self, state_vector, noise=None, **kwargs):
"""Model linear function :math:`f_k(x(k),w(k)) = F_k(x_k) + w_k`
Parameters
----------
state_vector: :class:`~.StateVector`
An input state vector
Returns
-------
: :class:`numpy.ndarray`
The linear co-ordinates
"""
pass
class TimeVariantModel(Model):
"""TimeVariantModel class
Base/Abstract class for all time-variant models"""
class TimeInvariantModel(Model):
"""TimeInvariantModel class
Base/Abstract class for all time-invariant models"""
class GaussianModel(Model):
"""GaussianModel class
Base/Abstract class for all Gaussian models"""
def rvs(self, num_samples=1, **kwargs):
r"""Model noise/sample generation function
Generates noise samples from the model.
In mathematical terms, this can be written as:
# -*- coding: utf-8 -*-
from abc import abstractmethod
import scipy as sp
from ..base import Model
from ...base import Property
class MeasurementModel(Model):
"""Measurement Model base class"""
ndim_state = Property(int, doc="Number of state dimensions")
mapping = Property(
sp.ndarray, doc="Mapping between measurement and state dims")
@property
def ndim(self):
return self.ndim_meas
@property
@abstractmethod
def ndim_meas(self):
"""Number of measurement dimensions"""
pass
:meth:`~.Model.rvs`)
Returns
-------
: :class:`numpy.ndarray`
The model function evaluated.
"""
if noise is None:
# TODO: doesn't make sense for noise=None to generate noise
noise = self.rvs(**kwargs)
return self.matrix(**kwargs) @ state_vector + noise
class NonLinearModel(Model):
"""NonLinearModel class
Base/Abstract class for all non-linear models"""
def jacobian(self, state_vector, **kwargs):
"""Model jacobian matrix :math:`H_{jac}`
Parameters
----------
state_vector : :class:`~.StateVector`
An input state vector
Returns
-------
:class:`numpy.ndarray` of shape (:py:attr:`~ndim_meas`, \
:py:attr:`~ndim_state`)
# -*- coding: utf-8 -*-
from abc import abstractmethod
from ..base import Model
class TransitionModel(Model):
"""Transition Model base class"""
@property
def ndim(self):
return self.ndim_state
@property
@abstractmethod
def ndim_state(self):
"""Number of state dimensions"""
pass
pass
class TimeVariantModel(Model):
"""TimeVariantModel class
Base/Abstract class for all time-variant models"""
class TimeInvariantModel(Model):
"""TimeInvariantModel class
Base/Abstract class for all time-invariant models"""
class GaussianModel(Model):
"""GaussianModel class
Base/Abstract class for all Gaussian models"""
def rvs(self, num_samples=1, **kwargs):
r"""Model noise/sample generation function
Generates noise samples from the model.
In mathematical terms, this can be written as:
.. math::
v_t \sim \mathcal{N}(0,Q)
where :math:`v_t =` ``noise`` and :math:`Q` = :attr:`covar`.