SFOpenBoson
SFOpenBoson copied to clipboard
VisibleDeprecationWarning from numpy
Note: this is somewhat of a preemptive issue, assuming that the edits from #6 go through
Running:
>>> prog = sf.Program(2)
>>> with prog.context as q:
... Fock(2) | q[1]
... BoseHubbardPropagation(H, 1.086, 20) | q
from the Bose Hubbard Demo in the documentation will emit the following warning with numpy
v1.21.4
auxillary.py:153: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.
I imagine (naively) that the fix involves inserting that dtype=object
argument to the two np.array()
calls on line 153:
ladders = np.array(list(np.array(group_list, dtype=object)[:, 1]), dtype=object)[:, :, 1]
Thanks for bringing this issue to our attention @johnzl-777! We will look into the PR that you've opened and get back to you soon.