@@ -447,9 +447,9 @@ def simulate_workers(worker, T, ax, mu_0=None, Sigma_0=None,
447447 A, C, G, R = worker.A, worker.C, worker.G, worker.R
448448 xhat_0, Σ_0 = worker.xhat_0, worker.Σ_0
449449
450- if isinstance( mu_0, type( None)) :
450+ if mu_0 is None:
451451 mu_0 = xhat_0
452- if isinstance( Sigma_0, type( None)) :
452+ if Sigma_0 is None:
453453 Sigma_0 = worker.Σ_0
454454
455455 ss = LinearStateSpace(A, C, G, np.sqrt(R),
@@ -471,12 +471,12 @@ def simulate_workers(worker, T, ax, mu_0=None, Sigma_0=None,
471471 kalman.update(y[i])
472472 x_hat, Σ = kalman.x_hat, kalman.Sigma
473473 Σ_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()
476476
477- if diff == True :
477+ if diff :
478478 title = ('Difference between inferred and true work ethic over time'
479- if title == None else title)
479+ if title is None else title)
480480
481481 ax.plot(u_hat_t - u_0, alpha=.5)
482482 ax.axhline(y=0, color='grey', linestyle='dashed')
@@ -485,10 +485,10 @@ def simulate_workers(worker, T, ax, mu_0=None, Sigma_0=None,
485485 ax.set_title(title)
486486
487487 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
489489 else name)
490490 title = ('Inferred work ethic over time'
491- if title == None else title)
491+ if title is None else title)
492492
493493 u_hat_plot = ax.plot(u_hat_t, label=label_line)
494494 ax.axhline(y=u_0, color=u_hat_plot[0].get_color(),
0 commit comments