Comparison between EM and gradient ascent for tracking a foraging mouse

The code below compares the expectation maximization (EM) and gradient ascent algorithm for tracking a foraging mouse.

import sys
import os.path
import argparse
import configparser
import math
import random
import pickle
import numpy as np
import pandas as pd
import torch
import scipy
import plotly.graph_objects as go

import lds.learning

Define parameters for estimation

skip_estimation_sigma_a = False
skip_estimation_R = False
skip_estimation_m0 = False
skip_estimation_V0 = False

start_position = 0
# number_positions = 10000
number_positions = 7500
# number_positions = 50
lbfgs_max_iter = 2
lbfgs_tolerance_grad = -1
lbfgs_tolerance_change = 1e-3
lbfgs_lr = 1.0
lbfgs_n_epochs = 100
lbfgs_tol = 1e-3
em_max_iter = 200
Qe_reg_param_ga = None
Qe_reg_param_em = 1e-5

Provide initial conditions

pos_x0 = 0.0
pos_y0 = 0.0
vel_x0 = 0.0
vel_y0 = 0.0
ace_x0 = 0.0
ace_y0 = 0.0
sigma_a0 = 1.0
sigma_x0 = 1.0
sigma_y0 = 1.0
sqrt_diag_V0_value = 0.1

if math.isnan(pos_x0):
    pos_x0 = y[0, 0]
if math.isnan(pos_y0):
    pos_y0 = y[1, 0]

Get mouse positions

data_filename = "http://www.gatsby.ucl.ac.uk/~rapela/svGPFA/data/positions_session003_start0.00_end15548.27.csv"
data = pd.read_csv(data_filename)
data = data.iloc[start_position:start_position+number_positions,:]
y = np.transpose(data[["x", "y"]].to_numpy())
date_times = pd.to_datetime(data["time"])
dt = (date_times.iloc[1]-date_times.iloc[0]).total_seconds()

Build the matrices of the CWPA model

B, _, Z, _, Qe = lds.tracking.utils.getLDSmatricesForTracking(
    dt=dt, sigma_a=np.nan, sigma_x=np.nan, sigma_y=np.nan)
m0 = np.array([pos_x0, vel_x0, ace_x0, pos_y0, vel_y0, ace_y0],
              dtype=np.double)

vars_to_estimate = {}
if skip_estimation_sigma_a:
    vars_to_estimate["sigma_a"] = False
else:
    vars_to_estimate["sigma_a"] = True

if skip_estimation_R:
    vars_to_estimate["sqrt_diag_R"] = False
    vars_to_estimate["R"] = False
else:
    vars_to_estimate["sqrt_diag_R"] = True
    vars_to_estimate["R"] = True

if skip_estimation_m0:
    vars_to_estimate["m0"] = False
else:
    vars_to_estimate["m0"] = True

if skip_estimation_V0:
    vars_to_estimate["sqrt_diag_V0"] = False
    vars_to_estimate["V0"] = False
else:
    vars_to_estimate["sqrt_diag_V0"] = True
    vars_to_estimate["V0"] = True

Perform gradient ascent optimization

sqrt_diag_R_torch = torch.DoubleTensor([sigma_x0, sigma_y0])
m0_torch = torch.from_numpy(m0.copy())
sqrt_diag_V0_torch = torch.DoubleTensor([sqrt_diag_V0_value
                                         for i in range(len(m0))])
if Qe_reg_param_ga is not None:
    Qe_regularized_ga = Qe + Qe_reg_param_ga * np.eye(Qe.shape[0])
else:
    Qe_regularized_ga = Qe
y_torch = torch.from_numpy(y.astype(np.double))
B_torch = torch.from_numpy(B.astype(np.double))
Qe_regularized_ga_torch = torch.from_numpy(Qe_regularized_ga.astype(np.double))
Z_torch = torch.from_numpy(Z.astype(np.double))

optim_res_ga = lds.learning.torch_lbfgs_optimize_SS_tracking_diagV0(
    y=y_torch, B=B_torch, sigma_a0=sigma_a0,
    Qe=Qe_regularized_ga_torch, Z=Z_torch, sqrt_diag_R_0=sqrt_diag_R_torch, m0_0=m0_torch,
    sqrt_diag_V0_0=sqrt_diag_V0_torch, max_iter=lbfgs_max_iter, lr=lbfgs_lr,
    vars_to_estimate=vars_to_estimate, tolerance_grad=lbfgs_tolerance_grad,
    tolerance_change=lbfgs_tolerance_change, n_epochs=lbfgs_n_epochs,
    tol=lbfgs_tol)

print("gradient ascent: " + optim_res_ga["termination_info"])
in closure, ll=-4349760.865100649
in closure, ll=-864425.783357166
--------------------------------------------------------------------------------
epoch: 0
likelihood: -4349760.865100649
sigma_a:
tensor([1.0474], dtype=torch.float64, requires_grad=True)
sqrt_diag_R:
tensor([1.0419, 1.1762], dtype=torch.float64, requires_grad=True)
m0:
tensor([2.2156e-04, 5.9511e-05, 7.5925e-06, 4.6697e-04, 1.2752e-04, 1.6344e-05],
       dtype=torch.float64, requires_grad=True)
sqrt_diag_V0:
tensor([0.2254, 0.1090, 0.1001, 0.6569, 0.1415, 0.1007], dtype=torch.float64,
       requires_grad=True)
in closure, ll=-864425.783357166
in closure, ll=-675903.2550139598
--------------------------------------------------------------------------------
epoch: 1
likelihood: -864425.783357166
sigma_a:
tensor([1.0546], dtype=torch.float64, requires_grad=True)
sqrt_diag_R:
tensor([1.0580, 1.1819], dtype=torch.float64, requires_grad=True)
m0:
tensor([3.6056e-04, 9.6815e-05, 1.2338e-05, 5.2679e-04, 1.4607e-04, 1.8836e-05],
       dtype=torch.float64, requires_grad=True)
sqrt_diag_V0:
tensor([0.3178, 0.1123, 0.1002, 0.7057, 0.1428, 0.1007], dtype=torch.float64,
       requires_grad=True)
in closure, ll=-675903.2550139598
in closure, ll=-477237.577875291
--------------------------------------------------------------------------------
epoch: 2
likelihood: -675903.2550139598
sigma_a:
tensor([1.0715], dtype=torch.float64, requires_grad=True)
sqrt_diag_R:
tensor([1.0742, 1.1879], dtype=torch.float64, requires_grad=True)
m0:
tensor([6.4423e-04, 1.7359e-04, 2.2145e-05, 7.1291e-04, 2.0678e-04, 2.7092e-05],
       dtype=torch.float64, requires_grad=True)
sqrt_diag_V0:
tensor([0.4702, 0.1140, 0.1002, 0.8275, 0.1438, 0.1007], dtype=torch.float64,
       requires_grad=True)
in closure, ll=-477237.577875291
in closure, ll=-356966.5981741533
--------------------------------------------------------------------------------
epoch: 3
likelihood: -477237.577875291
sigma_a:
tensor([1.1039], dtype=torch.float64, requires_grad=True)
sqrt_diag_R:
tensor([1.0940, 1.1901], dtype=torch.float64, requires_grad=True)
m0:
tensor([1.0232e-03, 2.7659e-04, 3.5270e-05, 1.0244e-03, 3.1449e-04, 4.1850e-05],
       dtype=torch.float64, requires_grad=True)
sqrt_diag_V0:
tensor([0.6188, 0.1134, 0.1002, 0.9843, 0.1422, 0.1007], dtype=torch.float64,
       requires_grad=True)
in closure, ll=-356966.5981741533
in closure, ll=-263783.7252192787
--------------------------------------------------------------------------------
epoch: 4
likelihood: -356966.5981741533
sigma_a:
tensor([1.1846], dtype=torch.float64, requires_grad=True)
sqrt_diag_R:
tensor([1.1422, 1.2010], dtype=torch.float64, requires_grad=True)
m0:
tensor([1.6564e-03, 4.4898e-04, 5.7099e-05, 1.6083e-03, 5.3194e-04, 7.1734e-05],
       dtype=torch.float64, requires_grad=True)
sqrt_diag_V0:
tensor([0.8021, 0.1110, 0.1002, 1.2044, 0.1371, 0.1006], dtype=torch.float64,
       requires_grad=True)
in closure, ll=-263783.7252192787
in closure, ll=-194897.69144144744
--------------------------------------------------------------------------------
epoch: 5
likelihood: -263783.7252192787
sigma_a:
tensor([1.3511], dtype=torch.float64, requires_grad=True)
sqrt_diag_R:
tensor([1.2445, 1.2457], dtype=torch.float64, requires_grad=True)
m0:
tensor([2.6471e-03, 7.1836e-04, 9.0867e-05, 2.5812e-03, 9.2699e-04, 1.2594e-04],
       dtype=torch.float64, requires_grad=True)
sqrt_diag_V0:
tensor([1.0194, 0.1069, 0.1001, 1.4763, 0.1278, 0.1004], dtype=torch.float64,
       requires_grad=True)
in closure, ll=-194897.69144144744
in closure, ll=-141995.14515118996
--------------------------------------------------------------------------------
epoch: 6
likelihood: -194897.69144144744
sigma_a:
tensor([1.6424], dtype=torch.float64, requires_grad=True)
sqrt_diag_R:
tensor([1.4248, 1.3583], dtype=torch.float64, requires_grad=True)
m0:
tensor([0.0042, 0.0011, 0.0001, 0.0042, 0.0016, 0.0002], dtype=torch.float64,
       requires_grad=True)
sqrt_diag_V0:
tensor([1.2894, 0.1007, 0.1000, 1.8129, 0.1123, 0.1001], dtype=torch.float64,
       requires_grad=True)
in closure, ll=-141995.14515118996
in closure, ll=-105560.15024555809
--------------------------------------------------------------------------------
epoch: 7
likelihood: -141995.14515118996
sigma_a:
tensor([2.0430], dtype=torch.float64, requires_grad=True)
sqrt_diag_R:
tensor([1.6636, 1.5428], dtype=torch.float64, requires_grad=True)
m0:
tensor([0.0066, 0.0018, 0.0002, 0.0068, 0.0028, 0.0004], dtype=torch.float64,
       requires_grad=True)
sqrt_diag_V0:
tensor([1.6078, 0.0926, 0.0999, 2.2095, 0.0883, 0.0997], dtype=torch.float64,
       requires_grad=True)
in closure, ll=-105560.15024555809
in closure, ll=-81571.05497658401
--------------------------------------------------------------------------------
epoch: 8
likelihood: -105560.15024555809
sigma_a:
tensor([2.5434], dtype=torch.float64, requires_grad=True)
sqrt_diag_R:
tensor([1.9304, 1.7680], dtype=torch.float64, requires_grad=True)
m0:
tensor([0.0103, 0.0027, 0.0003, 0.0109, 0.0048, 0.0006], dtype=torch.float64,
       requires_grad=True)
sqrt_diag_V0:
tensor([1.9838, 0.0824, 0.0997, 2.6900, 0.0530, 0.0992], dtype=torch.float64,
       requires_grad=True)
in closure, ll=-81571.05497658401
in closure, ll=-65955.31706052765
--------------------------------------------------------------------------------
epoch: 9
likelihood: -81571.05497658401
sigma_a:
tensor([3.1675], dtype=torch.float64, requires_grad=True)
sqrt_diag_R:
tensor([2.1935, 1.9958], dtype=torch.float64, requires_grad=True)
m0:
tensor([0.0158, 0.0042, 0.0005, 0.0173, 0.0079, 0.0011], dtype=torch.float64,
       requires_grad=True)
sqrt_diag_V0:
tensor([2.4329, 0.0699, 0.0995, 3.2824, 0.0036, 0.0985], dtype=torch.float64,
       requires_grad=True)
in closure, ll=-65955.31706052765
in closure, ll=-55724.821515104406
--------------------------------------------------------------------------------
epoch: 10
likelihood: -65955.31706052765
sigma_a:
tensor([3.9680], dtype=torch.float64, requires_grad=True)
sqrt_diag_R:
tensor([2.3983, 2.1734], dtype=torch.float64, requires_grad=True)
m0:
tensor([0.0243, 0.0063, 0.0007, 0.0272, 0.0128, 0.0017], dtype=torch.float64,
       requires_grad=True)
sqrt_diag_V0:
tensor([ 2.9750,  0.0546,  0.0993,  4.0193, -0.0624,  0.0977],
       dtype=torch.float64, requires_grad=True)
in closure, ll=-55724.821515104406
in closure, ll=-48677.46276967638
--------------------------------------------------------------------------------
epoch: 11
likelihood: -55724.821515104406
sigma_a:
tensor([5.0503], dtype=torch.float64, requires_grad=True)
sqrt_diag_R:
tensor([2.4412, 2.2076], dtype=torch.float64, requires_grad=True)
m0:
tensor([0.0373, 0.0094, 0.0011, 0.0424, 0.0207, 0.0027], dtype=torch.float64,
       requires_grad=True)
sqrt_diag_V0:
tensor([ 3.6442,  0.0358,  0.0990,  4.9566, -0.1490,  0.0967],
       dtype=torch.float64, requires_grad=True)
in closure, ll=-48677.46276967638
in closure, ll=-43126.20433079402
--------------------------------------------------------------------------------
epoch: 12
likelihood: -48677.46276967638
sigma_a:
tensor([6.6675], dtype=torch.float64, requires_grad=True)
sqrt_diag_R:
tensor([2.1361, 1.9359], dtype=torch.float64, requires_grad=True)
m0:
tensor([0.0579, 0.0141, 0.0016, 0.0659, 0.0344, 0.0044], dtype=torch.float64,
       requires_grad=True)
sqrt_diag_V0:
tensor([ 4.5150,  0.0122,  0.0986,  6.2094, -0.2669,  0.0955],
       dtype=torch.float64, requires_grad=True)
in closure, ll=-43126.20433079402
in closure, ll=-38575.54661835186
--------------------------------------------------------------------------------
epoch: 13
likelihood: -43126.20433079402
sigma_a:
tensor([9.4357], dtype=torch.float64, requires_grad=True)
sqrt_diag_R:
tensor([1.6484, 1.3869], dtype=torch.float64, requires_grad=True)
m0:
tensor([0.0914, 0.0211, 0.0022, 0.1031, 0.0634, 0.0078], dtype=torch.float64,
       requires_grad=True)
sqrt_diag_V0:
tensor([ 5.6448, -0.0180,  0.0982,  7.7935, -0.4575,  0.0943],
       dtype=torch.float64, requires_grad=True)
in closure, ll=-38575.54661835186
in closure, ll=-35330.423396786195
--------------------------------------------------------------------------------
epoch: 14
likelihood: -38575.54661835186
sigma_a:
tensor([15.3115], dtype=torch.float64, requires_grad=True)
sqrt_diag_R:
tensor([2.3744, 1.9971], dtype=torch.float64, requires_grad=True)
m0:
tensor([0.1637, 0.0355, 0.0034, 0.1824, 0.1377, 0.0159], dtype=torch.float64,
       requires_grad=True)
sqrt_diag_V0:
tensor([ 7.8777, -0.0843,  0.0971, 10.4573, -0.9780,  0.0917],
       dtype=torch.float64, requires_grad=True)
in closure, ll=-35330.423396786195
in closure, ll=-32321.736077543555
--------------------------------------------------------------------------------
epoch: 15
likelihood: -35330.423396786195
sigma_a:
tensor([18.5797], dtype=torch.float64, requires_grad=True)
sqrt_diag_R:
tensor([1.9159, 1.2629], dtype=torch.float64, requires_grad=True)
m0:
tensor([0.2029, 0.0433, 0.0041, 0.2259, 0.1783, 0.0203], dtype=torch.float64,
       requires_grad=True)
sqrt_diag_V0:
tensor([ 9.0688, -0.1161,  0.0967, 12.1607, -1.2467,  0.0905],
       dtype=torch.float64, requires_grad=True)
in closure, ll=-32321.736077543555
in closure, ll=-28041.283336008222
--------------------------------------------------------------------------------
epoch: 16
likelihood: -32321.736077543555
sigma_a:
tensor([35.9907], dtype=torch.float64, requires_grad=True)
sqrt_diag_R:
tensor([-1.4661, -1.1189], dtype=torch.float64, requires_grad=True)
m0:
tensor([0.4041, 0.0831, 0.0075, 0.4475, 0.4111, 0.0448], dtype=torch.float64,
       requires_grad=True)
sqrt_diag_V0:
tensor([15.4072, -0.2725,  0.0943, 20.5471, -2.9635,  0.0843],
       dtype=torch.float64, requires_grad=True)
in closure, ll=-28041.283336008222
in closure, ll=-60845.44854412978
in closure, ll=-28016.72369289751
in closure, ll=-27642.86961457806
--------------------------------------------------------------------------------
epoch: 17
likelihood: -28041.283336008222
sigma_a:
tensor([35.4827], dtype=torch.float64, requires_grad=True)
sqrt_diag_R:
tensor([-1.3597, -0.9811], dtype=torch.float64, requires_grad=True)
m0:
tensor([0.3985, 0.0820, 0.0074, 0.4413, 0.4046, 0.0441], dtype=torch.float64,
       requires_grad=True)
sqrt_diag_V0:
tensor([15.2323, -0.2681,  0.0944, 20.2934, -2.9165,  0.0845],
       dtype=torch.float64, requires_grad=True)
in closure, ll=-27642.86961457806
in closure, ll=-50348.9578325196
in closure, ll=-28031.70882471392
in closure, ll=-27294.53614617836
--------------------------------------------------------------------------------
epoch: 18
likelihood: -27642.86961457806
sigma_a:
tensor([35.6823], dtype=torch.float64, requires_grad=True)
sqrt_diag_R:
tensor([-1.3666, -0.7355], dtype=torch.float64, requires_grad=True)
m0:
tensor([0.4014, 0.0825, 0.0075, 0.4445, 0.4081, 0.0444], dtype=torch.float64,
       requires_grad=True)
sqrt_diag_V0:
tensor([15.3370, -0.2703,  0.0943, 20.3412, -2.9506,  0.0843],
       dtype=torch.float64, requires_grad=True)
in closure, ll=-27294.53614617836
in closure, ll=-26992.066136108533
--------------------------------------------------------------------------------
epoch: 19
likelihood: -27294.53614617836
sigma_a:
tensor([37.1363], dtype=torch.float64, requires_grad=True)
sqrt_diag_R:
tensor([-1.1797, -0.7222], dtype=torch.float64, requires_grad=True)
m0:
tensor([0.4197, 0.0861, 0.0078, 0.4646, 0.4266, 0.0465], dtype=torch.float64,
       requires_grad=True)
sqrt_diag_V0:
tensor([15.8772, -0.2868,  0.0941, 21.0349, -3.0763,  0.0837],
       dtype=torch.float64, requires_grad=True)
in closure, ll=-26992.066136108533
in closure, ll=-26167.47437272276
--------------------------------------------------------------------------------
epoch: 20
likelihood: -26992.066136108533
sigma_a:
tensor([44.6102], dtype=torch.float64, requires_grad=True)
sqrt_diag_R:
tensor([-0.9844, -0.6663], dtype=torch.float64, requires_grad=True)
m0:
tensor([0.5111, 0.1042, 0.0093, 0.5653, 0.5243, 0.0570], dtype=torch.float64,
       requires_grad=True)
sqrt_diag_V0:
tensor([18.6658, -0.3660,  0.0929, 24.5325, -3.7736,  0.0806],
       dtype=torch.float64, requires_grad=True)
in closure, ll=-26167.47437272276
in closure, ll=-24700.283777922232
--------------------------------------------------------------------------------
epoch: 21
likelihood: -26167.47437272276
sigma_a:
tensor([61.7582], dtype=torch.float64, requires_grad=True)
sqrt_diag_R:
tensor([-1.0137, -0.5894], dtype=torch.float64, requires_grad=True)
m0:
tensor([0.7194, 0.1455, 0.0129, 0.7946, 0.7500, 0.0811], dtype=torch.float64,
       requires_grad=True)
sqrt_diag_V0:
tensor([25.0668, -0.5439,  0.0901, 32.5239, -5.4040,  0.0736],
       dtype=torch.float64, requires_grad=True)
in closure, ll=-24700.283777922232
in closure, ll=-23851.18246110244
--------------------------------------------------------------------------------
epoch: 22
likelihood: -24700.283777922232
sigma_a:
tensor([81.8113], dtype=torch.float64, requires_grad=True)
sqrt_diag_R:
tensor([-0.9371, -0.6384], dtype=torch.float64, requires_grad=True)
m0:
tensor([0.9630, 0.1937, 0.0170, 1.0629, 1.0134, 0.1093], dtype=torch.float64,
       requires_grad=True)
sqrt_diag_V0:
tensor([32.5313, -0.7526,  0.0869, 41.9016, -7.2929,  0.0654],
       dtype=torch.float64, requires_grad=True)
in closure, ll=-23851.18246110244
in closure, ll=-23494.35249912862
in closure, ll=-23197.13638543685
--------------------------------------------------------------------------------
epoch: 23
likelihood: -23851.18246110244
sigma_a:
tensor([107.4640], dtype=torch.float64, requires_grad=True)
sqrt_diag_R:
tensor([-0.8749, -0.4626], dtype=torch.float64, requires_grad=True)
m0:
tensor([1.2749, 0.2554, 0.0223, 1.4063, 1.3513, 0.1455], dtype=torch.float64,
       requires_grad=True)
sqrt_diag_V0:
tensor([42.1096, -1.0195,  0.0828, 53.8506, -9.7275,  0.0548],
       dtype=torch.float64, requires_grad=True)
in closure, ll=-23197.13638543685
in closure, ll=-22650.26086579791
--------------------------------------------------------------------------------
epoch: 24
likelihood: -23197.13638543685
sigma_a:
tensor([134.3731], dtype=torch.float64, requires_grad=True)
sqrt_diag_R:
tensor([-0.8753, -0.4871], dtype=torch.float64, requires_grad=True)
m0:
tensor([1.6015, 0.3200, 0.0278, 1.7659, 1.7053, 0.1834], dtype=torch.float64,
       requires_grad=True)
sqrt_diag_V0:
tensor([ 5.2132e+01, -1.2988e+00,  7.8562e-02,  6.6417e+01, -1.2273e+01,
         4.3807e-02], dtype=torch.float64, requires_grad=True)
in closure, ll=-22650.26086579791
in closure, ll=-22253.747573382083
--------------------------------------------------------------------------------
epoch: 25
likelihood: -22650.26086579791
sigma_a:
tensor([179.0867], dtype=torch.float64, requires_grad=True)
sqrt_diag_R:
tensor([-0.8171, -0.4377], dtype=torch.float64, requires_grad=True)
m0:
tensor([2.1447, 0.4275, 0.0370, 2.3639, 2.2936, 0.2463], dtype=torch.float64,
       requires_grad=True)
sqrt_diag_V0:
tensor([ 6.8797e+01, -1.7635e+00,  7.1441e-02,  8.7286e+01, -1.6503e+01,
         2.5486e-02], dtype=torch.float64, requires_grad=True)
in closure, ll=-22253.747573382083
in closure, ll=-22052.708890079248
--------------------------------------------------------------------------------
epoch: 26
likelihood: -22253.747573382083
sigma_a:
tensor([218.3609], dtype=torch.float64, requires_grad=True)
sqrt_diag_R:
tensor([-0.7963, -0.4390], dtype=torch.float64, requires_grad=True)
m0:
tensor([2.6215, 0.5219, 0.0451, 2.8890, 2.8104, 0.3016], dtype=torch.float64,
       requires_grad=True)
sqrt_diag_V0:
tensor([ 8.3429e+01, -2.1713e+00,  6.5191e-02,  1.0562e+02, -2.0219e+01,
         9.4132e-03], dtype=torch.float64, requires_grad=True)
in closure, ll=-22052.708890079248
in closure, ll=-21962.3996258442
--------------------------------------------------------------------------------
epoch: 27
likelihood: -22052.708890079248
sigma_a:
tensor([258.2953], dtype=torch.float64, requires_grad=True)
sqrt_diag_R:
tensor([-0.7783, -0.4232], dtype=torch.float64, requires_grad=True)
m0:
tensor([3.1064, 0.6178, 0.0533, 3.4229, 3.3360, 0.3578], dtype=torch.float64,
       requires_grad=True)
sqrt_diag_V0:
tensor([ 9.8310e+01, -2.5860e+00,  5.8836e-02,  1.2426e+02, -2.3999e+01,
        -6.9359e-03], dtype=torch.float64, requires_grad=True)
in closure, ll=-21962.3996258442
in closure, ll=-21934.28696190734
in closure, ll=-22043.622258688818
in closure, ll=-21953.372906392866
in closure, ll=-21932.374703323203
in closure, ll=-21940.424137954924
in closure, ll=-21935.742710205144
in closure, ll=-21933.88841178075
in closure, ll=-21933.08817943135
in closure, ll=-21932.720493706052
in closure, ll=-21932.544848530142
in closure, ll=-21932.459086793122
in closure, ll=-21932.416722561076
in closure, ll=-21932.39566979108
in closure, ll=-21932.38517576563
in closure, ll=-21932.3799368494
in closure, ll=-21932.377319418145
in closure, ll=-21932.376011200173
in closure, ll=-21932.375357218676
in closure, ll=-21932.375030254232
in closure, ll=-21932.374866781967
in closure, ll=-21932.374785051157
in closure, ll=-21932.374744187
in closure, ll=-21932.37472374585
in closure, ll=-21932.37471354182
in closure, ll=-21932.374708425283
in closure, ll=-21932.37470588156
--------------------------------------------------------------------------------
epoch: 28
likelihood: -21962.3996258442
sigma_a:
tensor([320.1212], dtype=torch.float64, requires_grad=True)
sqrt_diag_R:
tensor([-0.7416, -0.4207], dtype=torch.float64, requires_grad=True)
m0:
tensor([3.8572, 0.7664, 0.0660, 4.2495, 4.1506, 0.4449], dtype=torch.float64,
       requires_grad=True)
sqrt_diag_V0:
tensor([ 1.2134e+02, -3.2280e+00,  4.8998e-02,  1.5313e+02, -2.9853e+01,
        -3.2238e-02], dtype=torch.float64, requires_grad=True)
in closure, ll=-21932.374703323203
gradient ascent: nan generated

Perform EM optimization

sqrt_diag_R = np.array([sigma_x0, sigma_y0])
R_0 = np.diag(sqrt_diag_R)
m0_0 = m0
sqrt_diag_V0 = np.array([sqrt_diag_V0_value for i in range(len(m0))])
V0_0 = np.diag(sqrt_diag_V0)

times = np.arange(0, y.shape[1]*dt, dt)
not_nan_indices_y0 = set(np.where(np.logical_not(np.isnan(y[0, :])))[0])
not_nan_indices_y1 = set(np.where(np.logical_not(np.isnan(y[1, :])))[0])
not_nan_indices = np.array(sorted(not_nan_indices_y0.union(not_nan_indices_y1)))
y_no_nan = y[:, not_nan_indices]
t_no_nan = times[not_nan_indices]
y_interpolated = np.empty_like(y)
tck, u = scipy.interpolate.splprep([y_no_nan[0, :], y_no_nan[1, :]], s=0, u=t_no_nan)
y_interpolated[0, :], y_interpolated[1, :] = scipy.interpolate.splev(times, tck)

if Qe_reg_param_em is not None:
    Qe_regularized_em = Qe + Qe_reg_param_em * np.eye(Qe.shape[0])
else:
    Qe_regularized_em = Qe

optim_res_em  = lds.learning.em_SS_tracking(
    y=y_interpolated, B=B, sigma_a0=sigma_a0,
    Qe=Qe_regularized_em, Z=Z, R_0=R_0, m0_0=m0_0, V0_0=V0_0,
    vars_to_estimate=vars_to_estimate,
    max_iter=em_max_iter)

print("EM: " + optim_res_em["termination_info"])
LogLike[0000]=-1532961.666165
sigma_a=1.000000
R:
[[1. 0.]
 [0. 1.]]
m0:
[0. 0. 0. 0. 0. 0.]
V0:
[[0.1 0.  0.  0.  0.  0. ]
 [0.  0.1 0.  0.  0.  0. ]
 [0.  0.  0.1 0.  0.  0. ]
 [0.  0.  0.  0.1 0.  0. ]
 [0.  0.  0.  0.  0.1 0. ]
 [0.  0.  0.  0.  0.  0.1]]
LogLike[0001]=-56083.466132
sigma_a=2.320011
R:
[[25.16113242 31.90946823]
 [31.90946823 77.90941043]]
m0:
[188.93507296  47.02895603   5.48547484 397.12406422 103.86097823
  12.3310036 ]
V0:
[[ 0.03106149 -0.01705374 -0.00199045  0.          0.          0.        ]
 [-0.01705374  0.08734047 -0.00277441  0.          0.          0.        ]
 [-0.00199045 -0.00277441  0.09897246  0.          0.          0.        ]
 [ 0.          0.          0.          0.03106149 -0.01705374 -0.00199045]
 [ 0.          0.          0.         -0.01705374  0.08734047 -0.00277441]
 [ 0.          0.          0.         -0.00199045 -0.00277441  0.09897246]]
LogLike[0002]=-54472.593838
sigma_a=2.564253
R:
[[ 35.37688641  48.73015339]
 [ 48.73015339 121.26331529]]
m0:
[189.70957688  47.30563329   5.54917522 398.61986099 104.90457137
  12.54064585]
V0:
[[ 2.95260918e-02 -1.74339463e-02 -2.02991792e-03  5.99137707e-04
   1.06471579e-04  3.69656031e-06]
 [-1.74339463e-02  8.63039357e-02 -3.07862433e-03  1.06471579e-04
   2.48348818e-04  4.79567735e-05]
 [-2.02991792e-03 -3.07862433e-03  9.88222388e-02  3.69656031e-06
   4.79567735e-05  1.14329137e-05]
 [ 5.99137707e-04  1.06471579e-04  3.69656031e-06  3.05165026e-02
  -1.72579423e-02 -2.02380728e-03]
 [ 1.06471579e-04  2.48348818e-04  4.79567735e-05 -1.72579423e-02
   8.67144713e-02 -2.99934889e-03]
 [ 3.69656031e-06  4.79567735e-05  1.14329137e-05 -2.02380728e-03
  -2.99934889e-03  9.88411381e-02]]
LogLike[0003]=-53853.778108
sigma_a=2.770890
R:
[[ 35.76653521  49.25133189]
 [ 49.25133189 124.70669138]]
m0:
[190.3200895   47.5038523    5.59217624 399.5385031  105.60763469
  12.68412762]
V0:
[[ 2.84831892e-02 -1.76810358e-02 -2.05250346e-03  9.91916125e-04
   1.70366217e-04  4.10256195e-06]
 [-1.76810358e-02  8.55151446e-02 -3.31461774e-03  1.70345195e-04
   4.35952348e-04  8.50568293e-05]
 [-2.05250346e-03 -3.31461774e-03  9.87026266e-02  4.09686528e-06
   8.50555086e-05  2.05726882e-05]
 [ 9.91916125e-04  1.70345195e-04  4.09686528e-06  3.01697537e-02
  -1.73909794e-02 -2.04543390e-03]
 [ 1.70366217e-04  4.35952348e-04  8.50555086e-05 -1.73909794e-02
   8.62571640e-02 -3.16978380e-03]
 [ 4.10256195e-06  8.50568293e-05  2.05726882e-05 -2.04543390e-03
  -3.16978380e-03  9.87376695e-02]]
LogLike[0004]=-53310.596369
sigma_a=2.973903
R:
[[ 34.40528734  47.75760647]
 [ 47.75760647 121.10214082]]
m0:
[190.92662984  47.68113641   5.62804419 400.40124977 106.24206749
  12.80940523]
V0:
[[ 2.75804672e-02 -1.78646596e-02 -2.06370956e-03  1.31914998e-03
   2.09393020e-04  6.60751004e-07]
 [-1.78646596e-02  8.48322773e-02 -3.51616528e-03  2.09380593e-04
   5.91914558e-04  1.15038698e-04]
 [-2.06370956e-03 -3.51616528e-03  9.86006011e-02  6.57059727e-07
   1.15037747e-04  2.78999454e-05]
 [ 1.31914998e-03  2.09380593e-04  6.57059727e-07  2.98635810e-02
  -1.75021065e-02 -2.06252654e-03]
 [ 2.09393020e-04  5.91914558e-04  1.15037747e-04 -1.75021065e-02
   8.58571112e-02 -3.31694979e-03]
 [ 6.60751004e-07  1.15038698e-04  2.78999454e-05 -2.06252654e-03
  -3.31694979e-03  9.86489247e-02]]
