From 6f1721dab19ca08d77e6bab1b42c6220a7f54c2e Mon Sep 17 00:00:00 2001 From: Tom Titcombe <t.j.titcombe@gmail.com> Date: Fri, 25 Jan 2019 15:16:54 +0000 Subject: [PATCH] Update Diagnostic system test reference file Add clearer failure message for Masking System Test Refs #23960 --- .../algorithms/WorkflowAlgorithms/SANS/SANSLoad.py | 1 - .../SystemTests/tests/analysis/SANSDiagnosticPageTest.py | 7 ++++--- .../SystemTests/tests/analysis/SANSMaskWorkspaceTest.py | 7 +++++-- .../SANS2D_ws_centred_diagnostic_reference.nxs.md5 | 1 + scripts/SANS/sans/algorithm_detail/move_workspaces.py | 2 +- scripts/SANS/sans/common/general_functions.py | 2 -- .../sans/gui_logic/presenter/masking_table_presenter.py | 9 +++++++++ 7 files changed, 20 insertions(+), 9 deletions(-) create mode 100644 Testing/SystemTests/tests/analysis/reference/SANS2D_ws_centred_diagnostic_reference.nxs.md5 diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANS/SANSLoad.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANS/SANSLoad.py index 4f6cb562e12..5c84dd6e14b 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANS/SANSLoad.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANS/SANSLoad.py @@ -341,7 +341,6 @@ class SANSLoad(ParallelDataProcessorAlgorithm): else: is_trans = False move_alg.setProperty("IsTransmissionWorkspace", is_trans) - for workspace in workspace_list: zero_alg.setProperty("Workspace", workspace) zero_alg.execute() diff --git a/Testing/SystemTests/tests/analysis/SANSDiagnosticPageTest.py b/Testing/SystemTests/tests/analysis/SANSDiagnosticPageTest.py index 0d90b158bd5..b8000c278be 100644 --- a/Testing/SystemTests/tests/analysis/SANSDiagnosticPageTest.py +++ b/Testing/SystemTests/tests/analysis/SANSDiagnosticPageTest.py @@ -70,7 +70,8 @@ class SANSDiagnosticPageTest(unittest.TestCase): compare_alg.setChild(False) compare_alg.execute() result = compare_alg.getProperty("Result").value - self.assertTrue(result) + message = compare_alg.getProperty("Messages").value + self.assertTrue(result, message) # Remove file if os.path.exists(f_name): @@ -105,9 +106,9 @@ class SANSDiagnosticPageTest(unittest.TestCase): # Act output_workspaces = run_integral('', True, IntegralEnum.Horizontal, DetectorType.LAB, state) - + self.assertEqual(len(output_workspaces), 1) # Evaluate it up to a defined point - reference_file_name = "SANS2D_ws_diagnostic_reference.nxs" + reference_file_name = "SANS2D_ws_centred_diagnostic_reference.nxs" self._compare_workspace(output_workspaces[0], reference_file_name) def test_that_produces_correct_workspace_multiperiod_LARMOR(self): diff --git a/Testing/SystemTests/tests/analysis/SANSMaskWorkspaceTest.py b/Testing/SystemTests/tests/analysis/SANSMaskWorkspaceTest.py index 57c7047918e..b126b38f737 100644 --- a/Testing/SystemTests/tests/analysis/SANSMaskWorkspaceTest.py +++ b/Testing/SystemTests/tests/analysis/SANSMaskWorkspaceTest.py @@ -86,7 +86,8 @@ class SANSMaskWorkspaceTest(unittest.TestCase): expected_spectra = list(set(expected_spectra)) masked_spectra = list(get_masked_spectrum_numbers(workspace)) - self.assertTrue(len(expected_spectra) == len(masked_spectra)) + self.assertTrue(len(expected_spectra) == len(masked_spectra), + "{} does not equal {}".format(len(expected_spectra), len(masked_spectra))) for expected, actual in zip(sorted(expected_spectra), sorted(masked_spectra)): self.assertTrue(expected == actual) @@ -95,7 +96,9 @@ class SANSMaskWorkspaceTest(unittest.TestCase): expected_spectra = list(set(expected_spectra)) non_masked_spectra = list(get_non_masked_spectrum_numbers(workspace)) - self.assertTrue(len(expected_spectra) == len(non_masked_spectra)) + + self.assertTrue(len(expected_spectra) == len(non_masked_spectra), + "Expected length {}, got length {}".format(len(expected_spectra), len(non_masked_spectra))) for expected, actual in zip(sorted(expected_spectra), sorted(non_masked_spectra)): self.assertTrue(expected == actual) diff --git a/Testing/SystemTests/tests/analysis/reference/SANS2D_ws_centred_diagnostic_reference.nxs.md5 b/Testing/SystemTests/tests/analysis/reference/SANS2D_ws_centred_diagnostic_reference.nxs.md5 new file mode 100644 index 00000000000..a37abbfabc1 --- /dev/null +++ b/Testing/SystemTests/tests/analysis/reference/SANS2D_ws_centred_diagnostic_reference.nxs.md5 @@ -0,0 +1 @@ +bebc77b6ba8d3256f154a7224d213295 diff --git a/scripts/SANS/sans/algorithm_detail/move_workspaces.py b/scripts/SANS/sans/algorithm_detail/move_workspaces.py index 8e053425581..007e2ddd6b2 100644 --- a/scripts/SANS/sans/algorithm_detail/move_workspaces.py +++ b/scripts/SANS/sans/algorithm_detail/move_workspaces.py @@ -523,7 +523,7 @@ class SANSMoveLOQ(SANSMove): super(SANSMoveLOQ, self).__init__() def do_move_initial(self, move_info, workspace, coordinates, component, is_transmission_workspace): - # For LOQ we only have to coordinates + # For LOQ we only have two coordinates assert len(coordinates) == 2 if not is_transmission_workspace: # First move the sample holder diff --git a/scripts/SANS/sans/common/general_functions.py b/scripts/SANS/sans/common/general_functions.py index 4e3e0713c4e..8c75e8d1ce9 100644 --- a/scripts/SANS/sans/common/general_functions.py +++ b/scripts/SANS/sans/common/general_functions.py @@ -292,10 +292,8 @@ def convert_bank_name_to_detector_type_isis(detector_name): """ detector_name = detector_name.upper() detector_name = detector_name.strip() - print("name: ", detector_name) if detector_name == "REAR-DETECTOR" or detector_name == "MAIN-DETECTOR-BANK" or detector_name == "DETECTORBENCH" \ or detector_name == "REAR" or detector_name == "MAIN": - print("IN LAB!") detector_type = DetectorType.LAB elif detector_name == "FRONT-DETECTOR" or detector_name == "HAB" or detector_name == "FRONT": detector_type = DetectorType.HAB diff --git a/scripts/SANS/sans/gui_logic/presenter/masking_table_presenter.py b/scripts/SANS/sans/gui_logic/presenter/masking_table_presenter.py index c63e778f616..6a4182b661f 100644 --- a/scripts/SANS/sans/gui_logic/presenter/masking_table_presenter.py +++ b/scripts/SANS/sans/gui_logic/presenter/masking_table_presenter.py @@ -85,6 +85,15 @@ def perform_load(serialized_state): def perform_move(state, workspace): serialized_state = state.property_manager move_name = "SANSMove" + + zero_options = {"SANSState": serialized_state, + "Workspace": workspace, + "MoveType": "SetToZero", + "Component": ""} + zero_alg = create_unmanaged_algorithm(move_name, **zero_options) + zero_alg.execute() + workspace = zero_alg.getProperty("Workspace").value + move_options = {"SANSState": serialized_state, "Workspace": workspace, "MoveType": "InitialMove"} -- GitLab