SasView/sasview

changing parameter values on a model throws a numpy error.

Closed this issue · 1 comments

Describe the bug
Sometime recently -- guessing during the hackathon or just before, a new bug seems to have been introduced. Not sure if it is already being addressed but documenting here before I forget just in case.

Sending data to a fitpage then manually changing values and plotting throws the following error but not 100% of the time. It does not seem to throw any errors if doing the same thing without data (i.e. a theory curve). Moreover it seems to still perform the calculation correctly.

20:20:49 - ERROR: Traceback (most recent call last):
File "sas\qtgui\MainWindow\GuiManager.py", line 1346, in showPlot
File "sas\qtgui\MainWindow\DataExplorer.py", line 1118, in displayData
File "sas\qtgui\MainWindow\DataExplorer.py", line 1316, in updatePlot
File "sas\qtgui\Plotting\Plotter.py", line 645, in replacePlot
File "sas\qtgui\Plotting\Plotter.py", line 288, in plot
File "numpy\core\fromnumeric.py", line 2953, in min
File "numpy\core\fromnumeric.py", line 88, in _wrapreduction
ValueError: zero-size array to reduction operation minimum which has no identity

To Reproduce
Steps to reproduce the behavior:

  1. Start the application
  2. Load apoferritin data from example_data/1D
  3. Send to fitting
  4. Choose sphere, core_shell_sphere
  5. Press Compute/Plot
  6. change sld_core to 6.4 (essentially a hollow sphere with D20 in the middle)
  7. Error thrown - but calculation proceeds
  8. change sld_solvent to 6.4 (D20 solvent)
  9. Error thrown .. twice - but calculation proceeds
  10. change scale to 0.001 (0.1% vol fraction)
  11. Error thrown - but calculation proceeds
    8.change scale to 0.00001 (0.001%)
  12. NO error ...

Expected behavior
no error thrown.

SasView version (please complete the following information):

  • Version: 6.0.0b2 (PR 2086 and 3084 .. both had main merged into them today and neither of these PR has changes that could remotely do this IMO)

Operating system (please complete the following information):

  • OS: e.g. Windows 10

np.min(a) for empty a will throw this error. This happens when evaluating the default X range for plotting and got introduced in #2967 merged 3 weeks ago.
Since this affects only plotting, adding a simple conditional for empty x will solve the issue.