LogLike[0005]=-52791.362708
sigma_a=3.182133
R:
[[ 32.83707195  46.32121238]
 [ 46.32121238 116.66827267]]
m0:
[191.53414901  47.83481226   5.65743723 401.26345954 106.84225309
  12.92287915]
V0:
[[ 2.67344819e-02 -1.80018071e-02 -2.06527408e-03  1.62002464e-03
   2.30378860e-04 -6.17290606e-06]
 [-1.80018071e-02  8.42152691e-02 -3.69371198e-03  2.30426741e-04
   7.30651050e-04  1.40696434e-04]
 [-2.06527408e-03 -3.69371198e-03  9.85116762e-02 -6.16169426e-06
   1.40698766e-04  3.40763450e-05]
 [ 1.62002464e-03  2.30426741e-04 -6.16169426e-06  2.95696166e-02
  -1.75991701e-02 -2.07619387e-03]
 [ 2.30378860e-04  7.30651050e-04  1.40698766e-04 -1.75991701e-02
   8.54930843e-02 -3.44769062e-03]
 [-6.17290606e-06  1.40696434e-04  3.40763450e-05 -2.07619387e-03
  -3.44769062e-03  9.85712583e-02]]
LogLike[0006]=-52288.500863
sigma_a=3.398887
R:
[[ 31.3297926   45.03311803]
 [ 45.03311803 112.29577869]]
m0:
[192.13917459  47.96276156   5.68059404 402.13288377 107.41514769
  13.02611575]
V0:
[[ 2.59192207e-02 -1.80988532e-02 -2.05829312e-03  1.90775855e-03
   2.36118264e-04 -1.60128416e-05]
 [-1.80988532e-02  8.36470512e-02 -3.85236840e-03  2.36266355e-04
   8.58750260e-04  1.63469429e-04]
 [-2.05829312e-03 -3.85236840e-03  9.84333826e-02 -1.59774015e-05
   1.63477211e-04  3.94740993e-05]
 [ 1.90775855e-03  2.36266355e-04 -1.59774015e-05  2.92801339e-02
  -1.76842103e-02 -2.08679352e-03]
 [ 2.36118264e-04  8.58750260e-04  1.63477211e-04 -1.76842103e-02
   8.51575895e-02 -3.56495322e-03]
 [-1.60128416e-05  1.63469429e-04  3.94740993e-05 -2.08679352e-03
  -3.56495322e-03  9.85027694e-02]]
LogLike[0007]=-51798.997842
sigma_a=3.626353
R:
[[ 29.93105007  43.82732987]
 [ 43.82732987 108.09165489]]
m0:
[192.73955908  48.06527691   5.69799317 403.01057423 107.96301222
  13.1198701 ]
V0:
[[ 2.51261820e-02 -1.81594408e-02 -2.04374856e-03  2.18694758e-03
   2.28104430e-04 -2.85065748e-05]
 [-1.81594408e-02  8.31179458e-02 -3.99541631e-03  2.28363686e-04
   9.79638791e-04  1.84174441e-04]
 [-2.04374856e-03 -3.99541631e-03  9.83640070e-02 -2.84449230e-05
   1.84188233e-04  4.43118006e-05]
 [ 2.18694758e-03  2.28363686e-04 -2.84449230e-05  2.89926875e-02
  -1.77580967e-02 -2.09456778e-03]
 [ 2.28104430e-04  9.79638791e-04  1.84188233e-04 -1.77580967e-02
   8.48464289e-02 -3.67065440e-03]
 [-2.85065748e-05  1.84174441e-04  4.43118006e-05 -2.09456778e-03
  -3.67065440e-03  9.84421158e-02]]
LogLike[0008]=-51322.712710
sigma_a=3.865215
R:
[[ 28.64157747  42.65967457]
 [ 42.65967457 104.048869  ]]
m0:
[193.33419196  48.1438379    5.71022775 403.8966386  108.48688104
  13.20466052]
V0:
[[ 2.43531660e-02 -1.81864630e-02 -2.02259315e-03  2.45894926e-03
   2.07439553e-04 -4.33071072e-05]
 [-1.81864630e-02  8.26214051e-02 -4.12525731e-03  2.07784144e-04
   1.09539469e-03  2.03339096e-04]
 [-2.02259315e-03 -4.12525731e-03  9.83022460e-02 -4.32257855e-05
   2.03357557e-04  4.87312993e-05]
 [ 2.45894926e-03  2.07784144e-04 -4.32257855e-05  2.87065542e-02
  -1.78214071e-02 -2.09973501e-03]
 [ 2.07439553e-04  1.09539469e-03  2.03357557e-04 -1.78214071e-02
   8.45566260e-02 -3.76625484e-03]
 [-4.33071072e-05  2.03339096e-04  4.87312993e-05 -2.09973501e-03
  -3.76625484e-03  9.83882490e-02]]
LogLike[0009]=-50860.320623
sigma_a=4.115591
R:
[[ 27.453166    41.5083522 ]
 [ 41.5083522  100.15512917]]
m0:
[193.92246832  48.2004204    5.71792202 404.79118026 108.98740988
  13.28091799]
V0:
[[ 2.36003593e-02 -1.81826955e-02 -1.99576339e-03  2.72383439e-03
   1.75151626e-04 -6.00675309e-05]
 [-1.81826955e-02  8.21523719e-02 -4.24381815e-03  1.75515616e-04
   1.20747115e-03  2.21343334e-04]
 [-1.99576339e-03 -4.24381815e-03  9.82470326e-02 -5.99816255e-05
   2.21363154e-04  5.28329430e-05]
 [ 2.72383439e-03  1.75515616e-04 -5.99816255e-05  2.84216434e-02
  -1.78746681e-02 -2.10250956e-03]
 [ 1.75151626e-04  1.20747115e-03  2.21363154e-04 -1.78746681e-02
   8.42857360e-02 -3.85298070e-03]
 [-6.00675309e-05  2.21343334e-04  5.28329430e-05 -2.10250956e-03
  -3.85298070e-03  9.83402879e-02]]
LogLike[0010]=-50411.286925
sigma_a=4.378348
R:
[[26.35515438 40.36278475]
 [40.36278475 96.40150097]]
m0:
[194.5040394   48.23715251   5.72168108 405.69436238 109.46507985
  13.34902548]
V0:
[[ 2.28689800e-02 -1.81509837e-02 -1.96417690e-03  2.98107411e-03
   1.32301389e-04 -7.84406456e-05]
 [-1.81509837e-02  8.17067571e-02 -4.35269067e-03  1.32578804e-04
   1.31694008e-03  2.38470481e-04]
 [-1.96417690e-03 -4.35269067e-03  9.81974724e-02 -7.83730480e-05
   2.38486463e-04  5.66894049e-05]
 [ 2.98107411e-03  1.32578804e-04 -7.83730480e-05  2.81381612e-02
  -1.79184211e-02 -2.10310532e-03]
 [ 1.32301389e-04  1.31694008e-03  2.38486463e-04 -1.79184211e-02
   8.40316530e-02 -3.93189234e-03]
 [-7.84406456e-05  2.38470481e-04  5.66894049e-05 -2.10310532e-03
  -3.93189234e-03  9.82974748e-02]]
LogLike[0011]=-49976.250935
sigma_a=4.653379
R:
[[25.33435536 39.21675759]
 [39.21675759 92.77505604]]
m0:
[195.07875561  48.25610179   5.7220514  406.606318   109.92019052
  13.40931576]
V0:
[[ 2.21606863e-02 -1.80942464e-02 -1.92871726e-03  3.22983980e-03
   8.00039719e-05 -9.80830091e-05]
 [-1.80942464e-02  8.12813329e-02 -4.45316519e-03  8.00519711e-05
   1.42456654e-03  2.54926069e-04]
 [-1.92871726e-03 -4.45316519e-03  9.81528281e-02 -9.80630848e-05
   2.54931336e-04  6.03516482e-05]
 [ 3.22983980e-03  8.00519711e-05 -9.80630848e-05  2.78564811e-02
  -1.79532241e-02 -2.10173176e-03]
 [ 8.00039719e-05  1.42456654e-03  2.54931336e-04 -1.79532241e-02
   8.37926049e-02 -4.00388883e-03]
 [-9.80830091e-05  2.54926069e-04  6.03516482e-05 -2.10173176e-03
  -4.00388883e-03  9.82591695e-02]]
LogLike[0012]=-49555.159033
sigma_a=4.940840
R:
[[24.37981546 38.06990831]
 [38.06990831 89.26990104]]
m0:
[195.64670731  48.25917907   5.71950856 407.52719934 110.35302292
  13.4621071 ]
V0:
[[ 2.14770471e-02 -1.80154584e-02 -1.89021620e-03  3.46926175e-03
   1.94225051e-05 -1.18664541e-04]
 [-1.80154584e-02  8.08734404e-02 -4.54632245e-03  1.90667752e-05
   1.53090937e-03  2.70860693e-04]
 [-1.89021620e-03 -4.54632245e-03  9.81124715e-02 -1.18726474e-04
   2.70846964e-04  6.38556381e-05]
 [ 3.46926175e-03  1.90667752e-05 -1.18726474e-04  2.75770072e-02
  -1.79796685e-02 -2.09859358e-03]
 [ 1.94225051e-05  1.53090937e-03  2.70846964e-04 -1.79796685e-02
   8.35670239e-02 -4.06976083e-03]
 [-1.18664541e-04  2.70860693e-04  6.38556381e-05 -2.09859358e-03
  -4.06976083e-03  9.82248138e-02]]
LogLike[0013]=-49147.635814
sigma_a=5.240908
R:
[[23.4816108  36.92413184]
 [36.92413184 85.88016681]]
m0:
[196.20819013  48.24807083   5.71444779 408.45709109 110.76382463
  13.50770193]
V0:
[[ 2.08193543e-02 -1.79175658e-02 -1.84943611e-03  3.69854102e-03
  -4.82631316e-05 -1.39876459e-04]
 [-1.79175658e-02  8.04809326e-02 -4.63305743e-03 -4.92215893e-05
   1.63635419e-03  2.86379984e-04]
 [-1.84943611e-03 -4.63305743e-03  9.80758718e-02 -1.40057484e-04
   2.86337886e-04  6.72256916e-05]
 [ 3.69854102e-03 -4.92215893e-05 -1.40057484e-04  2.73001309e-02
  -1.79983592e-02 -2.09388575e-03]
 [-4.82631316e-05  1.63635419e-03  2.86337886e-04 -1.79983592e-02
   8.33535444e-02 -4.13019612e-03]
 [-1.39876459e-04  2.86379984e-04  6.72256916e-05 -2.09388575e-03
  -4.13019612e-03  9.81939251e-02]]
LogLike[0014]=-48753.439932
sigma_a=5.553402
R:
[[22.6315643  35.78291829]
 [35.78291829 82.60084329]]
m0:
[196.76367367  48.22421279   5.70718599 409.39600935 111.15283137
  13.54639034]
V0:
[[ 2.01884563e-02 -1.78033894e-02 -1.80705300e-03  3.91705022e-03
  -1.21899686e-04 -1.61440463e-04]
 [-1.78033894e-02  8.01020679e-02 -4.71411399e-03 -1.23677767e-04
   1.74115855e-03  3.01555907e-04]
 [-1.80705300e-03 -4.71411399e-03  9.80425784e-02 -1.61779271e-04
   3.01475271e-04  7.04778354e-05]
 [ 3.91705022e-03 -1.23677767e-04 -1.61779271e-04  2.70261759e-02
  -1.80098952e-02 -2.08778884e-03]
 [-1.21899686e-04  1.74115855e-03  3.01475271e-04 -1.80098952e-02
   8.31509707e-02 -4.18579405e-03]
 [-1.61440463e-04  3.01555907e-04  7.04778354e-05 -2.08778884e-03
  -4.18579405e-03  9.81660859e-02]]
LogLike[0015]=-48371.770562
sigma_a=5.878519
R:
[[21.82388511 34.65115173]
 [34.65115173 79.42975805]]
m0:
[197.31374436  48.18880282   5.69797288 410.34392512 111.52030033
  13.57845591]
V0:
[[ 1.95846995e-02 -1.76755541e-02 -1.76364849e-03  4.12438364e-03
  -2.00397408e-04 -1.83114693e-04]
 [-1.76755541e-02  7.97353972e-02 -4.79012112e-03 -2.03224100e-04
   1.84549470e-03  3.16437009e-04]
 [-1.76364849e-03 -4.79012112e-03  9.80122037e-02 -1.83650182e-04
   3.16307104e-04  7.36226471e-05]
 [ 4.12438364e-03 -2.03224100e-04 -1.83650182e-04  2.67553661e-02
  -1.80148542e-02 -2.08046640e-03]
 [-2.00397408e-04  1.84549470e-03  3.16307104e-04 -1.80148542e-02
   8.29582346e-02 -4.23708354e-03]
 [-1.83114693e-04  3.16437009e-04  7.36226471e-05 -2.08046640e-03
  -4.23708354e-03  9.81409313e-02]]
LogLike[0016]=-48001.728909
sigma_a=6.216529
R:
[[21.05401648 33.53328233]
 [33.53328233 76.36413188]]
m0:
[197.85903004  48.14282651   5.68700222 411.30074309 111.86647655
  13.60416876]
V0:
[[ 1.90079967e-02 -1.75364373e-02 -1.71971077e-03  4.32034475e-03
  -2.82755331e-04 -2.04694633e-04]
 [-1.75364373e-02  7.93797321e-02 -4.86160669e-03 -2.86867299e-04
   1.94946742e-03  3.31054044e-04]
 [-1.71971077e-03 -4.86160669e-03  9.79844162e-02 -2.05465023e-04
   3.30863744e-04  7.66668336e-05]
 [ 4.32034475e-03 -2.86867299e-04 -2.05465023e-04  2.64878322e-02
  -1.80137739e-02 -2.07206295e-03]
 [-2.82755331e-04  1.94946742e-03  3.30863744e-04 -1.80137739e-02
   8.27743947e-02 -4.28452647e-03]
 [-2.04694633e-04  3.31054044e-04  7.66668336e-05 -2.07206295e-03
  -4.28452647e-03  9.81181454e-02]]
LogLike[0017]=-47642.238892
sigma_a=6.567981
R:
[[20.31864825 32.43337726]
 [32.43337726 73.40164863]]
m0:
[198.4001516   48.08709392   5.67442475 412.26632852 112.19159167
  13.62378437]
V0:
[[ 1.84578941e-02 -1.73881475e-02 -1.67564010e-03  4.50492692e-03
  -3.68076481e-04 -2.26012235e-04]
 [-1.73881475e-02  7.90340880e-02 -4.92901718e-03 -3.73715293e-04
   2.05313564e-03  3.45425600e-04]
 [-1.67564010e-03 -4.92901718e-03  9.79589316e-02 -2.27054560e-04
   3.45163477e-04  7.96146484e-05]
 [ 4.50492692e-03 -3.73715293e-04 -2.27054560e-04  2.62236149e-02
  -1.80071429e-02 -2.06270380e-03]
 [-3.68076481e-04  2.05313564e-03  3.45163477e-04 -1.80071429e-02
   8.25986166e-02 -4.32852733e-03]
 [-2.26012235e-04  3.45425600e-04  7.96146484e-05 -2.06270380e-03
  -4.32852733e-03  9.80974544e-02]]
LogLike[0018]=-47292.640797
sigma_a=6.933031
R:
[[19.61520342 31.35467726]
 [31.35467726 70.53971233]]
m0:
[198.93768297  48.0222764    5.66035913 413.24051268 112.49584819
  13.63754083]
V0:
[[ 1.79336686e-02 -1.72325256e-02 -1.63175892e-03  4.67827451e-03
  -4.55570735e-04 -2.46932357e-04]
 [-1.72325256e-02  7.86976539e-02 -4.99273045e-03 -4.62981467e-04
   2.15652390e-03  3.59561638e-04]
 [-1.63175892e-03 -4.99273045e-03  9.79355055e-02 -2.48282232e-04
   3.59215996e-04  8.24687417e-05]
 [ 4.67827451e-03 -4.62981467e-04 -2.48282232e-04  2.59626827e-02
  -1.79953954e-02 -2.05249604e-03]
 [-4.55570735e-04  2.15652390e-03  3.59215996e-04 -1.79953954e-02
   8.24301634e-02 -4.36943939e-03]
 [-2.46932357e-04  3.59561638e-04  8.24687417e-05 -2.05249604e-03
  -4.36943939e-03  9.80786212e-02]]
LogLike[0019]=-46952.053478
sigma_a=7.312255
R:
[[18.94215735 30.30038201]
 [30.30038201 67.77762472]]
m0:
[199.47213635  47.94894641   5.64490262 414.22312702 112.77944388
  13.64566375]
V0:
[[ 1.74344028e-02 -1.70711695e-02 -1.58832338e-03  4.84064836e-03
  -5.44549232e-04 -2.67348726e-04]
 [-1.70711695e-02  7.83697400e-02 -5.05307334e-03 -5.53980022e-04
   2.25963643e-03  3.73466848e-04]
 [-1.58832338e-03 -5.05307334e-03  9.79139251e-02 -2.69040301e-04
   3.73025711e-04  8.52309095e-05]
 [ 4.84064836e-03 -5.53980022e-04 -2.69040301e-04  2.57049432e-02
  -1.79789164e-02 -2.04153105e-03]
 [-5.44549232e-04  2.25963643e-03  3.73025711e-04 -1.79789164e-02
   8.22683693e-02 -4.40757616e-03]
 [-2.67348726e-04  3.73466848e-04  8.52309095e-05 -2.04153105e-03
  -4.40757616e-03  9.80614383e-02]]
LogLike[0020]=-46619.973878
sigma_a=7.705835
R:
[[18.29802926 29.27261023]
 [29.27261023 65.11366679]]
m0:
[200.00394531  47.86760315   5.6281367  415.21397284 113.04254819
  13.6483639 ]
V0:
[[ 1.69590830e-02 -1.69054623e-02 -1.54553603e-03  4.99237964e-03
  -6.34412304e-04 -2.87178347e-04]
 [-1.69054623e-02  7.80497802e-02 -5.11032541e-03 -6.46114299e-04
   2.36245529e-03  3.87141379e-04]
 [-1.54553603e-03 -5.11032541e-03  9.78940059e-02 -2.89244321e-04
   3.86592467e-04  8.79022450e-05]
 [ 4.99237964e-03 -6.46114299e-04 -2.89244321e-04  2.54502726e-02
  -1.79580440e-02 -2.02988676e-03]
 [-6.34412304e-04  2.36245529e-03  3.86592467e-04 -1.79580440e-02
   8.21126435e-02 -4.44321326e-03]
 [-2.87178347e-04  3.87141379e-04  8.79022450e-05 -2.02988676e-03
  -4.44321326e-03  9.80457251e-02]]
LogLike[0021]=-46295.744729
sigma_a=8.114308
R:
[[17.68180408 28.27330521]
 [28.27330521 62.54713209]]
m0:
[200.53347708  47.77869472   5.61013245 416.21285101 113.28532855
  13.64584219]
V0:
[[ 1.65066360e-02 -1.67366000e-02 -1.50355471e-03  5.13384846e-03
  -7.24640396e-04 -3.06358027e-04]
 [-1.67366000e-02  7.77372956e-02 -5.16473089e-03 -7.38867952e-04
   2.46494919e-03  4.00582732e-04]
 [-1.50355471e-03 -5.16473089e-03  9.78755856e-02 -3.08829704e-04
   3.99913422e-04  9.04835206e-05]
 [ 5.13384846e-03 -7.38867952e-04 -3.08829704e-04  2.51985215e-02
  -1.79330765e-02 -2.01762993e-03]
 [-7.24640396e-04  2.46494919e-03  3.99913422e-04 -1.79330765e-02
   8.19624497e-02 -4.47659666e-03]
 [-3.06358027e-04  4.00582732e-04  9.04835206e-05 -2.01762993e-03
  -4.47659666e-03  9.80313224e-02]]
LogLike[0022]=-45978.812161
sigma_a=8.538173
R:
[[17.09225844 27.30349521]
 [27.30349521 60.076146  ]]
m0:
[201.06103352  47.68262877   5.59095254 417.21953488 113.5079379
  13.63828917]
V0:
[[ 1.60759797e-02 -1.65656167e-02 -1.46250140e-03  5.26545768e-03
  -8.14782645e-04 -3.24840267e-04]
 [-1.65656167e-02  7.74318948e-02 -5.21650117e-03 -8.31793441e-04
   2.56707202e-03  4.13786075e-04]
 [-1.46250140e-03 -5.21650117e-03  9.78585227e-02 -3.27747590e-04
   4.12983368e-04  9.29752280e-05]
 [ 5.26545768e-03 -8.31793441e-04 -3.27747590e-04  2.49495339e-02
  -1.79042764e-02 -2.00481806e-03]
 [-8.14782645e-04  2.56707202e-03  4.12983368e-04 -1.79042764e-02
   8.18173089e-02 -4.50794417e-03]
 [-3.24840267e-04  4.13786075e-04  9.29752280e-05 -2.00481806e-03
  -4.50794417e-03  9.80180908e-02]]
LogLike[0023]=-45668.772842
sigma_a=8.977763
R:
[[16.5281429  26.36371688]
 [26.36371688 57.69844484]]
m0:
[201.58686797  47.57977842   5.57065274 418.23378474 113.71052549
  13.6258871 ]
V0:
[[ 1.56660352e-02 -1.63934005e-02 -1.42246766e-03  5.38762367e-03
  -9.04450698e-04 -3.42590950e-04]
 [-1.63934005e-02  7.71332524e-02 -5.26582146e-03 -9.24505916e-04
   2.66876872e-03  4.26745394e-04]
 [-1.42246766e-03 -5.26582146e-03  9.78426924e-02 -3.45962546e-04
   4.25795879e-04  9.53777793e-05]
 [ 5.38762367e-03 -9.24505916e-04 -3.45962546e-04  2.47031489e-02
  -1.78718738e-02 -1.99150065e-03]
 [-9.04450698e-04  2.66876872e-03  4.25795879e-04 -1.78718738e-02
   8.16767889e-02 -4.53744981e-03]
 [-3.42590950e-04  4.26745394e-04  9.53777793e-05 -1.99150065e-03
  -4.53744981e-03  9.80059079e-02]]
LogLike[0024]=-45365.286692
sigma_a=9.433329
R:
[[15.98826146 25.45422336]
 [25.45422336 55.41173061]]
m0:
[202.11119744  47.47048769   5.54928347 419.25535662 113.89324965
  13.60881247]
V0:
[[ 1.52757365e-02 -1.62207110e-02 -1.38351948e-03  5.50076895e-03
  -9.93312250e-04 -3.59587298e-04]
 [-1.62207110e-02  7.68410901e-02 -5.31285639e-03 -1.01667671e-03
   2.76998023e-03  4.39454343e-04]
 [-1.38351948e-03 -5.31285639e-03  9.78279840e-02 -3.63450504e-04
   4.38344166e-04  9.76916479e-05]
 [ 5.50076895e-03 -1.01667671e-03 -3.63450504e-04  2.44592040e-02
  -1.78360709e-02 -1.97772049e-03]
 [-9.93312250e-04  2.76998023e-03  4.38344166e-04 -1.78360709e-02
   8.15404954e-02 -4.56528781e-03]
 [-3.59587298e-04  4.39454343e-04  9.76916479e-05 -1.97772049e-03
  -4.56528781e-03  9.79946651e-02]]
LogLike[0025]=-45067.882889
sigma_a=9.905405
R:
[[15.47139878 24.57493915]
 [24.57493915 53.21342126]]
m0:
[202.63421137  47.35507494   5.52689051 420.28400208 114.05628402
  13.5872376 ]
V0:
[[ 1.49040407e-02 -1.60481944e-02 -1.34570166e-03  5.60531541e-03
  -1.08108474e-03 -3.75815969e-04]
 [-1.60481944e-02  7.65551647e-02 -5.35775365e-03 -1.10802694e-03
   2.87064629e-03  4.51906736e-04]
 [-1.34570166e-03 -5.35775365e-03  9.78142987e-02 -3.80196849e-04
   4.50621569e-04  9.99174347e-05]
 [ 5.60531541e-03 -1.10802694e-03 -3.80196849e-04  2.42175378e-02
  -1.77970462e-02 -1.96351481e-03]
 [-1.08108474e-03  2.87064629e-03  4.50621569e-04 -1.77970462e-02
   8.14080660e-02 -4.59161524e-03]
 [-3.75815969e-04  4.51906736e-04  9.99174347e-05 -1.96351481e-03
  -4.59161524e-03  9.79842658e-02]]
LogLike[0026]=-44776.082758
sigma_a=10.394594
R:
[[14.97613319 23.72522413]
 [23.72522413 51.09993006]]
m0:
[203.15607795  47.23383223   5.50351491 421.31946073 114.19981053
  13.56132998]
V0:
[[ 0.01454994 -0.01587639 -0.00130904  0.00570168 -0.00116753 -0.00039127]
 [-0.01587639  0.07627526 -0.00540065 -0.00119832  0.00297071  0.0004641 ]
 [-0.00130904 -0.00540065  0.09780155 -0.00039619  0.00046262  0.00010206]
 [ 0.00570168 -0.00119832 -0.00039619  0.02397799 -0.01775495 -0.00194892]
 [-0.00116753  0.00297071  0.00046262 -0.01775495  0.08127917 -0.00461657]
 [-0.00039127  0.0004641   0.00010206 -0.00194892 -0.00461657  0.09797462]]
LogLike[0027]=-44489.579638
sigma_a=10.901122
R:
[[14.50099108 22.90412569]
 [22.90412569 49.06719813]]
m0:
[203.67695389  47.10702528   5.4791932  422.36147482 114.32401996
  13.53125198]
V0:
[[ 0.01421244 -0.01570576 -0.00127355  0.00579027 -0.00125245 -0.00040595]
 [-0.01570576  0.07600119 -0.00544165 -0.00128737  0.00307011  0.00047602]
 [-0.00127355 -0.00544165  0.09778966 -0.00041144  0.00047434  0.00010411]
 [ 0.00579027 -0.00128737 -0.00041144  0.02374042 -0.01770993 -0.00193395]
 [-0.00125245  0.00307011  0.00047434 -0.01770993  0.0811535  -0.00464029]
 [-0.00040595  0.00047602  0.00010411 -0.00193395 -0.00464029  0.09796567]]
LogLike[0028]=-44207.824156
sigma_a=11.425807
R:
[[14.04468668 22.11074994]
 [22.11074994 47.11159858]]
m0:
[204.19699177  46.97489802   5.45395855 423.40981104 114.4291221
  13.4971621 ]
V0:
[[ 0.0138906  -0.01553665 -0.00123923  0.00587149 -0.0013357  -0.00041987]
 [-0.01553665  0.07573277 -0.00548089 -0.00137502  0.0031688   0.00048767]
 [-0.00123923 -0.00548089  0.09777855 -0.00042595  0.00048577  0.00010607]
 [ 0.00587149 -0.00137502 -0.00042595  0.02350466 -0.01766209 -0.00191864]
 [-0.0013357   0.0031688   0.00048577 -0.01766209  0.08103077 -0.00466288]
 [-0.00041987  0.00048767  0.00010607 -0.00191864 -0.00466288  0.09795732]]
LogLike[0029]=-43930.345885
sigma_a=11.969322
R:
[[13.60574902 21.34372401]
 [21.34372401 45.22859432]]
m0:
[204.71633594  46.83767282   5.4278404  424.46423821 114.51532734
  13.45921323]
V0:
[[ 0.01358349 -0.01536935 -0.00120606  0.00594574 -0.00141714 -0.00043304]
 [-0.01536935  0.0754698  -0.00551845 -0.00146115  0.00326675  0.00049905]
 [-0.00120606 -0.00551845  0.09776816 -0.00043973  0.00049691  0.00010796]
 [ 0.00594574 -0.00146115 -0.00043973  0.02327056 -0.01761152 -0.00190302]
 [-0.00141714  0.00326675  0.00049691 -0.01761152  0.08091071 -0.00468445]
 [-0.00043304  0.00049905  0.00010796 -0.00190302 -0.00468445  0.09794953]]
LogLike[0030]=-43656.658116
sigma_a=12.532441
R:
[[13.18282448 20.60167382]
 [20.60167382 43.41385221]]
m0:
[205.2351314   46.69555252   5.40086498 425.52455395 114.58284817
  13.41755211]
V0:
[[ 0.01329025 -0.0152041  -0.00117403  0.00601338 -0.00149668 -0.00044546]
 [-0.0152041   0.07521211 -0.00555444 -0.00154568  0.00336392  0.00051016]
 [-0.00117403 -0.00555444  0.09775844 -0.00045278  0.00050777  0.00010976]
 [ 0.00601338 -0.00154568 -0.00045278  0.02303796 -0.0175583  -0.00188708]
 [-0.00149668  0.00336392  0.00050777 -0.0175583   0.08079307 -0.00470509]
 [-0.00044546  0.00051016  0.00010976 -0.00188708 -0.00470509  0.09794225]]
LogLike[0031]=-43386.234493
sigma_a=13.116125
R:
[[12.77463475 19.88318091]
 [19.88318091 41.6631466 ]]
m0:
[205.75352321  46.54872364   5.3730557  426.5905852  114.63189368
  13.37231893]
V0:
[[ 0.01301002 -0.01504104 -0.0011431   0.00607478 -0.00157425 -0.00045717]
 [-0.01504104  0.07495953 -0.00558894 -0.00162854  0.0034603   0.000521  ]
 [-0.0011431  -0.00558894  0.09774933 -0.00046514  0.00051833  0.00011148]
 [ 0.00607478 -0.00162854 -0.00046514  0.02280673 -0.0175025  -0.00187086]
 [-0.00157425  0.0034603   0.00051833 -0.0175025   0.0806776  -0.0047249 ]
 [-0.00045717  0.000521    0.00011148 -0.00187086 -0.0047249   0.09793541]]
LogLike[0032]=-43118.576195
sigma_a=13.721353
R:
[[12.3799549  19.18677521]
 [19.18677521 39.97232163]]
m0:
[206.27165705  46.39735843   5.34443327 427.66218872 114.66266221
  13.32364671]
V0:
[[ 0.01274202 -0.01488031 -0.00111326  0.00613029 -0.00164981 -0.00046817]
 [-0.01488031  0.07471187 -0.00562204 -0.00170968  0.00355588  0.00053156]
 [-0.00111326 -0.00562204  0.09774078 -0.00047681  0.0005286   0.00011312]
 [ 0.00613029 -0.00170968 -0.00047681  0.0225767  -0.01744415 -0.00185436]
 [-0.00164981  0.00355588  0.0005286  -0.01744415  0.08056408 -0.00474394]
 [-0.00046817  0.00053156  0.00011312 -0.00185436 -0.00474394  0.09792898]]
LogLike[0033]=-42853.108744
sigma_a=14.349476
R:
[[11.99767834 18.51105721]
 [18.51105721 38.33756351]]
m0:
[206.78968135  46.2416172    5.31501599 428.73925798 114.67533787
  13.27166097]
V0:
[[ 0.01248549 -0.01472198 -0.00108446  0.00618024 -0.00172332 -0.0004785 ]
 [-0.01472198  0.07446895 -0.00565381 -0.0017891   0.00365064  0.00054186]
 [-0.00108446 -0.00565381  0.09773276 -0.00048782  0.00053859  0.00011469]
 [ 0.00618024 -0.0017891  -0.00048782  0.02234773 -0.0173833  -0.00183758]
 [-0.00172332  0.00365064  0.00053859 -0.0173833   0.08045228 -0.00476231]
 [-0.0004785   0.00054186  0.00011469 -0.00183758 -0.00476231  0.09792293]]
LogLike[0034]=-42589.346361
sigma_a=15.001709
R:
[[11.62672985 17.85459047]
 [17.85459047 36.75512332]]
m0:
[207.30774582  46.0816493    5.28481963 429.82171552 114.67008134
  13.21647925]
V0:
[[ 0.01223973 -0.01456608 -0.00105668  0.00622494 -0.00179477 -0.00048816]
 [-0.01456608  0.07423061 -0.00568433 -0.00186678  0.0037446   0.0005519 ]
 [-0.00105668 -0.00568433  0.09772522 -0.00049819  0.00054829  0.00011618]
 [ 0.00622494 -0.00186678 -0.00049819  0.02211967 -0.01731995 -0.00182054]
 [-0.00179477  0.0037446   0.00054829 -0.01731995  0.080342   -0.00478006]
 [-0.00048816  0.0005519   0.00011618 -0.00182054 -0.00478006  0.09791721]]
LogLike[0035]=-42326.772153
sigma_a=15.679544
R:
[[11.26620362 17.2161289 ]
 [17.2161289  35.22183214]]
m0:
[207.82600513  45.91759502   5.25385769 430.90952514 114.64703002
  13.15821113]
V0:
[[ 0.01200407 -0.01441266 -0.00102986  0.00626466 -0.00186416 -0.00049719]
 [-0.01441266  0.07399665 -0.00571366 -0.00194273  0.00383777  0.00056167]
 [-0.00102986 -0.00571366  0.09771812 -0.00050793  0.00055771  0.0001176 ]
 [ 0.00626466 -0.00194273 -0.00050793  0.02189236 -0.01725412 -0.00180325]
 [-0.00186416  0.00383777  0.00055771 -0.01725412  0.08023302 -0.00479725]
 [-0.00049719  0.00056167  0.0001176  -0.00180325 -0.00479725  0.0979118 ]]
LogLike[0036]=-42064.905449
sigma_a=16.384541
R:
[[10.91526741 16.59449025]
 [16.59449025 33.73479152]]
m0:
[208.34461626  45.74958678   5.22214145 432.00268104 114.60629282
  13.09695855]
V0:
[[ 0.01177789 -0.0142617  -0.00100398  0.00629967 -0.00193147 -0.0005056 ]
 [-0.0142617   0.07376692 -0.00574187 -0.00201696  0.00393014  0.00057119]
 [-0.00100398 -0.00574187  0.09771145 -0.00051707  0.00056686  0.00011895]
 [ 0.00629967 -0.00201696 -0.00051707  0.02166567 -0.0171858  -0.0017857 ]
 [-0.00193147  0.00393014  0.00056686 -0.0171858   0.08012515 -0.00481395]
 [-0.0005056   0.00057119  0.00011895 -0.0017857  -0.00481395  0.09790666]]
LogLike[0037]=-41803.313024
sigma_a=17.118285
R:
[[10.57320316 15.98863239]
 [15.98863239 32.29152309]]
m0:
[208.86373982  45.57774961   5.18967997 433.10120919 114.54794858
  13.03281598]
V0:
[[ 0.01156062 -0.0141132  -0.00097899  0.00633022 -0.00199672 -0.00051341]
 [-0.0141132   0.07354125 -0.00576902 -0.00208949  0.00402175  0.00058046]
 [-0.00097899 -0.00576902  0.09770515 -0.00052564  0.00057572  0.00012023]
 [ 0.00633022 -0.00208949 -0.00052564  0.02143944 -0.01711498 -0.00176789]
 [-0.00199672  0.00402175  0.00057572 -0.01711498  0.0800182  -0.00483021]
 [-0.00051341  0.00058046  0.00012023 -0.00176789 -0.00483021  0.09790177]]
LogLike[0038]=-41541.578533
sigma_a=17.882516
R:
[[10.23941402 15.39767496]
 [15.39767496 30.89000159]]
m0:
[209.38353987  45.40220191   5.15648025 434.20516506 114.47204611
  12.96587106]
V0:
[[ 0.01135174 -0.01396713 -0.00095488  0.00635653 -0.00205992 -0.00052065]
 [-0.01396713  0.07331948 -0.00579516 -0.00216035  0.00411261  0.00058949]
 [-0.00095488 -0.00579516  0.09769922 -0.00053363  0.00058432  0.00012144]
 [ 0.00635653 -0.00216035 -0.00053363  0.02121354 -0.01704164 -0.00174984]
 [-0.00205992  0.00411261  0.00058432 -0.01704164  0.07991198 -0.00484608]
 [-0.00052065  0.00058949  0.00012144 -0.00174984 -0.00484608  0.09789712]]
LogLike[0039]=-41279.289629
sigma_a=18.679211
R:
[[ 9.91338871 14.82085581]
 [14.82085581 29.52853379]]
m0:
[209.90418259  45.2230554    5.12254725 435.31462603 114.37860357
  12.89620525]
V0:
[[ 0.01115074 -0.01382346 -0.00093158  0.00637879 -0.00212107 -0.00052732]
 [-0.01382346  0.07310148 -0.00582033 -0.00222954  0.00420272  0.00059827]
 [-0.00093158 -0.00582033  0.09769362 -0.00054108  0.00059264  0.00012259]
 [ 0.00637879 -0.00222954 -0.00054108  0.02098782 -0.01696575 -0.00173154]
 [-0.00212107  0.00420272  0.00059264 -0.01696575  0.07980631 -0.0048616 ]
 [-0.00052732  0.00059827  0.00012259 -0.00173154 -0.0048616   0.09789267]]
LogLike[0040]=-41016.084028
sigma_a=19.510403
R:
[[ 9.59467623 14.25750074]
 [14.25750074 28.2056652 ]]
m0:
[210.42583543  45.04041434   5.08788383 436.42968469 114.26760758
  12.82389445]
V0:
[[ 0.01095718 -0.01368218 -0.00090909  0.00639718 -0.00218017 -0.00053345]
 [-0.01368218  0.07288711 -0.0058446  -0.00229709  0.0042921   0.00060681]
 [-0.00090909 -0.0058446   0.09768834 -0.000548    0.0006007   0.00012368]
 [ 0.00639718 -0.00229709 -0.000548    0.02076216 -0.01688729 -0.001713  ]
 [-0.00218017  0.0042921   0.0006007  -0.01688729  0.07970102 -0.00487682]
 [-0.00053345  0.00060681  0.00012368 -0.001713   -0.00487682  0.0978884 ]]
LogLike[0041]=-40751.669528
sigma_a=20.378070
R:
[[ 9.28290993 13.70706373]
 [13.70706373 26.92025358]]
m0:
[210.94866765  44.8543747    5.05249084 437.55044817 114.13901475
  12.74900952]
V0:
[[ 0.01077064 -0.01354325 -0.00088737  0.00641187 -0.00223723 -0.00053905]
 [-0.01354325  0.07267625 -0.00586799 -0.00236301  0.00438076  0.00061512]
 [-0.00088737 -0.00586799  0.09768334 -0.0005544   0.00060848  0.0001247 ]
 [ 0.00641187 -0.00236301 -0.0005544   0.02053644 -0.01680621 -0.0016942 ]
 [-0.00223723  0.00438076  0.00060848 -0.01680621  0.07959593 -0.00489178]
 [-0.00053905  0.00061512  0.0001247  -0.0016942  -0.00489178  0.09788431]]
LogLike[0042]=-40485.798004
sigma_a=21.284247
R:
[[ 8.97781348 13.16913834]
 [13.16913834 25.67148479]]
m0:
[211.47284997  44.66502369   5.0163673  438.67703594 113.9927554
  12.67161716]
V0:
[[ 0.01059074 -0.01340664 -0.00086638  0.00642298 -0.00229224 -0.00054414]
 [-0.01340664  0.07246879 -0.00589055 -0.00242732  0.00446869  0.00062319]
 [-0.00086638 -0.00589055  0.09767863 -0.00056029  0.000616    0.00012566]
 [ 0.00642298 -0.00242732 -0.00056029  0.02031053 -0.01672249 -0.00167517]
 [-0.00229224  0.00446869  0.000616   -0.01672249  0.07949089 -0.00490651]
 [-0.00054414  0.00062319  0.00012566 -0.00167517 -0.00490651  0.09788037]]
LogLike[0043]=-40218.256874
sigma_a=22.231053
R:
[[ 8.67916635 12.64340877]
 [12.64340877 24.4587525 ]]
m0:
[211.99855327  44.47243861   4.97951049 439.80957279 113.82873711
  12.59178082]
V0:
[[ 0.01041711 -0.01327234 -0.0008461   0.00643063 -0.00234519 -0.00054872]
 [-0.01327234  0.07226464 -0.00591232 -0.00249001  0.00455589  0.00063102]
 [-0.0008461  -0.00591232  0.09767416 -0.00056569  0.00062326  0.00012656]
 [ 0.00643063 -0.00249001 -0.00056569  0.02008432 -0.01663609 -0.00165588]
 [-0.00234519  0.00455589  0.00062326 -0.01663609  0.07938573 -0.00492106]
 [-0.00054872  0.00063102  0.00012656 -0.00165588 -0.00492106  0.09787658]]
LogLike[0044]=-39948.866309
sigma_a=23.220691
R:
[[ 8.3867795  12.12961543]
 [12.12961543 23.28156775]]
m0:
[212.52594828  44.27668498   4.94191606 440.94818369 113.64684796
  12.50956152]
V0:
[[ 0.01024944 -0.01314031 -0.00082651  0.00643494 -0.00239607 -0.00055282]
 [-0.01314031  0.07206372 -0.00593332 -0.00255108  0.00464235  0.00063862]
 [-0.00082651 -0.00593332  0.09766994 -0.0005706   0.00063024  0.0001274 ]
 [ 0.00643494 -0.00255108 -0.0005706   0.01985771 -0.01654697 -0.00163636]
 [-0.00239607  0.00464235  0.00063024 -0.01654697  0.07928031 -0.00493545]
 [-0.00055282  0.00063862  0.0001274  -0.00163636 -0.00493545  0.09787291]]
LogLike[0045]=-39677.495752
sigma_a=24.255328
R:
[[ 8.10047964 11.62753223]
 [11.62753223 22.13949793]]
m0:
[213.05520589  44.07781417   4.90357799 442.09299059 113.44695975
  12.42501842]
V0:
[[ 0.01008742 -0.01301055 -0.00080757  0.00643597 -0.00244486 -0.00055642]
 [-0.01301055  0.07186597 -0.00595359 -0.00261052  0.00472804  0.00064599]
 [-0.00080757 -0.00595359  0.09766595 -0.00057503  0.00063694  0.00012819]
 [ 0.00643597 -0.00261052 -0.00057503  0.01963061 -0.01645509 -0.00161659]
 [-0.00244486  0.00472804  0.00063694 -0.01645509  0.07917448 -0.00494971]
 [-0.00055642  0.00064599  0.00012819 -0.00161659 -0.00494971  0.09786936]]
LogLike[0046]=-39404.042189
sigma_a=25.337171
R:
[[ 7.82011112 11.13696915]
 [11.13696915 21.03216474]]
m0:
[213.58649858  43.87586086   4.86448863 443.24411299 113.22893165
  12.33820926]
V0:
[[ 0.00993077 -0.01288305 -0.00078928  0.00643381 -0.00249153 -0.00055956]
 [-0.01288305  0.07167133 -0.00597316 -0.00266831  0.00481293  0.00065311]
 [-0.00078928 -0.00597316  0.09766216 -0.00057899  0.00064338  0.00012891]
 [ 0.00643381 -0.00266831 -0.00057899  0.01940292 -0.01636042 -0.00159659]
 [-0.00249153  0.00481293  0.00064338 -0.01636042  0.07906809 -0.00496387]
 [-0.00055956  0.00065311  0.00012891 -0.00159659 -0.00496387  0.09786591]]
LogLike[0047]=-39128.437210
sigma_a=26.468374
R:
[[ 7.54551546 10.65774228]
 [10.65774228 19.95917512]]
m0:
[214.12000115  43.67084032   4.82463873 444.4016661  112.99261351
  12.24919079]
V0:
[[ 0.00977923 -0.0127578  -0.0007716   0.00642851 -0.00253604 -0.00056222]
 [-0.0127578   0.07147978 -0.00599204 -0.00272441  0.00489697  0.00066   ]
 [-0.0007716  -0.00599204  0.09765858 -0.00058248  0.00064953  0.00012958]
 [ 0.00642851 -0.00272441 -0.00058248  0.01917458 -0.01626293 -0.00157634]
 [-0.00253604  0.00489697  0.00064953 -0.01626293  0.07896103 -0.00497796]
 [-0.00056222  0.00066     0.00012958 -0.00157634 -0.00497796  0.09786256]]
LogLike[0048]=-38850.588060
sigma_a=27.651363
R:
[[ 7.27653203 10.18967451]
 [10.18967451 18.92011794]]
m0:
[214.65589279  43.46274533   4.78401739 445.56576296 112.7378487
  12.15801895]
V0:
[[ 0.00963255 -0.01263478 -0.00075452  0.00642012 -0.00257836 -0.00056443]
 [-0.01263478  0.07129127 -0.00601026 -0.00277879  0.00498013  0.00066664]
 [-0.00075452 -0.00601026  0.09765519 -0.0005855   0.00065539  0.00013018]
 [ 0.00642012 -0.00277879 -0.0005855   0.0189455  -0.0161626  -0.00155587]
 [-0.00257836  0.00498013  0.00065539 -0.0161626   0.07885315 -0.004992  ]
 [-0.00056443  0.00066664  0.00013018 -0.00155587 -0.004992    0.09785929]]
LogLike[0049]=-38570.428827
sigma_a=28.888455
R:
[[ 7.01296193  9.73254374]
 [ 9.73254374 17.9144515 ]]
m0:
[215.19435766  43.251543     4.74261198 446.73651091 112.46447499
  12.06474907]
V0:
[[ 0.00949051 -0.012514   -0.00073801  0.00640866 -0.00261844 -0.00056618]
 [-0.012514    0.0711058  -0.00602785 -0.00283139  0.00506234  0.00067303]
 [-0.00073801 -0.00602785  0.09765197 -0.00058806  0.00066096  0.00013073]
 [ 0.00640866 -0.00283139 -0.00058806  0.01871564 -0.01605939 -0.00153517]
 [-0.00261844  0.00506234  0.00066096 -0.01605939  0.07874434 -0.00500601]
 [-0.00056618  0.00067303  0.00013073 -0.00153517 -0.00500601  0.0978561 ]]
LogLike[0050]=-38287.879057
sigma_a=30.182082
R:
[[ 6.75460466  9.28613508]
 [ 9.28613508 16.9416094 ]]
m0:
[215.73558907  43.03717133   4.70040802 447.91402056 112.17232485
  11.96943549]
V0:
[[ 0.00935287 -0.01239545 -0.00072206  0.00639417 -0.00265623 -0.00056747]
 [-0.01239545  0.07092336 -0.00604483 -0.00288216  0.00514352  0.00067916]
 [-0.00072206 -0.00604483  0.09764892 -0.00059015  0.00066623  0.00013122]
 [ 0.00639417 -0.00288216 -0.00059015  0.01848493 -0.01595328 -0.00151425]
 [-0.00265623  0.00514352  0.00066623 -0.01595328  0.07863449 -0.00502002]
 [-0.00056747  0.00067916  0.00013122 -0.00151425 -0.00502002  0.09785298]]
LogLike[0051]=-38002.815762
sigma_a=31.534959
R:
[[ 6.50124719  8.85022489]
 [ 8.85022489 16.00096912]]
m0:
[216.27979061  42.81953667   4.65738915 449.09840652 111.86122544
  11.87213144]
V0:
[[ 0.00921943 -0.01227912 -0.00070664  0.00637665 -0.00269168 -0.00056832]
 [-0.01227912  0.07074394 -0.00606121 -0.00293104  0.00522362  0.00068503]
 [-0.00070664 -0.00606121  0.09764603 -0.00059179  0.00067119  0.00013166]
 [ 0.00637665 -0.00293104 -0.00059179  0.01825332 -0.01584426 -0.00149311]
 [-0.00269168  0.00522362  0.00067119 -0.01584426  0.07852349 -0.00503403]
 [-0.00056832  0.00068503  0.00013166 -0.00149311 -0.00503403  0.09784993]]
LogLike[0052]=-37715.098574
sigma_a=32.949873
R:
[[ 6.25265721  8.42457107]
 [ 8.42457107 15.09183222]]
m0:
[216.8271774   42.59851101   4.61353706 450.28978792 111.53099687
  11.77288897]
V0:
[[ 0.00908997 -0.012165   -0.00069173  0.00635612 -0.00272473 -0.00056873]
 [-0.012165    0.07056753 -0.00607701 -0.00297796  0.00530253  0.00069063]
 [-0.00069173 -0.00607701  0.09764329 -0.00059296  0.00067584  0.00013203]
 [ 0.00635612 -0.00297796 -0.00059296  0.01802076 -0.01573229 -0.00147175]
 [-0.00272473  0.00530253  0.00067584 -0.01573229  0.07841122 -0.00504808]
 [-0.00056873  0.00069063  0.00013203 -0.00147175 -0.00504808  0.09784693]]
LogLike[0053]=-37424.546970
sigma_a=34.429850
R:
[[ 6.00861133  8.00895175]
 [ 8.00895175 14.21350338]]
m0:
[217.37797871  42.37392972   4.56883145 451.48829499 111.18144954
  11.67175839]
V0:
[[ 0.0089643  -0.01205306 -0.00067731  0.00633258 -0.00275532 -0.0005687 ]
 [-0.01205306  0.07039415 -0.00609226 -0.00302284  0.00538017  0.00069596]
 [-0.00067731 -0.00609226  0.09764069 -0.00059367  0.00068016  0.00013235]
 [ 0.00633258 -0.00302284 -0.00059367  0.01778721 -0.01561737 -0.00145019]
 [-0.00275532  0.00538017  0.00068016 -0.01561737  0.07829758 -0.00506217]
 [-0.0005687   0.00069596  0.00013235 -0.00145019 -0.00506217  0.09784398]]
LogLike[0054]=-37130.931391
sigma_a=35.978224
R:
[[ 5.76889852  7.60316878]
 [ 7.60316878 13.36530057]]
m0:
[217.93243826  42.14559019   4.52325007 452.69406981 110.81238181
  11.56878824]
V0:
[[ 0.00884221 -0.01194328 -0.00066337  0.00630602 -0.00278339 -0.00056823]
 [-0.01194328  0.07022377 -0.00610697 -0.0030656   0.00545645  0.00070099]
 [-0.00066337 -0.00610697  0.09763822 -0.00059392  0.00068416  0.00013261]
 [ 0.00630602 -0.0030656  -0.00059392  0.01755261 -0.01549946 -0.00142842]
 [-0.00278339  0.00545645  0.00068416 -0.01549946  0.07818248 -0.00507633]
 [-0.00056823  0.00070099  0.00013261 -0.00142842 -0.00507633  0.09784108]]
LogLike[0055]=-36833.978861
sigma_a=37.598627
R:
[[ 5.53332625  7.20705453]
 [ 7.20705453 12.54657119]]
m0:
[218.49081405  41.91325076   4.47676886 453.90726632 110.42357728
  11.46402515]
V0:
[[ 0.0087235  -0.01183563 -0.00064988  0.00627644 -0.00280887 -0.00056733]
 [-0.01183563  0.07005641 -0.00612115 -0.00310616  0.00553127  0.00070574]
 [-0.00064988 -0.00612115  0.09763587 -0.0005937   0.00068781  0.00013282]
 [ 0.00627644 -0.00310616 -0.0005937   0.01731692 -0.01537853 -0.00140646]
 [-0.00280887  0.00553127  0.00068781 -0.01537853  0.0780658  -0.00509056]
 [-0.00056733  0.00070574  0.00013282 -0.00140646 -0.00509056  0.09783822]]
LogLike[0056]=-36533.363878
sigma_a=39.295110
R:
[[ 5.30173326  6.82048722]
 [ 6.82048722 11.75672494]]
m0:
[219.05337794  41.67663023   4.42936208 455.12805053 110.01480199
  11.35751394]
V0:
[[ 0.00860799 -0.01173007 -0.00063681  0.00624382 -0.0028317  -0.000566  ]
 [-0.01173007  0.06989204 -0.00613484 -0.00314442  0.00560453  0.00071018]
 [-0.00063681 -0.00613484  0.09763364 -0.00059302  0.00069112  0.00013296]
 [ 0.00624382 -0.00314442 -0.00059302  0.01708009 -0.01525457 -0.0013843 ]
 [-0.0028317   0.00560453  0.00069112 -0.01525457  0.07794745 -0.00510488]
 [-0.000566    0.00071018  0.00013296 -0.0013843  -0.00510488  0.0978354 ]]
LogLike[0057]=-36228.723407
sigma_a=41.072062
R:
[[ 5.07399212  6.4433919 ]
 [ 6.4433919  10.9952391 ]]
m0:
[219.62041381  41.43540796   4.38100263 456.35659732 109.58580255
  11.24929789]
V0:
[[ 0.00849548 -0.01162655 -0.00062416  0.00620815 -0.00285182 -0.00056424]
 [-0.01162655  0.06973066 -0.00614804 -0.0031803   0.0056761   0.00071431]
 [-0.00062416 -0.00614804  0.09763152 -0.00059188  0.00069407  0.00013305]
 [ 0.00620815 -0.0031803  -0.00059188  0.01684206 -0.01512753 -0.00136195]
 [-0.00285182  0.0056761   0.00069407 -0.01512753  0.07782731 -0.0051193 ]
 [-0.00056424  0.00071431  0.00013305 -0.00136195 -0.0051193   0.09783261]]
LogLike[0058]=-35919.653939
sigma_a=42.934308
R:
[[ 4.85002005  6.07575212]
 [ 6.07575212 10.26168377]]
m0:
[220.19221583  41.18922416   4.33166235 457.59308817 109.13630473
  11.13941905]
V0:
[[ 0.00838578 -0.01152501 -0.00061188  0.0061694  -0.00286915 -0.00056205]
 [-0.01152501  0.06957224 -0.00616078 -0.00321369  0.0057459   0.00071813]
 [-0.00061188 -0.00616078  0.09762951 -0.00059026  0.00069666  0.00013309]
 [ 0.0061694  -0.00321369 -0.00059026  0.01660279 -0.01499737 -0.00133941]
 [-0.00286915  0.0057459   0.00069666 -0.01499737  0.07770528 -0.00513383]
 [-0.00056205  0.00071813  0.00013309 -0.00133941 -0.00513383  0.09782986]]
LogLike[0059]=-35605.712575
sigma_a=44.887182
R:
[[4.62977829 5.71760596]
 [5.71760596 9.55571748]]
m0:
[220.76908526  40.93768081   4.28131247 458.83770506 108.6660138
  11.02791897]
V0:
[[ 0.0082787  -0.01142538 -0.00059998  0.00612756 -0.00288362 -0.00055944]
 [-0.01142538  0.06941675 -0.00617308 -0.0032445   0.00581378  0.00072161]
 [-0.00059998 -0.00617308  0.09762758 -0.00058818  0.00069888  0.00013306]
 [ 0.00612756 -0.0032445  -0.00058818  0.01636221 -0.01486405 -0.00131669]
 [-0.00288362  0.00581378  0.00069888 -0.01486405  0.07758125 -0.00514849]
 [-0.00055944  0.00072161  0.00013306 -0.00131669 -0.00514849  0.09782712]]
LogLike[0060]=-35286.435152
sigma_a=46.936413
R:
[[4.41326879 5.36903871]
 [5.36903871 8.87707612]]
m0:
[221.35132666  40.68034267   4.22992415 460.09062268 108.17461603
  10.91483956]
V0:
[[ 0.00817405 -0.01132761 -0.00058841  0.00608259 -0.00289516 -0.00055641]
 [-0.01132761  0.06926417 -0.00618495 -0.00327261  0.00587965  0.00072476]
 [-0.00058841 -0.00618495  0.09762575 -0.00058563  0.00070072  0.00013298]
 [ 0.00608259 -0.00327261 -0.00058563  0.01612028 -0.01472752 -0.00129378]
 [-0.00289516  0.00587965  0.00070072 -0.01472752  0.07745511 -0.00516329]
 [-0.00055641  0.00072476  0.00013298 -0.00129378 -0.00516329  0.09782442]]
LogLike[0061]=-34961.339388
sigma_a=49.088176
R:
[[4.20053675 5.03018308]
 [5.03018308 8.22557528]]
m0:
[221.9392445   40.41673841   4.177469   461.35200171 107.66178136
  10.800224  ]
V0:
[[ 0.00807167 -0.0112316  -0.00057716  0.00603449 -0.00290369 -0.00055296]
 [-0.0112316   0.06911445 -0.00619642 -0.00329793  0.00594336  0.00072756]
 [-0.00057716 -0.00619642  0.097624   -0.0005826   0.00070216  0.00013284]
 [ 0.00603449 -0.00329793 -0.0005826   0.01587695 -0.01458773 -0.0012707 ]
 [-0.00290369  0.00594336  0.00070216 -0.01458773  0.07732673 -0.00517824]
 [-0.00055296  0.00072756  0.00013284 -0.0012707  -0.00517824  0.09782173]]
LogLike[0062]=-34629.919774
sigma_a=51.349225
R:
[[3.99166469 4.70120871]
 [4.70120871 7.60109325]]
m0:
[222.53313858  40.14636197   4.1239198  462.62197905 107.12716822
  10.68411793]
V0:
[[ 0.00797135 -0.01113728 -0.0005662   0.00598321 -0.00290914 -0.0005491 ]
 [-0.01113728  0.06896755 -0.0062075  -0.00332033  0.00600478  0.00073   ]
 [-0.0005662  -0.0062075   0.09762233 -0.00057911  0.00070321  0.00013264]
 [ 0.00598321 -0.00332033 -0.00057911  0.01563218 -0.01444462 -0.00124745]
 [-0.00290914  0.00600478  0.00070321 -0.01444462  0.07719601 -0.00519335]
 [-0.0005491   0.00073     0.00013264 -0.00124745 -0.00519335  0.09781907]]
LogLike[0063]=-34291.671039
sigma_a=53.726691
R:
[[3.78676009 4.38230417]
 [4.38230417 7.00354068]]
m0:
[223.13329861  39.86867419   4.06925124 463.90065529 106.57043025
  10.56657087]
V0:
[[ 0.00787294 -0.01104455 -0.00055553  0.00592873 -0.00291143 -0.00054482]
 [-0.01104455  0.06882342 -0.00621822 -0.0033397   0.00606377  0.00073208]
 [-0.00055553 -0.00621822  0.09762074 -0.00057514  0.00070386  0.00013239]
 [ 0.00592873 -0.0033397  -0.00057514  0.01538591 -0.01429815 -0.00122403]
 [-0.00291143  0.00606377  0.00070386 -0.01429815  0.07706281 -0.00520863]
 [-0.00054482  0.00073208  0.00013239 -0.00122403 -0.00520863  0.09781642]]
LogLike[0064]=-33946.084942
sigma_a=56.228175
R:
[[3.5859547  4.0736744 ]
 [4.0736744  6.43285716]]
m0:
[223.74000011  39.58310403   4.01344065 465.1880855  105.99122356
  10.44763745]
V0:
[[ 0.00777627 -0.01095333 -0.0005451   0.00587103 -0.00291047 -0.00054014]
 [-0.01095333  0.06868201 -0.0062286  -0.00335591  0.00612019  0.00073379]
 [-0.0005451  -0.0062286   0.0976192  -0.00057069  0.00070409  0.00013209]
 [ 0.00587103 -0.00335591 -0.00057069  0.01513814 -0.01414825 -0.00120045]
 [-0.00291047  0.00612019  0.00070409 -0.01414825  0.07692702 -0.00522409]
 [-0.00054014  0.00073379  0.00013209 -0.00120045 -0.00522409  0.09781379]]
LogLike[0065]=-33592.651489
sigma_a=58.861776
R:
[[3.38939444 3.77552734]
 [3.77552734 5.88898907]]
m0:
[224.35349871  39.28905038   3.95646893 466.48426606 105.38921667
  10.32737897]
V0:
[[ 0.00768116 -0.01086352 -0.00053491  0.00581009 -0.00290618 -0.00053505]
 [-0.01086352  0.06854326 -0.00623865 -0.00336884  0.00617387  0.0007351 ]
 [-0.00053491 -0.00623865  0.09761774 -0.00056578  0.0007039   0.00013172]
 [ 0.00581009 -0.00336884 -0.00056578  0.01488883 -0.01399488 -0.00117671]
 [-0.00290618  0.00617387  0.0007039  -0.01399488  0.07678851 -0.00523974]
 [-0.00053505  0.0007351   0.00013172 -0.00117671 -0.00523974  0.09781117]]
LogLike[0066]=-33230.866673
sigma_a=61.636032
R:
[[3.19723089 3.48806365]
 [3.48806365 5.37187263]]
m0:
[224.97402424  38.98588397   3.89832148 467.78912064 104.76410202
  10.20586501]
V0:
[[ 0.00758747 -0.01077502 -0.00052494  0.00574589 -0.00289849 -0.00052955]
 [-0.01077502  0.06840712 -0.0062484  -0.00337835  0.00622465  0.00073603]
 [-0.00052494 -0.0062484   0.09761632 -0.00056039  0.00070328  0.00013131]
 [ 0.00574589 -0.00337835 -0.00056039  0.01463799 -0.01383798 -0.00115283]
 [-0.00289849  0.00622465  0.00070328 -0.01383798  0.07664718 -0.00525557]
 [-0.00052955  0.00073603  0.00013131 -0.00115283 -0.00525557  0.09780857]]
LogLike[0067]=-32860.236772
sigma_a=64.559895
R:
[[3.00961798 3.21147405]
 [3.21147405 4.88142882]]
m0:
[225.60177468  38.67294951   3.83898923 469.10248615 104.1156089
  10.08317508]
V0:
[[ 0.00749504 -0.01068771 -0.00051515  0.00567842 -0.00288729 -0.00052367]
 [-0.01068771  0.06827352 -0.00625787 -0.0033843   0.00627235  0.00073654]
 [-0.00051515 -0.00625787  0.09761497 -0.00055453  0.00070222  0.00013084]
 [ 0.00567842 -0.0033843  -0.00055453  0.01438564 -0.01367754 -0.00112881]
 [-0.00288729  0.00627235  0.00070222 -0.01367754  0.0765029  -0.00527161]
 [-0.00052367  0.00073654  0.00013084 -0.00112881 -0.00527161  0.09780598]]
LogLike[0068]=-32480.277530
sigma_a=67.642802
R:
[[2.82671077 2.94594004]
 [2.94594004 4.41756274]]
m0:
[226.23690899  38.34956872   3.77846985 470.42409669 103.44351881
   9.95940039]
V0:
[[ 0.00740372 -0.01060151 -0.00050554  0.00560768 -0.00287252 -0.00051739]
 [-0.01060151  0.06814238 -0.00626708 -0.00338656  0.00631677  0.00073665]
 [-0.00050554 -0.00626708  0.09761365 -0.00054821  0.00070072  0.00013031]
 [ 0.00560768 -0.00338656 -0.00054821  0.01413182 -0.01351351 -0.00110468]
 [-0.00287252  0.00631677  0.00070072 -0.01351351  0.07635556 -0.00528784]
 [-0.00051739  0.00073665  0.00013031 -0.00110468 -0.00528784  0.0978034 ]]
LogLike[0069]=-32090.530209
sigma_a=70.894523
R:
[[2.64866551 2.69163666]
 [2.69163666 3.98016443]]
m0:
[226.87953777  38.01504479   3.71676913 471.75356339 102.74768423
   9.83464597]
V0:
[[ 0.00731339 -0.01051628 -0.00049609  0.00553367 -0.0028541  -0.00051074]
 [-0.01051628  0.06801364 -0.00627605 -0.00338499  0.00635773  0.00073633]
 [-0.00049609 -0.00627605  0.09761239 -0.00054143  0.00069877  0.00012974]
 [ 0.00553367 -0.00338499 -0.00054143  0.01387659 -0.0133459  -0.00108044]
 [-0.0028541   0.00635773  0.00069877 -0.0133459   0.07620509 -0.00530428]
 [-0.00051074  0.00073633  0.00012974 -0.00108044 -0.00530428  0.09780084]]
LogLike[0070]=-31690.574363
sigma_a=74.325142
R:
[[2.47564777 2.44874461]
 [2.44874461 3.5691219 ]]
m0:
[227.52971234  37.6686689    3.65390268 473.09035229 102.02805077
   9.70903287]
V0:
[[ 0.0072239  -0.01043193 -0.00048678  0.00545641 -0.00283193 -0.00050371]
 [-0.01043193  0.06788721 -0.0062848  -0.00337943  0.00639501  0.00073557]
 [-0.00048678 -0.0062848   0.09761116 -0.0005342   0.00069636  0.00012912]
 [ 0.00545641 -0.00337943 -0.0005342   0.01362006 -0.0131747  -0.00105611]
 [-0.00283193  0.00639501  0.00069636 -0.0131747   0.07605138 -0.00532092]
 [-0.00050371  0.00073557  0.00012912 -0.00105611 -0.00532092  0.0977983 ]]
LogLike[0071]=-31280.050009
sigma_a=77.945006
R:
[[2.30784184 2.21746239]
 [2.21746239 3.18433108]]
m0:
[228.18740951  37.30973044   3.58989802 474.43375529 101.28468563
   9.58270101]
V0:
[[ 0.00713514 -0.01034833 -0.00047759  0.00537593 -0.00280597 -0.00049633]
 [-0.01034833  0.067763   -0.00629336 -0.00336974  0.00642839  0.00073438]
 [-0.00047759 -0.00629336  0.09760997 -0.00052653  0.00069351  0.00012845]
 [ 0.00537593 -0.00336974 -0.00052653  0.01336235 -0.01299996 -0.00103172]
 [-0.00280597  0.00642839  0.00069351 -0.01299996  0.07589438 -0.00533775]
 [-0.00049633  0.00073438  0.00012845 -0.00103172 -0.00533775  0.09779577]]
LogLike[0072]=-30858.706142
sigma_a=81.764407
R:
[[2.14546191 1.99801832]
 [1.99801832 2.82570218]]
m0:
[228.85251131  36.93753254   3.52479722 475.78285318 100.51781396
   9.45581248]
V0:
[[ 0.00704701 -0.01026537 -0.00046851  0.0052923  -0.00277614 -0.0004886 ]
 [-0.01026537  0.06764092 -0.00630174 -0.00335579  0.00645767  0.00073274]
 [-0.00046851 -0.00630174  0.09760882 -0.00051843  0.00069019  0.00012773]
 [ 0.0052923  -0.00335579 -0.00051843  0.01310365 -0.01282173 -0.00100729]
 [-0.00277614  0.00645767  0.00069019 -0.01282173  0.07573404 -0.00535478]
 [-0.0004886   0.00073274  0.00012773 -0.00100729 -0.00535478  0.09779326]]
LogLike[0073]=-30426.464821
sigma_a=85.793222
R:
[[1.98876715 1.79068314]
 [1.79068314 2.49316362]]
m0:
[229.5247794   36.55141459   3.4586601  477.13647225  99.72786419
   9.32855539]
V0:
[[ 0.0069594  -0.01018293 -0.00045953  0.00520558 -0.00274241 -0.00048054]
 [-0.01018293  0.06752085 -0.00630996 -0.00333745  0.0064826   0.00073064]
 [-0.00045953 -0.00630996  0.09760769 -0.00050992  0.00068642  0.00012697]
 [ 0.00520558 -0.00333745 -0.00050992  0.01284417 -0.01264012 -0.00098287]
 [-0.00274241  0.0064826   0.00068642 -0.01264012  0.07557036 -0.00537198]
 [-0.00048054  0.00073064  0.00012697 -0.00098287 -0.00537198  0.09779077]]
LogLike[0074]=-29983.502208
sigma_a=90.040493
R:
[[1.83807324 1.59577388]
 [1.59577388 2.18665111]]
m0:
[230.20382272  36.15078436   3.391568   478.493132    98.91552505
   9.20114808]
V0:
[[ 0.00687224 -0.01010089 -0.00045063  0.00511589 -0.00270476 -0.00047218]
 [-0.01010089  0.06740268 -0.00631806 -0.00331461  0.00650297  0.0007281 ]
 [-0.00045063 -0.00631806  0.0976066  -0.00050103  0.00068221  0.00012617]
 [ 0.00511589 -0.00331461 -0.00050103  0.01258421 -0.01245529 -0.00095847]
 [-0.00270476  0.00650297  0.00068221 -0.01245529  0.07540337 -0.00538934]
 [-0.00047218  0.0007281   0.00012617 -0.00095847 -0.00538934  0.09778831]]
LogLike[0075]=-29530.364110
sigma_a=94.513604
R:
[[1.69375513 1.41364325]
 [1.41364325 1.90607593]]
m0:
[230.88905781  35.73516185   3.32362811 479.85098448  98.08181556
   9.07384375]
V0:
[[ 0.00678547 -0.01001914 -0.00044182  0.00502338 -0.00266319 -0.00046353]
 [-0.01001914  0.06728628 -0.00632603 -0.00328718  0.00651859  0.0007251 ]
 [-0.00044182 -0.00632603  0.09760552 -0.00049177  0.00067755  0.00012533]
 [ 0.00502338 -0.00328718 -0.00049177  0.01232412 -0.01226746 -0.00093416]
 [-0.00266319  0.00651859  0.00067755 -0.01226746  0.07523317 -0.00540684]
 [-0.00046353  0.0007251   0.00012533 -0.00093416 -0.00540684  0.09778587]]
LogLike[0076]=-29068.094619
sigma_a=99.217284
R:
[[1.55624068 1.24465476]
 [1.24465476 1.65127665]]
m0:
[231.57966545  35.30423505   3.2549779  481.20775335  97.22816444
   8.94693455]
V0:
[[ 0.00669906 -0.00993758 -0.00043308  0.00492824 -0.00261777 -0.00045463]
 [-0.00993758  0.06717152 -0.00633391 -0.00325511  0.00652926  0.00072166]
 [-0.00043308 -0.00633391  0.09760448 -0.00048219  0.00067247  0.00012447]
 [ 0.00492824 -0.00325511 -0.00048219  0.01206435 -0.01207691 -0.00090997]
 [-0.00261777  0.00652926  0.00067247 -0.01207691  0.0750599  -0.00542444]
 [-0.00045463  0.00072166  0.00012447 -0.00090997 -0.00542444  0.09778347]]
LogLike[0077]=-28598.363905
sigma_a=104.152466
R:
[[1.42598923 1.08913999]
 [1.08913999 1.42195365]]
m0:
[232.2745469   34.85792686   3.18578905 482.56067926  96.35649433
   8.82075428]
V0:
[[ 0.006613   -0.00985613 -0.00042441  0.00483073 -0.00256859 -0.00044551]
 [-0.00985613  0.06705826 -0.00634171 -0.00321841  0.00653483  0.00071777]
 [-0.00042441 -0.00634171  0.09760345 -0.00047232  0.000667    0.00012357]
 [ 0.00483073 -0.00321841 -0.00047232  0.01180542 -0.01188405 -0.00088598]
 [-0.00256859  0.00653483  0.000667   -0.01188405  0.07488383 -0.00544211]
 [-0.00044551  0.00071777  0.00012357 -0.00088598 -0.00544211  0.0977811 ]]
LogLike[0078]=-28123.586254
sigma_a=109.314756
R:
[[1.30345561 0.94734222]
 [0.94734222 1.21759611]]
m0:
[232.97228631  34.39646889   3.11627003 483.9064832   95.4693011
   8.69567864]
V0:
[[ 0.00652734 -0.00977473 -0.00041583  0.00473116 -0.00251582 -0.00043622]
 [-0.00977473  0.06694636 -0.00634943 -0.00317713  0.00653524  0.00071348]
 [-0.00041583 -0.00634943  0.09760245 -0.00046221  0.00066115  0.00012265]
 [ 0.00473116 -0.00317713 -0.00046221  0.01154797 -0.01168935 -0.00086224]
 [-0.00251582  0.00653524  0.00066115 -0.01168935  0.0747053  -0.00545981]
 [-0.00043622  0.00071348  0.00012265 -0.00086224 -0.00545981  0.09777878]]
LogLike[0079]=-27646.983378
sigma_a=114.692996
R:
[[1.18904696 0.8193585 ]
 [0.8193585  1.03741985]]
m0:
[233.67112924  33.92047353   3.04666625 485.24136537  94.56971121
   8.57212155]
V0:
[[ 0.00644215 -0.00969335 -0.00040733  0.00462991 -0.0024597  -0.00042679]
 [-0.00969335  0.06683571 -0.00635709 -0.00313142  0.00653044  0.00070878]
 [-0.00040733 -0.00635709  0.09760148 -0.00045192  0.00065497  0.00012172]
 [ 0.00462991 -0.00313142 -0.00045192  0.01129274 -0.01149344 -0.00083884]
 [-0.0024597   0.00653044  0.00065497 -0.01149344  0.07452478 -0.00547747]
 [-0.00042679  0.00070878  0.00012172 -0.00083884 -0.00547747  0.09777651]]
LogLike[0080]=-27172.578420
sigma_a=120.267773
R:
[[1.08307849 0.70508975]
 [0.70508975 0.88032802]]
m0:
[234.36898524  33.43099385   2.97725686 486.56105087  93.66150079
   8.4505266 ]
V0:
[[ 0.00635753 -0.009612   -0.00039894  0.00452745 -0.00240055 -0.00041728]
 [-0.009612    0.06672621 -0.00636469 -0.00308151  0.00652054  0.00070373]
 [-0.00039894 -0.00636469  0.09760052 -0.0004415   0.0006485   0.00012077]
 [ 0.00452745 -0.00308151 -0.0004415   0.01104054 -0.01129703 -0.00081584]
 [-0.00240055  0.00652054  0.0006485  -0.01129703  0.07434287 -0.00549503]
 [-0.00041728  0.00070373  0.00012077 -0.00081584 -0.00549503  0.0977743 ]]
LogLike[0081]=-26705.090330
sigma_a=126.010207
R:
[[0.98573851 0.60421082]
 [0.60421082 0.74490718]]
m0:
[235.06346251  32.92955837   2.90834756 487.86089389  92.74905731
   8.33135327]
V0:
[[ 0.00627365 -0.00953074 -0.00039066  0.00442427 -0.00233877 -0.00040775]
 [-0.00953074  0.06661778 -0.00637222 -0.00302773  0.00650569  0.00069836]
 [-0.00039066 -0.00637222  0.09759959 -0.00043103  0.00064179  0.00011983]
 [ 0.00442427 -0.00302773 -0.00043103  0.01079226 -0.01110096 -0.00079335]
 [-0.00233877  0.00650569  0.00064179 -0.01110096  0.07416028 -0.00551242]
 [-0.00040775  0.00069836  0.00011983 -0.00079335 -0.00551242  0.09777216]]
LogLike[0082]=-26249.717125
sigma_a=131.881150
R:
[[0.89706754 0.51616444]
 [0.51616444 0.62945976]]
m0:
[235.75193796  32.41816913   2.84025946 489.13604246  91.83727123
   8.21505838]
V0:
[[ 0.00619068 -0.00944964 -0.00038252  0.00432093 -0.00227484 -0.00039825]
 [-0.00944964  0.06651037 -0.00637969 -0.0029705   0.0064862   0.00069271]
 [-0.00038252 -0.00637969  0.09759869 -0.00042057  0.00063491  0.00011889]
 [ 0.00432093 -0.0029705  -0.00042057  0.01054882 -0.01090614 -0.00077142]
 [-0.00227484  0.0064862   0.00063491 -0.01090614  0.07397785 -0.00552956]
 [-0.00039825  0.00069271  0.00011889 -0.00077142 -0.00552956  0.09777008]]
LogLike[0083]=-25811.804138
sigma_a=137.831213
R:
[[0.81695227 0.44017829]
 [0.44017829 0.53206745]]
m0:
[236.43166184  31.89925444   2.77331466 490.38165716  90.9313532
   8.10207415]
V0:
[[ 0.00610883 -0.00936886 -0.00037455  0.00421802 -0.0022093  -0.00038883]
 [-0.00936886  0.06640399 -0.00638707 -0.00291033  0.00646246  0.00068685]
 [-0.00037455 -0.00638707  0.09759781 -0.00041019  0.00062792  0.00011795]
 [ 0.00421802 -0.00291033 -0.00041019  0.01031114 -0.01071355 -0.00075016]
 [-0.0022093   0.00646246  0.00062792 -0.01071355  0.07379647 -0.00554637]
 [-0.00038883  0.00068685  0.00011795 -0.00075016 -0.00554637  0.09776808]]
LogLike[0084]=-25396.427680
sigma_a=143.801721
R:
[[0.74513142 0.37530021]
 [0.37530021 0.45067523]]
m0:
[237.09988962  31.37557371   2.70781978 491.59316622  90.03658649
   7.99278514]
V0:
[[ 0.00602833 -0.00928856 -0.00036675  0.00411612 -0.00214273 -0.00037956]
 [-0.00928856  0.06629868 -0.00639435 -0.00284781  0.00643498  0.00068082]
 [-0.00036675 -0.00639435  0.09759696 -0.00039996  0.00062089  0.00011704]
 [ 0.00411612 -0.00284781 -0.00039996  0.01008008 -0.01052414 -0.00072961]
 [-0.00214273  0.00643498  0.00062089 -0.01052414  0.0736171  -0.00556278]
 [-0.00037956  0.00068082  0.00011704 -0.00072961 -0.00556278  0.09776616]]
LogLike[0085]=-25007.948400
sigma_a=149.726863
R:
[[0.68121082 0.32044672]
 [0.32044672 0.38318515]]
m0:
[237.75402986  30.85007846   2.64404946 492.76653094  89.15803803
   7.88750679]
V0:
[[ 0.00594938 -0.00920894 -0.00035916  0.00401579 -0.00207572 -0.00037048]
 [-0.00920894  0.06619451 -0.00640152 -0.00278354  0.00640434  0.00067469]
 [-0.00035916 -0.00640152  0.09759614 -0.00038994  0.00061387  0.00011615]
 [ 0.00401579 -0.00278354 -0.00038994  0.0098564  -0.01033883 -0.00070984]
 [-0.00207572  0.00640434  0.00061387 -0.01033883  0.07344064 -0.00557872]
 [-0.00037048  0.00067469  0.00011615 -0.00070984 -0.00557872  0.09776433]]
LogLike[0086]=-24649.616234
sigma_a=155.537059
R:
[[0.62468581 0.27445944]
 [0.27445944 0.32754846]]
m0:
[238.39179069  30.32574361   2.58223168 493.89848695  88.30026576
   7.78646833]
V0:
[[ 0.0058722  -0.00913021 -0.00035179  0.00391754 -0.00200885 -0.00036164]
 [-0.00913021  0.06609159 -0.00640855 -0.00271817  0.00637115  0.00066852]
 [-0.00035179 -0.00640855  0.09759536 -0.00038018  0.00060692  0.00011529]
 [ 0.00391754 -0.00271817 -0.00038018  0.00964071 -0.01015843 -0.00069089]
 [-0.00200885  0.00637115  0.00060692 -0.01015843  0.07326795 -0.00559413]
 [-0.00036164  0.00066852  0.00011529 -0.00069089 -0.00559413  0.09776258]]
LogLike[0087]=-191385.912354
sigma_a=161.163137
R:
[[0.57496949 0.23616374]
 [0.23616374 0.28184554]]
m0:
[239.01130467  29.80539128   2.52253721 494.98672426  87.46706754
   7.68980274]
V0:
[[ 0.00579694 -0.00905256 -0.00034465  0.00382179 -0.00194264 -0.00035306]
 [-0.00905256  0.06599005 -0.00641544 -0.0026523   0.00633606  0.00066234]
 [-0.00034465 -0.00641544  0.0975946  -0.00037073  0.0006001   0.00011445]
 [ 0.00382179 -0.0026523  -0.00037073  0.00943343 -0.0099836  -0.00067277]
 [-0.00194264  0.00633606  0.0006001  -0.0099836   0.07309973 -0.00560897]
 [-0.00035306  0.00066234  0.00011445 -0.00067277 -0.00560897  0.09776092]]
EM: log likelihood decreased

Plot convergence

fig = go.Figure()
trace = go.Scatter(x=optim_res_ga["elapsed_time"], y=optim_res_ga["log_like"],
                  name="Gradient ascent", mode="lines+markers")
fig.add_trace(trace)
trace = go.Scatter(x=optim_res_em["elapsed_time"], y=optim_res_em["log_like"],
                   name="EM", mode="lines+markers")
fig.add_trace(trace)
fig.update_layout(xaxis_title="Elapsed Time (sec)",
                  yaxis_title="Log Likelihood")
fig


Perform smoothing with optimized parameters

Gradient ascent

Perform batch filtering

View source code of lds.inference.filterLDS_SS_withMissingValues_np

Q_ga = optim_res_ga["estimates"]["sigma_a"].item()**2*Qe
m0_ga = optim_res_ga["estimates"]["m0"].numpy()
V0_ga = np.diag(optim_res_ga["estimates"]["sqrt_diag_V0"].numpy()**2)
R_ga = np.diag(optim_res_ga["estimates"]["sqrt_diag_R"].numpy()**2)

filterRes_ga = lds.inference.filterLDS_SS_withMissingValues_np(
    y=y, B=B, Q=Q_ga, m0=m0_ga, V0=V0_ga, Z=Z, R=R_ga)

Perform batch smoothing

View source code of lds.inference.smoothLDS_SS

smoothRes_ga = lds.inference.smoothLDS_SS(
    B=B, xnn=filterRes_ga["xnn"], Vnn=filterRes_ga["Vnn"],
    xnn1=filterRes_ga["xnn1"], Vnn1=filterRes_ga["Vnn1"], m0=m0_ga, V0=V0_ga)

EM

Perform batch filtering

View source code of lds.inference.filterLDS_SS_withMissingValues_np

Q_em = optim_res_em["estimates"]["sigma_a"].item()**2*Qe
m0_em = optim_res_em["estimates"]["m0"]
V0_em = optim_res_em["estimates"]["V0"]
R_em = optim_res_em["estimates"]["R"]

filterRes_em = lds.inference.filterLDS_SS_withMissingValues_np(
    y=y, B=B, Q=Q_em, m0=m0_em, V0=V0_em, Z=Z, R=R_em)

Perform batch smoothing

View source code of lds.inference.smoothLDS_SS

smoothRes_em = lds.inference.smoothLDS_SS(
    B=B, xnn=filterRes_em["xnn"], Vnn=filterRes_em["Vnn"],
    xnn1=filterRes_em["xnn1"], Vnn1=filterRes_em["Vnn1"], m0=m0_em, V0=V0_em)

Plot smoothing results

def get_fig_kinematics_vs_time(
    time,
    measured_x, measured_y,
    finite_diff_x, finite_diff_y,
    ga_mean_x, ga_mean_y,
    ga_ci_x_upper, ga_ci_y_upper,
    ga_ci_x_lower, ga_ci_y_lower,
    em_mean_x, em_mean_y,
    em_ci_x_upper, em_ci_y_upper,
    em_ci_x_lower, em_ci_y_lower,
    cb_alpha,
    color_true,
    color_measured,
    color_finite_diff,
    color_ga_pattern,
    color_em_pattern,
    xlabel, ylabel):

    fig = go.Figure()
    if measured_x is not None:
        trace_mes_x = go.Scatter(
            x=time, y=measured_x,
            mode="markers",
            marker={"color": color_measured},
            name="measured x",
            showlegend=True,
        )
        fig.add_trace(trace_mes_x)
    if measured_y is not None:
        trace_mes_y = go.Scatter(
            x=time, y=measured_y,
            mode="markers",
            marker={"color": color_measured},
            name="measured y",
            showlegend=True,
        )
        fig.add_trace(trace_mes_y)
    if finite_diff_x is not None:
        trace_fd_x = go.Scatter(
            x=time, y=finite_diff_x,
            mode="markers",
            marker={"color": color_finite_diff},
            name="finite difference x",
            showlegend=True,
        )
        fig.add_trace(trace_fd_x)
    if finite_diff_y is not None:
        trace_fd_y = go.Scatter(
            x=time, y=finite_diff_y,
            mode="markers",
            marker={"color": color_finite_diff},
            name="finite difference y",
            showlegend=True,
        )
        fig.add_trace(trace_fd_y)
    trace_ga_x = go.Scatter(
        x=time, y=ga_mean_x,
        mode="markers",
        marker={"color": color_ga_pattern.format(1.0)},
        name="grad. ascent x",
        showlegend=True,
        legendgroup="ga_x",
    )
    fig.add_trace(trace_ga_x)
    trace_ga_x_cb = go.Scatter(
        x=np.concatenate([time, time[::-1]]),
        y=np.concatenate([ga_ci_x_upper, ga_ci_x_lower[::-1]]),
        fill="toself",
        fillcolor=color_ga_pattern.format(cb_alpha),
        line=dict(color=color_ga_pattern.format(0.0)),
        showlegend=False,
        legendgroup="ga_x",
    )
    fig.add_trace(trace_ga_x_cb)
    trace_ga_y = go.Scatter(
        x=time, y=ga_mean_y,
        mode="markers",
        marker={"color": color_ga_pattern.format(1.0)},
        name="grad. ascent y",
        showlegend=True,
        legendgroup="ga_y",
    )
    fig.add_trace(trace_ga_y)
    trace_ga_y_cb = go.Scatter(
        x=np.concatenate([time, time[::-1]]),
        y=np.concatenate([ga_ci_y_upper, ga_ci_y_lower[::-1]]),
        fill="toself",
        fillcolor=color_ga_pattern.format(cb_alpha),
        line=dict(color=color_ga_pattern.format(0.0)),
        showlegend=False,
        legendgroup="ga_y",
    )
    fig.add_trace(trace_ga_y_cb)
    trace_em_x = go.Scatter(
        x=time, y=em_mean_x,
        mode="markers",
        marker={"color": color_em_pattern.format(1.0)},
        name="EM x",
        showlegend=True,
        legendgroup="em_x",
    )
    fig.add_trace(trace_em_x)
    trace_em_x_cb = go.Scatter(
        x=np.concatenate([time, time[::-1]]),
        y=np.concatenate([em_ci_x_upper, em_ci_x_lower[::-1]]),
        fill="toself",
        fillcolor=color_em_pattern.format(cb_alpha),
        line=dict(color=color_em_pattern.format(0.0)),
        showlegend=False,
        legendgroup="em_x",
    )
    fig.add_trace(trace_em_x_cb)
    trace_em_y = go.Scatter(
        x=time, y=em_mean_y,
        mode="markers",
        marker={"color": color_em_pattern.format(1.0)},
        name="EM y",
        showlegend=True,
        legendgroup="em_y",
    )
    fig.add_trace(trace_em_y)
    trace_em_y_cb = go.Scatter(
        x=np.concatenate([time, time[::-1]]),
        y=np.concatenate([em_ci_y_upper, em_ci_y_lower[::-1]]),
        fill="toself",
        fillcolor=color_em_pattern.format(cb_alpha),
        line=dict(color=color_em_pattern.format(0.0)),
        showlegend=False,
        legendgroup="em_y",
    )
    fig.add_trace(trace_em_y_cb)

    fig.update_layout(xaxis_title=xlabel,
                      yaxis_title=ylabel,
                      paper_bgcolor='rgba(0,0,0,0)',
                      plot_bgcolor='rgba(0,0,0,0)',
                     )
    return fig
N = y.shape[1]
time = np.arange(0, N*dt, dt)
smoothed_means_ga = smoothRes_ga["xnN"]
smoothed_covs_ga = smoothRes_ga["VnN"]
smoothed_std_x_y_ga = np.sqrt(np.diagonal(a=smoothed_covs_ga, axis1=0, axis2=1))
smoothed_means_em = smoothRes_em["xnN"]
smoothed_covs_em = smoothRes_em["VnN"]
smoothed_std_x_y_em = np.sqrt(np.diagonal(a=smoothed_covs_em, axis1=0, axis2=1))
color_true = "blue"
color_measured = "black"
color_finite_diff = "blue"
color_ga_pattern = "rgba(255,0,0,{:f})"
color_em_pattern = "rgba(255,165,0,{:f})"
cb_alpha = 0.3

Gradient ascent

Plot true, measured and smoothed positions (with 95% confidence band)

measured_x = y[0, :]
measured_y = y[1, :]
finite_diff_x = None
finite_diff_y = None
smoothed_mean_x_ga = smoothed_means_ga[0, 0, :]
smoothed_mean_y_ga = smoothed_means_ga[3, 0, :]
smoothed_mean_x_em = smoothed_means_em[0, 0, :]
smoothed_mean_y_em = smoothed_means_em[3, 0, :]

smoothed_ci_x_upper_ga = smoothed_mean_x_ga + 1.96*smoothed_std_x_y_ga[:, 0]
smoothed_ci_x_lower_ga = smoothed_mean_x_ga - 1.96*smoothed_std_x_y_ga[:, 0]
smoothed_ci_y_upper_ga = smoothed_mean_y_ga + 1.96*smoothed_std_x_y_ga[:, 3]
smoothed_ci_y_lower_ga = smoothed_mean_y_ga - 1.96*smoothed_std_x_y_ga[:, 3]
smoothed_ci_x_upper_em = smoothed_mean_x_em + 1.96*smoothed_std_x_y_em[:, 0]
smoothed_ci_x_lower_em = smoothed_mean_x_em - 1.96*smoothed_std_x_y_em[:, 0]
smoothed_ci_y_upper_em = smoothed_mean_y_em + 1.96*smoothed_std_x_y_em[:, 3]
smoothed_ci_y_lower_em = smoothed_mean_y_em - 1.96*smoothed_std_x_y_em[:, 3]

fig = get_fig_kinematics_vs_time(
    time=time,
    measured_x=measured_x, measured_y=measured_y,
    finite_diff_x=finite_diff_x, finite_diff_y=finite_diff_y,
    ga_mean_x=smoothed_mean_x_ga, ga_mean_y=smoothed_mean_y_ga,
    ga_ci_x_upper=smoothed_ci_x_upper_ga,
    ga_ci_y_upper=smoothed_ci_y_upper_ga,
    ga_ci_x_lower=smoothed_ci_x_lower_ga,
    ga_ci_y_lower=smoothed_ci_y_lower_ga,
    em_mean_x=smoothed_mean_x_em, em_mean_y=smoothed_mean_y_em,
    em_ci_x_upper=smoothed_ci_x_upper_em,
    em_ci_y_upper=smoothed_ci_y_upper_em,
    em_ci_x_lower=smoothed_ci_x_lower_em,
    em_ci_y_lower=smoothed_ci_y_lower_em,
    cb_alpha=cb_alpha,
    color_true=color_true, color_measured=color_measured,
    color_finite_diff=color_finite_diff,
    color_ga_pattern=color_ga_pattern,
    color_em_pattern=color_em_pattern,
    xlabel="Time (sec)", ylabel="Position (pixels)")
# fig_filename_pattern = "../../figures/smoothed_pos.{:s}"
# fig.write_image(fig_filename_pattern.format("png"))
# fig.write_html(fig_filename_pattern.format("html"))
fig


Plot true and smoothed velocities (with 95% confidence band)

measured_x = None
measured_y = None
finite_diff_x = np.diff(y[0, :])/dt
finite_diff_y = np.diff(y[1, :])/dt
smoothed_mean_x_ga = smoothed_means_ga[1, 0, :]
smoothed_mean_y_ga = smoothed_means_ga[4, 0, :]
smoothed_mean_x_em = smoothed_means_em[1, 0, :]
smoothed_mean_y_em = smoothed_means_em[4, 0, :]

smoothed_ci_x_upper_ga = smoothed_mean_x_ga + 1.96*smoothed_std_x_y_ga[:, 1]
smoothed_ci_x_lower_ga = smoothed_mean_x_ga - 1.96*smoothed_std_x_y_ga[:, 1]
smoothed_ci_y_upper_ga= smoothed_mean_y_ga + 1.96*smoothed_std_x_y_ga[:, 4]
smoothed_ci_y_lower_ga = smoothed_mean_y_ga - 1.96*smoothed_std_x_y_ga[:, 4]
smoothed_ci_x_upper_em = smoothed_mean_x_em + 1.96*smoothed_std_x_y_em[:, 1]
smoothed_ci_x_lower_em = smoothed_mean_x_em - 1.96*smoothed_std_x_y_em[:, 1]
smoothed_ci_y_upper_em= smoothed_mean_y_em + 1.96*smoothed_std_x_y_em[:, 4]
smoothed_ci_y_lower_em = smoothed_mean_y_em - 1.96*smoothed_std_x_y_em[:, 4]

fig = get_fig_kinematics_vs_time(
    time=time,
    measured_x=measured_x, measured_y=measured_y,
    finite_diff_x=finite_diff_x, finite_diff_y=finite_diff_y,
    ga_mean_x=smoothed_mean_x_ga, ga_mean_y=smoothed_mean_y_ga,
    ga_ci_x_upper=smoothed_ci_x_upper_ga,
    ga_ci_y_upper=smoothed_ci_y_upper_ga,
    ga_ci_x_lower=smoothed_ci_x_lower_ga,
    ga_ci_y_lower=smoothed_ci_y_lower_ga,
    em_mean_x=smoothed_mean_x_em, em_mean_y=smoothed_mean_y_em,
    em_ci_x_upper=smoothed_ci_x_upper_em,
    em_ci_y_upper=smoothed_ci_y_upper_em,
    em_ci_x_lower=smoothed_ci_x_lower_em,
    em_ci_y_lower=smoothed_ci_y_lower_em,
    cb_alpha=cb_alpha,
    color_true=color_true, color_measured=color_measured,
    color_finite_diff=color_finite_diff,
    color_ga_pattern=color_ga_pattern,
    color_em_pattern=color_em_pattern,
    xlabel="Time (sec)", ylabel="Velocity (pixels/sec)")
# fig_filename_pattern = "../../figures/smoothed_vel.{:s}"
# fig.write_image(fig_filename_pattern.format("png"))
# fig.write_html(fig_filename_pattern.format("html"))
fig


Plot true and smoothed accelerations (with 95% confidence band)

measured_x = None
measured_y = None
finite_diff_x = np.diff(np.diff(y[0, :]))/dt**2
finite_diff_y = np.diff(np.diff(y[1, :]))/dt**2
smoothed_mean_x_ga = smoothed_means_ga[2, 0, :]
smoothed_mean_y_ga = smoothed_means_ga[5, 0, :]
smoothed_mean_x_em = smoothed_means_em[2, 0, :]
smoothed_mean_y_em = smoothed_means_em[5, 0, :]

smoothed_ci_x_upper_ga = smoothed_mean_x_ga + 1.96*smoothed_std_x_y_ga[:, 2]
smoothed_ci_x_lower_ga = smoothed_mean_x_ga - 1.96*smoothed_std_x_y_ga[:, 2]
smoothed_ci_y_upper_ga = smoothed_mean_y_ga + 1.96*smoothed_std_x_y_ga[:, 5]
smoothed_ci_y_lower_ga = smoothed_mean_y_ga - 1.96*smoothed_std_x_y_ga[:, 5]
smoothed_ci_x_upper_em = smoothed_mean_x_em + 1.96*smoothed_std_x_y_em[:, 2]
smoothed_ci_x_lower_em = smoothed_mean_x_em - 1.96*smoothed_std_x_y_em[:, 2]
smoothed_ci_y_upper_em = smoothed_mean_y_em + 1.96*smoothed_std_x_y_em[:, 5]
smoothed_ci_y_lower_em = smoothed_mean_y_em - 1.96*smoothed_std_x_y_em[:, 5]

fig = get_fig_kinematics_vs_time(
    time=time,
    measured_x=measured_x, measured_y=measured_y,
    finite_diff_x=finite_diff_x, finite_diff_y=finite_diff_y,
    ga_mean_x=smoothed_mean_x_ga, ga_mean_y=smoothed_mean_y_ga,
    ga_ci_x_upper=smoothed_ci_x_upper_ga,
    ga_ci_y_upper=smoothed_ci_y_upper_ga,
    ga_ci_x_lower=smoothed_ci_x_lower_ga,
    ga_ci_y_lower=smoothed_ci_y_lower_ga,
    em_mean_x=smoothed_mean_x_em, em_mean_y=smoothed_mean_y_em,
    em_ci_x_upper=smoothed_ci_x_upper_em,
    em_ci_y_upper=smoothed_ci_y_upper_em,
    em_ci_x_lower=smoothed_ci_x_lower_em,
    em_ci_y_lower=smoothed_ci_y_lower_em,
    cb_alpha=cb_alpha,
    color_true=color_true, color_measured=color_measured,
    color_finite_diff=color_finite_diff,
    color_ga_pattern=color_ga_pattern,
    color_em_pattern=color_em_pattern,
    xlabel="Time (sec)", ylabel="Acceleration (pixels/sec^2)")
# fig_filename_pattern = "../../figures/smoothed_acc.{:s}"
# fig.write_image(fig_filename_pattern.format("png"))
# fig.write_html(fig_filename_pattern.format("html"))
fig


Total running time of the script: (8 minutes 2.825 seconds)

Gallery generated by Sphinx-Gallery