state, observ = model.simulate_data(K) fig = plt.figure() for dd in range(ds): ax = fig.add_subplot(ds,1,dd+1) ax.plot(state[:,dd]) fig = plt.figure() for dd in range(do): ax = fig.add_subplot(do,1,dd+1) ax.plot(observ[:,dd]) # Kalman filter t0 = timer() flt, prd, lhood = model.kalman_filter(observ) filter_time = timer()-t0 print("Filtering took {}s.".format(filter_time)) # Kalman smoother t0 = timer() smt = model.rts_smoother(flt, prd) smoother_time = timer()-t0 print("Smoothing took {}s.".format(smoother_time)) fig = plt.figure() for dd in range(ds): ax = fig.add_subplot(ds,1,dd+1) ax.plot(flt.mn[:,dd], 'g-') ax.plot(flt.mn[:,dd]+2*np.sqrt(flt.vr[:,dd,dd]), 'g:') ax.plot(flt.mn[:,dd]-2*np.sqrt(flt.vr[:,dd,dd]), 'g:')