Search code examples
pythonkalman-filter

Numpy.ndarray object is not callable error reason


I am implementing unscented kalman filter and getting this error "numpy.ndarray object is not callable" for the non-linear function 'g' in the prediction step.

enter image description here

I have also attached my code where I got this error. Any assistance would be highly appreciated. Thanks!


Solution

  • Just like the error message says, gx is a numpy array:

    gx = np.array([g_E, g_R])
    

    But you are trying to call it as if it were a function:

    self.sigmas_x[:,i] = gx(self.sigmas[:,i],dt, u) 
    

    Hence the error.