ocelot-collab / ocelot

OCELOT is a multiphysics simulation toolkit designed for studying FEL and storage ring-based light sources.
GNU General Public License v3.0
84 stars 58 forks source link

ocelot.gui.accelerator.show_density is buggy #83

Closed cr-xu closed 2 years ago

cr-xu commented 3 years ago

This line causes matplotlib (>3.3) to throw an error:

https://github.com/ocelot-collab/ocelot/blob/0489eaf3fb232cc4167573c51f7bd28cc3110aba/ocelot/gui/accelerator.py#L927

ValueError: 'low' is not a valid value for origin; supported values are 'upper', 'lower'

Also the deepcopy doesn't seem to work properly

https://github.com/ocelot-collab/ocelot/blob/0489eaf3fb232cc4167573c51f7bd28cc3110aba/ocelot/gui/accelerator.py#L909

causes the following warning message

.../Ocelot/ocelot/ocelot/gui/accelerator.py:910: MatplotlibDeprecationWarning: You are modifying the state of a globally registered colormap. In future versions, you will not be able to modify a registered colormap in-place. To remove this warning, you can make a copy of the colormap first. cmap = copy.copy(mpl.cm.get_cmap("rainbow"))

 my_rainbow.set_under('w')
sergey-tomin commented 3 years ago

thanks for the bug report. Fixed. Now in dev branch, soon will be in master too.