Closed geofffoster closed 10 months ago
It installs fine.
When I run the example nothing happens, ie no output, it doesn't do anything. Im running anaconda Python 3.9.15
import numpy as np from kalmantv.cython import KalmanTV n_meas = 2 # Set the size of the measurement n_state = 4 # Set the size of the state
mu_state_past = np.random.rand(n_state) var_state_past = np.random.rand(n_state, n_state) var_state_past = var_state_past.dot(var_state_past.T) #Ensure positive semidefinite var_state_past = np.asfortranarray(var_state_past) # must use Fortran order
mu_state = np.random.rand(n_state) wgt_state = np.random.rand(n_state, n_state).T # converts to Fortran order var_state = np.random.rand(n_state, n_state) var_state = var_state.dot(var_state.T).T x_meas = np.random.rand(n_meas) mu_meas = np.random.rand(n_meas) wgt_meas = np.random.rand(n_state, n_meas).T var_meas = np.random.rand(n_meas, n_meas) var_meas = var_meas.dot(var_meas.T).T
ktv = KalmanTV(n_meas, n_state)
mu_state_pred = np.empty(n_state) var_state_pred = np.empty((n_state, n_state), order='F') mu_state_filt = np.empty(n_state) var_state_filt = np.empty((n_state, n_state), order='F')
ktv.filter(mu_state_pred, var_state_pred, mu_state_filt, var_state_filt, mu_state_past, var_state_past, mu_state, wgt_state, var_state, x_meas, mu_meas, wgt_meas, var_meas)
Hi, sorry for the slow response... Can you please confirm whether the outputs mu_state_pred, etc. have been updated in-place?
mu_state_pred
It installs fine.
When I run the example nothing happens, ie no output, it doesn't do anything. Im running anaconda Python 3.9.15
import numpy as np from kalmantv.cython import KalmanTV n_meas = 2 # Set the size of the measurement n_state = 4 # Set the size of the state
Set initial mu and var of the state variable
mu_state_past = np.random.rand(n_state) var_state_past = np.random.rand(n_state, n_state) var_state_past = var_state_past.dot(var_state_past.T) #Ensure positive semidefinite var_state_past = np.asfortranarray(var_state_past) # must use Fortran order
Parameters to the Kalman Filter
mu_state = np.random.rand(n_state) wgt_state = np.random.rand(n_state, n_state).T # converts to Fortran order var_state = np.random.rand(n_state, n_state) var_state = var_state.dot(var_state.T).T x_meas = np.random.rand(n_meas) mu_meas = np.random.rand(n_meas) wgt_meas = np.random.rand(n_state, n_meas).T var_meas = np.random.rand(n_meas, n_meas) var_meas = var_meas.dot(var_meas.T).T
Initialize the KalmanTV class
ktv = KalmanTV(n_meas, n_state)
Allocate memory for storing the output
mu_state_pred = np.empty(n_state) var_state_pred = np.empty((n_state, n_state), order='F') mu_state_filt = np.empty(n_state) var_state_filt = np.empty((n_state, n_state), order='F')
Run the filtering algorithm
ktv.filter(mu_state_pred, var_state_pred, mu_state_filt, var_state_filt, mu_state_past, var_state_past, mu_state, wgt_state, var_state, x_meas, mu_meas, wgt_meas, var_meas)