python-qinfer icon indicating copy to clipboard operation
python-qinfer copied to clipboard

plot_rebit_posterior raises TypeError

Open mikedeltalima opened this issue 5 years ago • 1 comments

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 avatar Dec 05 '19 00:12 mikedeltalima

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

mikedeltalima avatar Dec 06 '19 16:12 mikedeltalima