Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions filterpy/kalman/EKF.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def predict_update(self, z, HJacobian, Hx, args=(), hx_args=(), u=0):
if np.isscalar(z) and self.dim_z == 1:
z = np.asarray([z], float)

F = self.F
F = self.FJacobian()
B = self.B
P = self.P
Q = self.Q
Expand Down Expand Up @@ -341,14 +341,21 @@ def update(self, z, HJacobian, Hx, R=None, args=(), hx_args=(),
self.x_post = self.x.copy()
self.P_post = self.P.copy()

def FJacobian(self, u=0):
"""
Calculates the Jacobian of the transition matrix. Override if F is not sufficient.
"""
return self.F

def predict_x(self, u=0):
"""
Predicts the next state of X. If you need to
compute the next state yourself, override this function. You would
need to do this, for example, if the usual Taylor expansion to
generate F is not providing accurate results for you.
"""
self.x = dot(self.F, self.x) + dot(self.B, u)
F = self.FJacobian()
self.x = dot(F, self.x) + dot(self.B, u)

def predict(self, u=0):
"""
Expand All @@ -364,7 +371,8 @@ def predict(self, u=0):
"""

self.predict_x(u)
self.P = dot(self.F, self.P).dot(self.F.T) + self.Q
F = self.FJacobian()
self.P = dot(F, self.P).dot(F.T) + self.Q

# save prior
self.x_prior = np.copy(self.x)
Expand Down Expand Up @@ -416,7 +424,7 @@ def __repr__(self):
pretty_str('P', self.P),
pretty_str('x_prior', self.x_prior),
pretty_str('P_prior', self.P_prior),
pretty_str('F', self.F),
pretty_str('F', self.FJacobian()),
pretty_str('Q', self.Q),
pretty_str('R', self.R),
pretty_str('K', self.K),
Expand Down
83 changes: 83 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
[build-system]

# requires is a list of packages that are needed to build your package.
# You don’t need to install them;
# build frontends like pip will install them automatically in a temporary,
# isolated virtual environment for use during the build process
requires = ["setuptools", "setuptools-scm", "wheel"]
build-backend = "setuptools.build_meta"

[tool.setuptools.packages.find]
where = ["filterpy"]

[tool.setuptools.package-data]
"filterpy" = ["README.rst", "filterpy/changelog.txt", "LICENSE", "filterpy/kalman/tests/*.py"]

[tool.flake8]
max-line-length = 120
extend-ignore = ["E265"]
# Ignore block comment should start with '# ' because it causes issues with environment definition for scripts

[tool.autopep8]
max_line_length = 120
in-place = 1
aggressive = 1
ignore = ""

# this is the [project] table
[project]
# add the distribution name of the package, the tar ball and python wheel use this name, this name goes the /home/$USER/.local/lib/python3.8/site-packages/
name = "filterpy"

dynamic = ["dependencies", "optional-dependencies"]

# version is the package version. See the version specifier specification
# for more details on versions. Some build backends allow it to be
# specified another way, such as from a file or a git tag.
version = "0.2.0"
authors = [
{ name="Roger Labbe", email="rlabbejr@gmail.com" }
]
description = "Kalman filtering and optimal estimation library"
readme = "README.rst"
license = { file="LICENSE" }

# installers like pip use this to check for matching python versions
requires-python = ">=3.7"
classifiers = [
# How mature is this project? Common values are
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
"Development Status :: 5 - Production/Stable",

# Indicate who your project is intended for
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Mathematics",
"Topic :: Scientific/Engineering :: Physics",
"Topic :: Utilities",


# Pick your license as you wish (should match "license" above)
"License :: OSI Approved :: MIT License",

# Specify the Python versions you support here. In particular, ensure
# that you indicate whether you support Python 2, Python 3 or both.
"Programming Language :: Python :: 3.7",

"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Operating System :: Unix",
"Operating System :: MacOS"
]

[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}
optional-dependencies.readthedocs = {file = ["requirements.readthedocs.txt"]}

[project.urls]
"Homepage" = "http://github.com/rlabbe/filterpy"
"Bug Tracker" = "http://github.com/rlabbe/filterpy/issues/"
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
numpy
scipy
matplotlib
103 changes: 0 additions & 103 deletions setup.py

This file was deleted.