Kalman Filter CHOP (Updated)

Here is a Script CHOP which applies Kalman filter to CHOP data. It is prepared as a container as a .tox file. You need to fine-tune your parameters in the script which are state estimate, estimate covariance, process noise and measurement noise.

GitHub Link

4 Likes

Hey this is great thanks!~

1 Like

Edit: Now it is a dedicated CHOP in form of a ScriptCHOP. It is tested, documented and evaluated. Finally uploaded it on GitHub.

The key changes are:

  • N-Dimensional Core: The algorithm was rebuilt using NumPy to handle multi-channel data (e.g., tx, ty, tz) with proper matrix maths, replacing the original scalar logic.
  • Professional State Management: It now uses a KalmanFilter class stored in op.storage instead of global variables, so multiple instances work independently.
  • Full Custom UI: All core filter parameters (Process Noise, Measurement Noise, Initial Covariance, etc.) are exposed on the interface. It also accepts user-defined A and H matrices via DATs for advanced modelling.
  • Built-in Graphing: The script uses scriptOp.isTimeSlice = False and an internal deque history buffer, allowing it to display the full filtered graph in its own viewer without needing a Trail CHOP.
  • Robust Behaviour: It’s now much more stable, using a try...except block with a pseudo-inverse fallback for matrix inversion to prevent crashes.