def show_raw_data(self): self.ads_observer.observeRename(False) for run in self.data_context.current_runs: with WorkspaceGroupDefinition(): run_string = run_list_to_string(run) loaded_workspace = self.data_context._loaded_data.get_data(run=run, instrument=self.data_context.instrument)['workspace'][ 'OutputWorkspace'] loaded_workspace_deadtime_table = self.corrections_context.get_default_dead_time_table_name_for_run( self.data_context.instrument, run) directory = get_base_data_directory( self, run_string) deadtime_name = get_deadtime_data_workspace_name(self.data_context.instrument, str(run[0]), workspace_suffix=self.workspace_suffix) MuonWorkspaceWrapper(loaded_workspace_deadtime_table).show(directory + deadtime_name) self.corrections_context.set_default_dead_time_table_name_for_run(self.data_context.instrument, run, deadtime_name) if len(loaded_workspace) > 1: # Multi-period data for i, single_ws in enumerate(loaded_workspace): name = directory + get_raw_data_workspace_name(self.data_context.instrument, run_string, multi_period=True, period=str(i + 1), workspace_suffix=self.workspace_suffix) single_ws.show(name) else: # Single period data name = directory + get_raw_data_workspace_name(self.data_context.instrument, run_string, multi_period=False, workspace_suffix=self.workspace_suffix) loaded_workspace[0].show(name) self.ads_observer.observeRename(True)
def add_phase_table_to_ADS(self, base_name): run = get_run_numbers_as_string_from_workspace_name( base_name, self.context.data_context.instrument) directory = get_base_data_directory(self.context, run) muon_workspace_wrapper = MuonWorkspaceWrapper(directory + base_name) muon_workspace_wrapper.show() self.context.phase_context.add_phase_table(muon_workspace_wrapper)
def show_group(self, run, group, rebin): run_as_string = run_list_to_string(run) group_name = group.name periods = run_list_to_string(group.periods) directory = get_base_data_directory(self, run_as_string) name = get_group_data_workspace_name(self, group_name, run_as_string, periods, rebin=rebin) asym_name = get_group_asymmetry_name(self, group_name, run_as_string, periods, rebin=rebin) asym_name_unnorm = get_group_asymmetry_unnorm_name(self, group_name, run_as_string, periods, rebin=rebin) if not rebin: self.group_pair_context[group_name].show_raw( run, directory + name, directory + asym_name, asym_name_unnorm) else: self.group_pair_context[group_name].show_rebin( run, directory + name, directory + asym_name, asym_name_unnorm)
def show_diff(self, run: list, diff: MuonDiff): diff_name = diff.name run_as_string = run_list_to_string(run) name = get_diff_asymmetry_name(self, diff_name, run_as_string, rebin=False) directory = get_base_data_directory(self, run_as_string) self.group_pair_context[diff_name].show_raw(run, directory + name) if self._do_rebin(): name = get_diff_asymmetry_name(self, diff_name, run_as_string, rebin=True) self.group_pair_context[diff_name].show_rebin(run, directory + name)
def show_pair(self, run: list, pair: MuonPair): pair_name = pair.name # Do not want to rename phasequad parts here if "_Re_" in pair_name or "_Im_" in pair_name: return run_as_string = run_list_to_string(run) name = get_pair_asymmetry_name(self, pair_name, run_as_string, rebin=False) directory = get_base_data_directory(self, run_as_string) self.group_pair_context[pair_name].show_raw(run, directory + name) if self._do_rebin(): name = get_pair_asymmetry_name(self, pair_name, run_as_string, rebin=True) self.group_pair_context[pair_name].show_rebin(run, directory + name)
def _calculate_phasequads(self, phasequad_obj, rebin): for run in self._data_context.current_runs: if self._data_context.num_periods(run) > 1: raise ValueError("Cannot support multiple periods") ws_list = self.calculate_phasequad(phasequad_obj, run, rebin) run_string = run_list_to_string(run) directory = get_base_data_directory(self, run_string) for ws in ws_list: muon_workspace_wrapper = MuonWorkspaceWrapper(directory + ws) muon_workspace_wrapper.show() phasequad_obj.update_asymmetry_workspaces(ws_list, run, rebin=rebin)