code: def copy_states(dst, src):
      """Copy filter states from `src` to `dst`.
  
      for each variable that `dst` and `src` have in common, use
      np.copy() to copy from the source to the destination.
  
      This has the potential of breaking things if you are using two different
      types - the destination could end up in an incorrect state since not
      all variables may be initalized correctly.
  
      The main use case is for testing or comparing different algorithms
  
          kf1 = KalmanFilter()
          kf1.F = ...
          kf1.P = ...
          kf2 = KalmanFilter()
          # reuse F, P, etc from kf1
          copy_states(kf2, kf1)
  
          for z in obs:
              kf1.predict()
              kf2.predict()
              ...
      """
      # get variables common to both objects
      v1, v2 = vars(dst), vars(src)
      k1, k2 = set(v1.keys()), set(v2.keys())
      attrs = k2.intersection(k1)
  
      for key in attrs:
          val = getattr(src, key)
          if type(val).__name__ not in ["method", "function"]:
              dst.__dict__[key] = copy.deepcopy(val)
  
imports: from __future__ import print_function
  from collections import defaultdict, deque
  import copy
  import inspect
  import numpy
label_desc: Use image node_id 8 for calling a global function with example usage: copy_states(dst, src) without return types