I recently made a small mistake when creating the covariance matrix for a measurement model. I used:
noise_covar=np.array([...])
which creates a 1D array instead of:
noise_covar=np.diag([...])
which creates a 2D square array with values along the diagonal
Using the wrong covariance matrix doesn't produce any error messages. The detections are produced successfully with scipy.stats.multivariate_normal.rvs produces the same result with either input. However the measurement covariance matrix is used when tracking. It's used when calculating the innovation covariance. This doesn't produce an error message either but does give the wrong result. Which leads to really bad tracking.
To can observe this by changing line 130 in tutorial number 2.
Fortunately I spotted my error pretty quickly but I worry others might not spot it so quickly.
I have thought of some options:
Do nothing. This was user error not a bug
Cast the noise_covar value to a CovarianceMatrix when initialising a MeasurementModel. Using a 1D array would result in a ValueError being throw
Add a warning if a 1D array is used in a measurement model
I recently made a small mistake when creating the covariance matrix for a measurement model. I used: noise_covar=np.array([...]) which creates a 1D array instead of: noise_covar=np.diag([...]) which creates a 2D square array with values along the diagonal
Using the wrong covariance matrix doesn't produce any error messages. The detections are produced successfully with scipy.stats.multivariate_normal.rvs produces the same result with either input. However the measurement covariance matrix is used when tracking. It's used when calculating the innovation covariance. This doesn't produce an error message either but does give the wrong result. Which leads to really bad tracking.
To can observe this by changing line 130 in tutorial number 2.
Fortunately I spotted my error pretty quickly but I worry others might not spot it so quickly.
I have thought of some options:
noise_covar
value to aCovarianceMatrix
when initialising a MeasurementModel. Using a 1D array would result in aValueError
being throw