Suppress warning about ndarray from ragged nested sequences
Changes to suppress the warning VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences
. (Happening for NumPy version 1.19 or higher).
This works for now, but maybe the ndarrays in question could be replaced by a list or something like that in the long run...
Second (maybe related?) change:
After suppressing the warning and running the code, plotting the charge spectrum in Example.py gives the error Cannot cast array data from dtype('O') to dtype('float64') according to the rule 'safe'
(at least on python 3.10, numpy 1.23.5, matplotlib 3.6.2).
To deal with this: make a bar plot of the output of numpy.histogram, rather than plotting a histogram of the ndarray (which should also call numpy.histogram in the background, but one gives the error and the other doesn't??)