From 1fb6d0e93e63540e5573a2443a3bf730ab80bb3b Mon Sep 17 00:00:00 2001 From: Anthony Lim <anthony.lim@stfc.ac.uk> Date: Tue, 11 Feb 2020 13:57:33 +0000 Subject: [PATCH] refs #27634 PSI muon data fixes and in muon GUI --- Framework/DataHandling/src/LoadPSIMuonBin.cpp | 3 ++ docs/source/algorithms/LoadPSIMuonBin-v1.rst | 2 ++ docs/source/release/v4.3.0/muon.rst | 6 ++++ .../ADSHandler/muon_workspace_wrapper.py | 1 - .../GUI/Common/calculate_pair_and_group.py | 2 -- .../contexts/muon_group_pair_context.py | 2 -- .../grouping_table_widget_presenter.py | 1 - .../Muon/GUI/Common/utilities/load_utils.py | 31 ++++++++----------- 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Framework/DataHandling/src/LoadPSIMuonBin.cpp b/Framework/DataHandling/src/LoadPSIMuonBin.cpp index 925ba1ba281..72c876dc7ec 100644 --- a/Framework/DataHandling/src/LoadPSIMuonBin.cpp +++ b/Framework/DataHandling/src/LoadPSIMuonBin.cpp @@ -591,6 +591,9 @@ void LoadPSIMuonBin::assignOutputWorkspaceParticulars( if (m_header.labelsOfHistograms[i] == "") break; std::string name = m_header.labelsOfHistograms[i]; + // if no name is present (or just empty space) + // replace with default name: + // group_specNum std::string label = (name.size() > 0 && name.find_first_not_of(" ") == std::string::npos) ? "group_" + std::to_string(i+1) diff --git a/docs/source/algorithms/LoadPSIMuonBin-v1.rst b/docs/source/algorithms/LoadPSIMuonBin-v1.rst index 0ed60840afc..80601bda8c4 100644 --- a/docs/source/algorithms/LoadPSIMuonBin-v1.rst +++ b/docs/source/algorithms/LoadPSIMuonBin-v1.rst @@ -27,6 +27,8 @@ is plottable. The times are automatically offset by the value for first good data, such that the pulse is at approximatly time equals zero. This is to be consistant with ISIS measurment data. +If no group name is recorded in the data file a name of `group_specNum` will be used, where `specNum` is the spectrum number. + Errors ###### diff --git a/docs/source/release/v4.3.0/muon.rst b/docs/source/release/v4.3.0/muon.rst index a705a8bee36..036632d03d9 100644 --- a/docs/source/release/v4.3.0/muon.rst +++ b/docs/source/release/v4.3.0/muon.rst @@ -14,6 +14,11 @@ Improvements Algorithms ------------- +Bug Fixes +######### +- :ref:`LoadPSIMuonBin <algm-LoadPSIMuonBin>` can produce an empty dead time table, the time data is offset such that the start of thepulse is at time zero. The start and end date logs have been fixed and if no group name is present a default is generated. + + Muon Analysis 2 and Frequency Domain Interfaces --------------------------------------------------- - The plotting window within the Muon Analysis 2 and Frequency Domain Interfaces has been converted into a dockable window, @@ -26,6 +31,7 @@ Muon Analysis 2 and Frequency Domain Interfaces part due to the new tiled plotting feature. - Added a plotting options toolbar to the docked plotting in the Muon Analysis 2 and Frequency Domain interfaces. This toolbar can be used to autoscale the axes, change the axes limits, and control the plotting of errors. +- Fixed a bug that prevented PSI data from being loaded. Bug Fixes ######### diff --git a/scripts/Muon/GUI/Common/ADSHandler/muon_workspace_wrapper.py b/scripts/Muon/GUI/Common/ADSHandler/muon_workspace_wrapper.py index 1bb269706bc..2eb74b56ddc 100644 --- a/scripts/Muon/GUI/Common/ADSHandler/muon_workspace_wrapper.py +++ b/scripts/Muon/GUI/Common/ADSHandler/muon_workspace_wrapper.py @@ -41,7 +41,6 @@ class MuonWorkspaceWrapper(object): self._workspace = None self._directory_structure = "" self._workspace_name = "" - print(workspace, "moo") if isinstance(workspace, Workspace): self.workspace = workspace else: diff --git a/scripts/Muon/GUI/Common/calculate_pair_and_group.py b/scripts/Muon/GUI/Common/calculate_pair_and_group.py index b955621ffca..32bf1f09648 100644 --- a/scripts/Muon/GUI/Common/calculate_pair_and_group.py +++ b/scripts/Muon/GUI/Common/calculate_pair_and_group.py @@ -63,7 +63,6 @@ def _get_pre_processing_params(context, run, rebin): if context.gui_context['TimeZeroFromFile']: time_offset = 0.0 else: - print("baa",context.data_context.get_loaded_data_for_run(run)["TimeZero"] ,context.gui_context['TimeZero'],context.data_context.get_loaded_data_for_run(run)["TimeZero"] - context.gui_context['TimeZero'] ) time_offset = context.data_context.get_loaded_data_for_run(run)["TimeZero"] - context.gui_context['TimeZero'] pre_process_params["TimeOffset"] = time_offset except KeyError: @@ -121,7 +120,6 @@ def _get_MuonGroupingCounts_parameters(context, group_name, run): group = context.group_pair_context[group_name] if group: params["GroupName"] = group_name - print("dsaf", group_name) params["Grouping"] = ",".join([str(i) for i in group.detectors]) return params diff --git a/scripts/Muon/GUI/Common/contexts/muon_group_pair_context.py b/scripts/Muon/GUI/Common/contexts/muon_group_pair_context.py index cd0a66e7e94..fbba52a0e9f 100644 --- a/scripts/Muon/GUI/Common/contexts/muon_group_pair_context.py +++ b/scripts/Muon/GUI/Common/contexts/muon_group_pair_context.py @@ -52,10 +52,8 @@ def get_default_grouping(workspace, instrument, main_field_direction): try: if isinstance(workspace, WorkspaceGroup): grouping_file = workspace[0].getInstrument().getStringParameter(parameter_name)[0] - print("d", grouping_file) else: grouping_file = workspace.getInstrument().getStringParameter(parameter_name)[0] - print("e", grouping_file) except IndexError: return [], [], '' diff --git a/scripts/Muon/GUI/Common/grouping_table_widget/grouping_table_widget_presenter.py b/scripts/Muon/GUI/Common/grouping_table_widget/grouping_table_widget_presenter.py index a063842c5ac..f9be5d27a85 100644 --- a/scripts/Muon/GUI/Common/grouping_table_widget/grouping_table_widget_presenter.py +++ b/scripts/Muon/GUI/Common/grouping_table_widget/grouping_table_widget_presenter.py @@ -105,7 +105,6 @@ class GroupingTablePresenter(object): self._view.disable_updates() assert isinstance(group, MuonGroup) entry = [str(group.name), state, run_utils.run_list_to_string(group.detectors, False), str(group.n_detectors)] - self._view.warning_popup("moo") self._view.add_entry_to_table(entry) self._view.enable_updates() diff --git a/scripts/Muon/GUI/Common/utilities/load_utils.py b/scripts/Muon/GUI/Common/utilities/load_utils.py index e4bca39fff2..dc0b4af1c3e 100644 --- a/scripts/Muon/GUI/Common/utilities/load_utils.py +++ b/scripts/Muon/GUI/Common/utilities/load_utils.py @@ -206,30 +206,25 @@ def load_workspace_from_filename(filename, alg.execute() workspace = AnalysisDataService.retrieve(alg.getProperty("OutputWorkspace").valueAsStr) - print("fsdaf", workspace) if is_workspace_group(workspace): - print("multi") # handle multi-period data load_result = _get_algorithm_properties(alg, output_properties) load_result["OutputWorkspace"] = [MuonWorkspaceWrapper(ws) for ws in workspace.getNames()] run = get_run_from_multi_period_data(workspace) - if not psi_data: - load_result["DataDeadTimeTable"] = AnalysisDataService.retrieve(load_result["DeadTimeTable"]).getNames()[0] - for index, deadtime_table in enumerate(AnalysisDataService.retrieve(load_result["DeadTimeTable"]).getNames()): - if index == 0: - load_result["DataDeadTimeTable"] = deadtime_table - else: - DeleteWorkspace(Workspace=deadtime_table) - - load_result["FirstGoodData"] = round(load_result["FirstGoodData"] - load_result['TimeZero'], 2) - UnGroupWorkspace(load_result["DeadTimeTable"]) - load_result["DeadTimeTable"] = None - UnGroupWorkspace(workspace.name()) - else: - load_result["DataDeadTimeTable"] = None - load_result["FirstGoodData"] = round(load_result["FirstGoodData"], 2) + + load_result["DataDeadTimeTable"] = AnalysisDataService.retrieve(load_result["DeadTimeTable"]).getNames()[0] + for index, deadtime_table in enumerate(AnalysisDataService.retrieve(load_result["DeadTimeTable"]).getNames()): + if index == 0: + load_result["DataDeadTimeTable"] = deadtime_table + else: + DeleteWorkspace(Workspace=deadtime_table) + + load_result["FirstGoodData"] = round(load_result["FirstGoodData"] - load_result['TimeZero'], 2) + UnGroupWorkspace(load_result["DeadTimeTable"]) + load_result["DeadTimeTable"] = None + UnGroupWorkspace(workspace.name()) + else: - print("single", output_properties) # single period data load_result = _get_algorithm_properties(alg, output_properties) load_result["OutputWorkspace"] = [MuonWorkspaceWrapper(load_result["OutputWorkspace"])] -- GitLab