Skip to content

Data Operation Widget throws on empty target #3767

@rozyczko

Description

@rozyczko

Describe the bug
Subtracting the same model leads to an ugly exception being thrown.

File "C:\projects\sas\sasview\src\sas\qtgui\Calculators\DataOperationUtilityPanel.py", line 430, in updatePlot
    plotter.plot(data=data, hide_error=True, marker='.')
  File "C:\projects\sas\sasview\src\sas\qtgui\Plotting\Plotter.py", line 305, in plot
    self.ax.set_xbound(x_range[0], x_range[1])
  File "C:\Users\piotrrozyczko\.conda\envs\sas\Lib\site-packages\matplotlib\axes\_base.py", line 3707, in set_xbound
    self.set_xlim(sorted((lower, upper),
  File "C:\Users\piotrrozyczko\.conda\envs\sas\Lib\site-packages\matplotlib\axes\_base.py", line 3828, in set_xlim
    return self.xaxis._set_lim(left, right, emit=emit, auto=auto)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\piotrrozyczko\.conda\envs\sas\Lib\site-packages\matplotlib\axis.py", line 1216, in _set_lim
    v0 = self.axes._validate_converted_limits(v0, self.convert_units)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\piotrrozyczko\.conda\envs\sas\Lib\site-packages\matplotlib\axes\_base.py", line 3749, in _validate_converted_limits
    raise ValueError("Axis limits cannot be NaN or Inf")
ValueError: Axis limits cannot be NaN or Inf

To Reproduce
Steps to reproduce the behavior:

  1. Open Data Operation widget
  2. Load a single dataset
  3. Load that dataset to both segments of the Data Operation widget
  4. Select subtraction
  5. Click Compute
  6. Observe exception

Expected behavior
A warning message in the log explorer

SasView version (please complete the following information):

  • Version: main

Operating system (please complete the following information):

  • OS: Win10

Installation method (please complete the following information):

  • Installed: develop

Metadata

Metadata

Assignees

No one assigned

    Labels

    DefectBug or undesirable behaviourGood First IssueIssues that are appropriate for newbies

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions