Skip to content

Commit

Permalink
Change dtype of Matrix to float
Browse files Browse the repository at this point in the history
  • Loading branch information
orosoman-dstl committed Aug 31, 2023
1 parent b3f3330 commit 92f7f6b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/tutorials/01_KalmanFilterTutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@
# responsibility, a :class:`~.Predictor` takes a :class:`~.TransitionModel` as input and
# an :class:`~.Updater` takes a :class:`~.MeasurementModel` as input. Note that for now we're using
# the same models used to generate the ground truth and the simulated measurements. This won't
# usually be possible and it's an interesting exercise to explore what happens when these
# usually be possible, and it's an interesting exercise to explore what happens when these
# parameters are mismatched.
from stonesoup.predictor.kalman import KalmanPredictor
predictor = KalmanPredictor(transition_model)
Expand Down
7 changes: 4 additions & 3 deletions stonesoup/models/transition/nonlinear.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import numpy as np
from scipy.linalg import block_diag

from ...types.array import StateVector, StateVectors, Matrix
from ...types.array import StateVector, StateVector
from .base import TransitionModel
from ..base import GaussianModel, TimeVariantModel
from ...base import Property
Expand Down Expand Up @@ -95,8 +95,9 @@ def function(self, state, noise=False, **kwargs) -> StateVector:
sv1 = state.state_vector
turn_rate = sv1[4, :]
# Avoid divide by zero in the function evaluation
if turn_rate[0] == 0:
turn_rate = Matrix([np.finfo(float).eps])
if turn_rate.dtype != float:
turn_rate = turn_rate.astype(float)
turn_rate[turn_rate == 0.] = np.finfo(float).eps
dAngle = turn_rate * time_interval_sec
cos_dAngle = np.cos(dAngle)
sin_dAngle = np.sin(dAngle)
Expand Down

0 comments on commit 92f7f6b

Please sign in to comment.