Skip to content

Matplotlib Error when using the DREAM fit algorithm #3227

@jamescrake-merani

Description

@jamescrake-merani

Describe the bug
When trying to run a fit with the DREAM algorithm, I'm getting an error coming from Matplotlib. The fit still works but I'm guessing something is going to be wrong with one of the graphs.

11:56:43 - sas.qtgui.Perspectives.Fitting.FittingWidget - ERROR - Traceback (most recent call last):
  File "/home/jamescrake-merani/repos/sasview-repos/sasview/src/sas/qtgui/MainWindow/GuiManager.py", line 1172, in showFitResults
    self.results_panel.onPlotResults(output_data, optimizer=self.perspective().optimizer)
  File "/home/jamescrake-merani/repos/sasview-repos/sasview/src/sas/qtgui/Utilities/ResultPanel.py", line 76, in onPlotResults
    self.correlationView.update(result.uncertainty_state)
  File "/home/jamescrake-merani/repos/sasview-repos/sasview/.venv/lib/python3.12/site-packages/bumps/gui/uncertainty_view.py", line 60, in update
    self.plot()
  File "/home/jamescrake-merani/repos/sasview-repos/sasview/.venv/lib/python3.12/site-packages/bumps/gui/uncertainty_view.py", line 55, in plot
    dream_views.plot_corrmatrix(history.draw())
  File "/home/jamescrake-merani/repos/sasview-repos/sasview/.venv/lib/python3.12/site-packages/bumps/dream/views.py", line 89, in plot_corrmatrix
    c.plot()
  File "/home/jamescrake-merani/repos/sasview-repos/sasview/.venv/lib/python3.12/site-packages/bumps/dream/corrplot.py", line 65, in plot
    self.ax = _plot(fig, self.hists, self.labels, self.N)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jamescrake-merani/repos/sasview-repos/sasview/.venv/lib/python3.12/site-packages/bumps/dream/corrplot.py", line 99, in _plot
    mapper.set_array(np.zeros(0))
  File "/home/jamescrake-merani/repos/sasview-repos/sasview/.venv/lib/python3.12/site-packages/matplotlib/image.py", line 689, in set_array
    self.set_data(A)
  File "/home/jamescrake-merani/repos/sasview-repos/sasview/.venv/lib/python3.12/site-packages/matplotlib/image.py", line 1359, in set_data
    super().set_data(A)
  File "/home/jamescrake-merani/repos/sasview-repos/sasview/.venv/lib/python3.12/site-packages/matplotlib/image.py", line 675, in set_data
    self._A = self._normalize_image_array(A)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jamescrake-merani/repos/sasview-repos/sasview/.venv/lib/python3.12/site-packages/matplotlib/image.py", line 643, in _normalize_image_array
    raise TypeError(f"Invalid shape {A.shape} for image data")

To Reproduce
Steps to reproduce the behavior:

  1. Make sure you have the DREAM fitting algorithm selected in File -> Preferences -> Fit Optimizers
  2. Load in some data, and run a fit.
  3. You'll see the error once the fit has completed.

SasView version:

  • Version: 6.0.1 (on the release branch)

Operating system (please complete the following information):

  • OS: Linux (I can reproduce both within, and outside of the Flatpak)

Metadata

Metadata

Assignees

No one assigned

    Labels

    BlockerPrevents a different issue from being resolved

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions