QInfer / python-qinfer

Library for Bayesian inference via sequential Monte Carlo for quantum parameter estimation.
BSD 3-Clause "New" or "Revised" License
92 stars 31 forks source link

plot_rebit_posterior raises TypeError #153

Open mikedeltalima opened 4 years ago

mikedeltalima commented 4 years ago

In plot_rebit_posterior, the default setting is to call plot_cov_ellipse, which uses np.linalg.eigh to find eigenvectors of the covariance. This can return vecs with complex entries, which then fail on line 146 of plotting_tools.py:

theta = np.degrees(np.arctan2(*vecs[:,0][::-1]))

Should it just take the real part? as in:

theta = np.degrees(np.arctan2(*vecs.real[:,0][::-1]))
mikedeltalima commented 4 years ago

or, maybe theta = np.degrees(np.arctan2(*np.real_if_close(vecs)[:,0][::-1]))