Skip to content
Snippets Groups Projects

Suppress warning about ndarray from ragged nested sequences

Merged Vauth, Dr. Annika requested to merge NumpyWarning into main

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??)

Edited by Vauth, Dr. Annika

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading