@@ -447,9 +447,9 @@ def simulate_workers(worker, T, ax, mu_0=None, Sigma_0=None,
447
447
A, C, G, R = worker.A, worker.C, worker.G, worker.R
448
448
xhat_0, Σ_0 = worker.xhat_0, worker.Σ_0
449
449
450
- if isinstance( mu_0, type( None)) :
450
+ if mu_0 is None:
451
451
mu_0 = xhat_0
452
- if isinstance( Sigma_0, type( None)) :
452
+ if Sigma_0 is None:
453
453
Sigma_0 = worker.Σ_0
454
454
455
455
ss = LinearStateSpace(A, C, G, np.sqrt(R),
@@ -471,12 +471,12 @@ def simulate_workers(worker, T, ax, mu_0=None, Sigma_0=None,
471
471
kalman.update(y[i])
472
472
x_hat, Σ = kalman.x_hat, kalman.Sigma
473
473
Σ_t.append(Σ)
474
- [ y_hat_t[i]] = worker.G @ x_hat
475
- [ u_hat_t[i]] = x_hat[1]
474
+ y_hat_t[i] = ( worker.G @ x_hat).item()
475
+ u_hat_t[i] = x_hat[1].item()
476
476
477
- if diff == True :
477
+ if diff :
478
478
title = ('Difference between inferred and true work ethic over time'
479
- if title == None else title)
479
+ if title is None else title)
480
480
481
481
ax.plot(u_hat_t - u_0, alpha=.5)
482
482
ax.axhline(y=0, color='grey', linestyle='dashed')
@@ -485,10 +485,10 @@ def simulate_workers(worker, T, ax, mu_0=None, Sigma_0=None,
485
485
ax.set_title(title)
486
486
487
487
else:
488
- label_line = (r'$E[u_t|y^{t-1}]$' if name == None
488
+ label_line = (r'$E[u_t|y^{t-1}]$' if name is None
489
489
else name)
490
490
title = ('Inferred work ethic over time'
491
- if title == None else title)
491
+ if title is None else title)
492
492
493
493
u_hat_plot = ax.plot(u_hat_t, label=label_line)
494
494
ax.axhline(y=u_0, color=u_hat_plot[0].get_color(),
0 commit comments