Unverified Commit b1e86cd3 authored by Gigg, Martyn Anthony's avatar Gigg, Martyn Anthony Committed by GitHub
Browse files

Merge pull request #32354 from...

Merge pull request #32354 from mantidproject/32353_catch_error_when_invalid_bgsub_params_in_EngDiffUI_fitting_tab

Catch exception when invalid bgsub params passed in EngDiff UI fitting tab
parents 5a759416 365c3fba
......@@ -90,6 +90,8 @@ Bugfixes
- The help button on the :ref:`Engineering Diffraction interface<Engineering_Diffraction-ref>` points to the correct page, having been broken in the last release.
- Using the Clear button on the Workspace widget while using the :ref:`Fitting tab <ui engineering fitting>` no longer causes errors when you try to load runs back in.
- On the :ref:`Fitting tab <ui engineering fitting>` of the :ref:`Engineering Diffraction interface<Engineering_Diffraction-ref>` the background can be inspected whether the background subtraction box is checked or not.
- Prevent crash when invalid arguments passed to background subtraction algorithm (:ref:`EnggEstimateFocussedBackground <algm-EnggEstimateFocussedBackground>`) in the :ref:`Fitting tab <ui engineering fitting>` of the :ref:`Engineering Diffraction interface<Engineering_Diffraction-ref>`.
Single Crystal Diffraction
--------------------------
......
......@@ -6,7 +6,7 @@
# SPDX - License - Identifier: GPL - 3.0 +
from os import path
from mantid.simpleapi import Load, logger, EnggEstimateFocussedBackground, Minus, AverageLogData, \
from mantid.simpleapi import Load, logger, EnggEstimateFocussedBackground, Minus, AverageLogData, SetUncertainties, \
CreateEmptyTableWorkspace, GroupWorkspaces, DeleteWorkspace, DeleteTableRows, RenameWorkspace, CreateWorkspace
from Engineering.gui.engineering_diffraction.settings.settings_helper import get_setting
from Engineering.gui.engineering_diffraction.tabs.common import output_settings
......@@ -321,8 +321,14 @@ class FittingDataModel(object):
self._bg_params[ws_name][0] = status
def estimate_background(self, ws_name, niter, xwindow, doSGfilter):
ws_bg = EnggEstimateFocussedBackground(InputWorkspace=ws_name, OutputWorkspace=ws_name + "_bg",
NIterations=niter, XWindow=xwindow, ApplyFilterSG=doSGfilter)
try:
ws_bg = EnggEstimateFocussedBackground(InputWorkspace=ws_name, OutputWorkspace=ws_name + "_bg",
NIterations=niter, XWindow=xwindow, ApplyFilterSG=doSGfilter)
except (ValueError, RuntimeError) as e:
# ValueError when Niter not positive integer, RuntimeError when Window too small
logger.error("Error on arguments supplied to EnggEstimateFocusedBackground: " + str(e))
ws_bg = SetUncertainties(InputWorkspace=ws_name) # copy data and zero errors
ws_bg = Minus(LHSWorkspace=ws_bg, RHSWorkspace=ws_bg) # workspace of zeros with same num spectra
return ws_bg
def plot_background_figure(self, ws_name):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment