Skip to content

Commit 1854120

Browse files
authored
Merge pull request #37635 from mantidproject/37577-error-in-isis-sans-gui-when-scaling-merged-reduction-with-fit-while-plot-results-is-selected
- Temporarily hide plot results checkbox by default to prevent issues during ISIS SANS merge reduction
2 parents 78d0301 + b299c8c commit 1854120

File tree

6 files changed

+52
-0
lines changed

6 files changed

+52
-0
lines changed

docs/source/concepts/PropertiesFile.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,15 @@ Plotting Settings
382382
|``plots.images.ColorBarScale`` |Default colorbar scale for image plots |``Linear`` |
383383
+---------------------------------+------------------------------------------------------------------+---------------------+
384384

385+
ISIS SANS Interface GUI Settings
386+
*********************************
387+
388+
+---------------------------------+------------------------------------------------------------------+---------------------+
389+
|Property |Description |Example value |
390+
+=================================+==================================================================+=====================+
391+
|``sans.isis_sans.plotResults`` |Whether to show or hide plot results checkbox | ``On``, ``Off`` |
392+
+---------------------------------+------------------------------------------------------------------+---------------------+
393+
385394
Getting access to Mantid properties
386395
***********************************
387396

docs/source/interfaces/isis_sans/Runs Tab.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ Save Options
171171
:align: center
172172
:width: 500px
173173

174+
174175
+--------------------------+-----------------------------------------------------------------------------------------+
175176
| **Save Other** | Opens up the save a dialog box :ref:`Save Other <save-other>` which allows users |
176177
| | to manually save processed data |
@@ -190,4 +191,8 @@ Save Options
190191
| | for each run in the table, speeding up processing considerably. |
191192
+--------------------------+-----------------------------------------------------------------------------------------+
192193
| **Plot results** | If enabled, data is automatically plotted on a graph as it is processed. |
194+
| | The check box is hidden by default, and can be enabled by adding |
195+
| | `sans.isis_sans.plotResults=On` in your mantid.user.properties, see |
196+
| | :ref:`Properties File` for more information |
193197
+--------------------------+-----------------------------------------------------------------------------------------+
198+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- The plot results checkbox is now hidden by default to prevent issues when both scaling and plot results are enabled. You can enable it via your properties file if needed. This change will help us decide whether to keep it hidden or fix the underlying issue.

scripts/Interface/ui/sans_isis/sans_data_processor_gui.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,6 +1001,9 @@ def is_background_subtraction(self):
10011001
def set_background_subtraction_mode(self, mode):
10021002
self.background_subtraction_checkbox.setChecked(mode)
10031003

1004+
def set_plot_results_checkbox_visibility(self, visibility):
1005+
self.plot_results_checkbox.setVisible(visibility)
1006+
10041007
# $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
10051008
# $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
10061009
# START ACCESSORS

scripts/SANS/sans/gui_logic/presenter/run_tab_presenter.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,8 @@ def set_view(self, view):
340340

341341
self._view.setup_layout()
342342

343+
self.hide_or_show_plot_results_checkbox_based_on_user_properties()
344+
343345
self._view.set_out_file_directory(ConfigService.Instance().getString("defaultsave.directory"))
344346

345347
self._view.set_out_default_output_mode()
@@ -423,6 +425,19 @@ def on_user_file_load(self):
423425
traceback.print_exc()
424426
self._on_user_file_load_failure(other_error, "Unknown error in loading user file.", use_error_name=True)
425427

428+
def hide_or_show_plot_results_checkbox_based_on_user_properties(self):
429+
"""
430+
Hide the plot results checkbox if it has not been explicitly enabled in the user properties file.
431+
432+
When performing merged reduction, if both the scale option and the plot result option are selected,
433+
it causes an issue. The agreed temporary fix is to hide the plot result checkbox by default since
434+
the functionality is rarely used. Users can enable the visibility of the plot result checkbox
435+
from their properties file if needed. This experiment will help us determine whether to
436+
permanently hide the checkbox or fix the underlying issue.
437+
"""
438+
visibility = ConfigService.getString("sans.isis_sans.plotResults")
439+
self._view.set_plot_results_checkbox_visibility(visibility == "On")
440+
426441
def _on_user_file_load_failure(self, e, message, use_error_name=False):
427442
self._setup_instrument_specific_settings(SANSInstrument.NO_INSTRUMENT)
428443
self._view.instrument = SANSInstrument.NO_INSTRUMENT

scripts/test/SANS/gui_logic/test_run_tab_presenter.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ def setUp(self):
8383
self._backup_instrument = config["default.instrument"]
8484
self._backup_datasearch_dirs = config["datasearch.directories"]
8585
self._backup_save_dir = config["defaultsave.directory"]
86+
self._backup_sans_plot_results = config["sans.isis_sans.plotResults"]
8687

8788
config["default.facility"] = "ISIS"
8889

@@ -121,6 +122,7 @@ def tearDown(self):
121122
config["default.instrument"] = self._backup_instrument
122123
config["datasearch.directories"] = self._backup_datasearch_dirs
123124
config["defaultsave.directory2"] = self._backup_save_dir
125+
config["sans.isis_sans.plotResults"] = self._backup_sans_plot_results
124126

125127
def test_that_will_load_user_file(self):
126128
# Setup self.presenter.and mock view
@@ -768,6 +770,23 @@ def test_that_on_reduction_mode_changed_calls_update_rear_if_selection_is_LAB(se
768770
self.presenter.on_reduction_mode_selection_has_changed("rear-detector")
769771
self.presenter._beam_centre_presenter.update_rear_selected.assert_called_once_with()
770772

773+
def test_plot_results_visibility_on(self):
774+
self._test_plot_results_visibility("On", True)
775+
776+
def test_plot_results_visibility_off(self):
777+
self._test_plot_results_visibility("Off", False)
778+
779+
def test_plot_results_visibility_when_not_set(self):
780+
self._test_plot_results_visibility("", False)
781+
782+
def _test_plot_results_visibility(self, config_value, expected_visibility):
783+
config.setString("sans.isis_sans.plotResults", config_value)
784+
785+
self.presenter._view.set_plot_results_checkbox_visibility = mock.Mock()
786+
self.presenter.hide_or_show_plot_results_checkbox_based_on_user_properties()
787+
788+
self.presenter._view.set_plot_results_checkbox_visibility.assert_called_once_with(expected_visibility)
789+
771790
@staticmethod
772791
def _clear_property_manager_data_service():
773792
for element in PropertyManagerDataService.getObjectNames():

0 commit comments

Comments
 (0)