Skip to content

Commit

Permalink
EKF: Use function _assert_numerical_positive_variable to validate inp…
Browse files Browse the repository at this point in the history
…ut values.
  • Loading branch information
Mayitzin committed Feb 3, 2025
1 parent 9b16154 commit 9525a28
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions ahrs/filters/ekf.py
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,7 @@
from ..common.mathfuncs import skew

from ..utils.core import _assert_numerical_iterable
from ..utils.core import _assert_numerical_positive_variable

class EKF:
"""
Expand Down Expand Up @@ -1044,12 +1045,7 @@ def _set_reference_frames(self, mref: float, frame: str = 'NED') -> None:
def _assert_validity_of_inputs(self):
"""Asserts the validity of the inputs."""
for item in ["frequency", "Dt"]:
if isinstance(self.__getattribute__(item), bool):
raise TypeError(f"Parameter '{item}' must be numeric.")
if not isinstance(self.__getattribute__(item), (int, float)):
raise TypeError(f"Parameter '{item}' is not a non-zero number.")
if self.__getattribute__(item) <= 0.0:
raise ValueError(f"Parameter '{item}' must be a non-zero number.")
_assert_numerical_positive_variable(getattr(self, item), item)
for item in ['q0', 'P', 'R']:
if self.__getattribute__(item) is not None:
if isinstance(self.__getattribute__(item), bool):
Expand Down

0 comments on commit 9525a28

Please sign in to comment.