code: def init_kf_filterpy(measurements, adapter, n=10, y=None):
      """Adjust params and measurements.
  
      Given measurements and adapter, adjust params and measurements to `FilterPy` usable
      form.
      """
      y_dim = 1 if y is None else y.shape[-1]
  
      G = (
          np.eye(adapter.state_dim, y_dim)
          if adapter.control_transition is None
          else np.atleast_2d(adapter.control_transition)
      )
  
      matrices = {
          "Fs": [adapter.F_] * n
          if adapter.F_.ndim == 2
          else [f for f in adapter.F_],
          "Qs": [adapter.Q_] * n
          if adapter.Q_.ndim == 2
          else [q for q in adapter.Q_],
          "Rs": [adapter.R_] * n
          if adapter.R_.ndim == 2
          else [r for r in adapter.R_],
          "Hs": [adapter.H_] * n
          if adapter.H_.ndim == 2
          else [h for h in adapter.H_],
          "Bs": [G] * n if G.ndim == 2 else [g for g in G],
          "us": None
          if y is None
          else ([y] * n if y.ndim == 1 else [_y for _y in y]),
          "x": adapter.X0_,
          "P": adapter.P0_,
      }
      data = [
          None if any(np.isnan(d)) else d.copy() for d in measurements
      ]
  
      return matrices, data
  
file_path: sktime/sktime/transformations/series/tests/test_kalman_filter.py
imports: import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal
  from sktime.transformations.series.kalman_filter import KalmanFilterTransformerFP, KalmanFilterTransformerPK
  from sktime.utils.validation._dependencies import _check_soft_dependencies
label_desc: Use image node_id 5 for calling a global function with example usage: init_kf_filterpy(measurements, adapter, n, y) and returns: matrices,  data