Unverified Commit f9c6ff0c authored by Gagik Vardanyan's avatar Gagik Vardanyan Committed by GitHub
Browse files

Merge pull request #32440 from mantidproject/0_CheckIndexIsWithinRangeBeforeDeletion

Result table global parameters should have a non-zero error
parents 2fd049b5 8572f56c
......@@ -82,6 +82,7 @@ Bugfixes
- A bug has been fixed in the BinWidth for the :ref:`DynamicKobuToyabe <func-DynamicKuboToyabe>` Fitting Function which caused a crash and did not provide
any information about why the value was invalid. It will now revert to last viable BinWidth used and explain why.
- The autoscale option when ``All`` is selected will now show the largest and smallest y value for all of the plots.
- The global parameters in a results table will no longer be given a zero error arbitrarily if one with an error exists.
......@@ -71,6 +71,12 @@ def _create_unique_param_lookup(parameter_workspace, global_parameters):
for row in default_table:
name = row[NAME_COL]
exists, is_global = is_in(unique_params, name)
# If the parameter is global, and its error is zero, skip it so that the global with the error is found instead.
is_error_zero = row[ERRORS_COL] == 0.0
if is_global and is_error_zero:
if not exists:
parameter = Parameter(name, row[VALUE_COL], row[ERRORS_COL],
......@@ -289,7 +289,7 @@ class BasicFittingModel:
"""Clears the undo fit functions and other data for the currently selected index."""
current_dataset_index = self.fitting_context.current_dataset_index
for i, dataset_index in reversed(list(enumerate(self.fitting_context.dataset_indices_for_undo))):
if dataset_index == current_dataset_index:
if dataset_index == current_dataset_index and i < len(self.fitting_context.active_fit_history):
del self.fitting_context.active_fit_history[i]
del self.fitting_context.dataset_indices_for_undo[i]
del self.fitting_context.single_fit_functions_for_undo[i]
......@@ -227,6 +227,18 @@ class FittingContextTest(unittest.TestCase):
name in log_names, msg="{} not found in log list".format(name))
def test_that_the_non_zero_global_parameter_error_is_saved_in_the_fit_parameter(self):
globals = ['Height']
test_parameters = OrderedDict([('Height', (10., 0.0)),
('Height', (10., 0.4)),
('f0.A0', (1, 0.01)),
('f1.A0', (1, 0.01)),
('Cost function', (0.1, 0.))])
fit_params = create_test_fit_parameters(test_parameters, globals)
self.assertEqual(fit_params.value("Height"), 10.0)
self.assertEqual(fit_params.error("Height"), 0.4)
if __name__ == '__main__':
unittest.main(buffer=False, verbosity=2)
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