python3Packages.pykalman: init at 0.9.5
This commit is contained in:
parent
5a3de0e783
commit
78cb8e54f3
4 changed files with 73 additions and 0 deletions
44
pkgs/development/python-modules/pykalman/default.nix
Normal file
44
pkgs/development/python-modules/pykalman/default.nix
Normal file
|
@ -0,0 +1,44 @@
|
|||
{ lib
|
||||
, buildPythonPackage
|
||||
, fetchPypi
|
||||
, numpy
|
||||
, scipy
|
||||
, pytestCheckHook
|
||||
, nose
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "pykalman";
|
||||
version = "0.9.5";
|
||||
format = "setuptools";
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
hash = "sha256-gWr0dyDZJKTGAW+nS54sjCEWWgjZFpPDIqF0Ho4H+zg=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# https://github.com/pykalman/pykalman/issues/83
|
||||
./fix-masked-arrays-not-supported.patch
|
||||
# python 3.11 issues fix: https://github.com/pykalman/pykalman/pull/101
|
||||
./fix-p311-issues.patch
|
||||
];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
numpy
|
||||
scipy
|
||||
];
|
||||
|
||||
nativeCheckInputs = [
|
||||
pytestCheckHook
|
||||
nose
|
||||
];
|
||||
pythonImportsCheck = [ "pykalman" ];
|
||||
|
||||
meta = with lib; {
|
||||
description = "An implementation of the Kalman Filter, Kalman Smoother, and EM algorithm in Python";
|
||||
homepage = "https://github.com/pykalman/pykalman";
|
||||
license = licenses.bsd2;
|
||||
maintainers = with maintainers; [ mbalatsko ];
|
||||
};
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
--- a/pykalman/utils.py
|
||||
+++ b/pykalman/utils.py
|
||||
@@ -70,7 +70,10 @@
|
||||
cv_chol = linalg.cholesky(cv + min_covar * np.eye(n_dim),
|
||||
lower=True)
|
||||
cv_log_det = 2 * np.sum(np.log(np.diagonal(cv_chol)))
|
||||
- cv_sol = solve_triangular(cv_chol, (X - mu).T, lower=True).T
|
||||
+ try:
|
||||
+ cv_sol = solve_triangular(cv_chol, (X - mu).T, lower=True).T
|
||||
+ except ValueError:
|
||||
+ cv_sol = np.linalg.solve(cv_chol, (X - mu).T).T
|
||||
log_prob[:, c] = - .5 * (np.sum(cv_sol ** 2, axis=1) + \
|
||||
n_dim * np.log(2 * np.pi) + cv_log_det)
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
--- a/pykalman/utils.py
|
||||
+++ b/pykalman/utils_copy.py
|
||||
@@ -40,6 +40,10 @@
|
||||
from scipy import linalg
|
||||
|
||||
|
||||
+# monkey patch
|
||||
+if not hasattr(inspect, 'getargspec'):
|
||||
+ inspect.getargspec = inspect.getfullargspec
|
||||
+
|
||||
def array1d(X, dtype=None, order=None):
|
||||
"""Returns at least 1-d array with data from X"""
|
||||
return np.asarray(np.atleast_1d(X), dtype=dtype, order=order)
|
|
@ -9439,6 +9439,8 @@ self: super: with self; {
|
|||
|
||||
pykaleidescape = callPackage ../development/python-modules/pykaleidescape { };
|
||||
|
||||
pykalman = callPackage ../development/python-modules/pykalman { };
|
||||
|
||||
pykdl = callPackage ../development/python-modules/pykdl { };
|
||||
|
||||
pykdtree = callPackage ../development/python-modules/pykdtree {
|
||||
|
|
Loading…
Reference in a new issue