コード例 #1
0
ファイル: muon_context.py プロジェクト: TakudzwaMakoni/mantid
    def show_all_groups(self):
        self.calculate_all_groups()
        for run in self._data_context.current_runs:
            with WorkspaceGroupDefinition():
                for group in self._group_pair_context.groups:
                    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=False)
                    asym_name = get_group_asymmetry_name(self,
                                                         group_name,
                                                         run_as_string,
                                                         periods,
                                                         rebin=False)
                    asym_name_unnorm = get_group_asymmetry_unnorm_name(
                        self, group_name, run_as_string, periods, rebin=False)

                    self.group_pair_context[group_name].show_raw(
                        run, directory + name, directory + asym_name,
                        asym_name_unnorm)

                    if self._do_rebin():
                        name = get_group_data_workspace_name(self,
                                                             group_name,
                                                             run_as_string,
                                                             periods,
                                                             rebin=True)
                        asym_name = get_group_asymmetry_name(self,
                                                             group_name,
                                                             run_as_string,
                                                             periods,
                                                             rebin=True)
                        asym_name_unnorm = get_group_asymmetry_unnorm_name(
                            self,
                            group_name,
                            run_as_string,
                            periods,
                            rebin=True)

                        self.group_pair_context[group_name].show_rebin(
                            run, directory + name, directory + asym_name,
                            asym_name_unnorm)
コード例 #2
0
    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)
コード例 #3
0
ファイル: muon_context.py プロジェクト: mantidproject/mantid
    def show_all_groups(self):
        self.calculate_all_groups()
        for run in self._data_context.current_runs:
            for group_name in self._group_pair_context.group_names:
                run_as_string = run_list_to_string(run)
                directory = get_base_data_directory(self, run_as_string) + get_group_data_directory(self, run_as_string)

                name = get_group_data_workspace_name(self, group_name, run_as_string, rebin=False)
                asym_name = get_group_asymmetry_name(self, group_name, run_as_string, rebin=False)

                self.group_pair_context[group_name].show_raw(run, directory + name, directory + asym_name)

                if self._do_rebin():
                    name = get_group_data_workspace_name(self, group_name, run_as_string, rebin=True)
                    asym_name = get_group_asymmetry_name(self, group_name, run_as_string, rebin=True)
                    self.group_pair_context[group_name].show_rebin(run, directory + name, directory + asym_name)
コード例 #4
0
ファイル: muon_context.py プロジェクト: JoachimCoenen/mantid
    def show_all_groups(self):
        self.calculate_all_groups()
        for run in self._data_context.current_runs:
            for group_name in self._group_pair_context.group_names:
                run_as_string = run_list_to_string(run)
                directory = get_base_data_directory(self, run_as_string) + get_group_data_directory(self, run_as_string)

                name = get_group_data_workspace_name(self, group_name, run_as_string, rebin=False)
                asym_name = get_group_asymmetry_name(self, group_name, run_as_string, rebin=False)

                self.group_pair_context[group_name].show_raw(run, directory + name, directory + asym_name)

                if self._do_rebin():
                    name = get_group_data_workspace_name(self, group_name, run_as_string, rebin=True)
                    asym_name = get_group_asymmetry_name(self, group_name, run_as_string, rebin=True)
                    self.group_pair_context[group_name].show_rebin(run, directory + name, directory + asym_name)
コード例 #5
0
 def _calculate_counts(self, run, group, periods, run_as_string,
                       periods_as_string, rebin):
     """Calculates the counts workspace for the given run and group."""
     output_name = get_group_data_workspace_name(self,
                                                 group.name,
                                                 run_as_string,
                                                 periods_as_string,
                                                 rebin=rebin)
     return calculate_group_data(self, group, run, output_name, periods)
コード例 #6
0
ファイル: muon_context.py プロジェクト: StephenSmith25/mantid
    def calculate_group(self, group_name, run, rebin=False):
        run_as_string = run_list_to_string(run)
        name = get_group_data_workspace_name(self,
                                             group_name,
                                             run_as_string,
                                             rebin=rebin)
        asym_name = get_group_asymmetry_name(self,
                                             group_name,
                                             run_as_string,
                                             rebin=rebin)
        asym_name_unnorm = get_group_asymmetry_unnorm_name(self,
                                                           group_name,
                                                           run_as_string,
                                                           rebin=rebin)
        group_workspace = calculate_group_data(self, group_name, run, rebin,
                                               name)
        group_asymmetry, group_asymmetry_unnormalised = estimate_group_asymmetry_data(
            self, group_name, run, rebin, asym_name, asym_name_unnorm)

        return group_workspace, group_asymmetry, group_asymmetry_unnormalised
コード例 #7
0
ファイル: muon_context.py プロジェクト: TakudzwaMakoni/mantid
    def calculate_group(self, group, run, rebin=False):
        run_as_string = run_list_to_string(run)
        periods_as_string = run_list_to_string(group.periods)

        # A user requirement is that processing can continue if a period is missing from some
        # of the runs. This filters out periods which are not in a given run.
        periods = [
            period for period in group.periods
            if period <= self.num_periods(run)
        ]

        # If not periods match return nothing here. The caller then needs to handle this gracefully.
        if not periods:
            return None, None, None

        name = get_group_data_workspace_name(self,
                                             group.name,
                                             run_as_string,
                                             periods_as_string,
                                             rebin=rebin)
        asym_name = get_group_asymmetry_name(self,
                                             group.name,
                                             run_as_string,
                                             periods_as_string,
                                             rebin=rebin)
        asym_name_unnorm = get_group_asymmetry_unnorm_name(self,
                                                           group.name,
                                                           run_as_string,
                                                           periods_as_string,
                                                           rebin=rebin)
        group_workspace = calculate_group_data(self, group, run, rebin, name,
                                               periods)
        group_asymmetry, group_asymmetry_unnormalised = estimate_group_asymmetry_data(
            self, group, run, rebin, asym_name, asym_name_unnorm, periods)

        return group_workspace, group_asymmetry, group_asymmetry_unnormalised
コード例 #8
0
    def show_group_data(self, group_name, show=True, rebin=False):
        for run in self.current_runs:
            run_as_string = run_list_to_string(run)
            group_workspace = calculate_group_data(self, group_name, run,
                                                   rebin)
            group_asymmetry = estimate_group_asymmetry_data(
                self, group_name, run, rebin)
            directory = get_base_data_directory(
                self, run_as_string) + get_group_data_directory(
                    self, run_as_string)

            name = get_group_data_workspace_name(self, group_name,
                                                 run_as_string, rebin)
            asym_name = get_group_asymmetry_name(self, group_name,
                                                 run_as_string, rebin)

            if not rebin:
                self._groups[group_name]._workspace[str(
                    run)] = MuonWorkspaceWrapper(group_workspace)
                self._groups[group_name]._asymmetry_estimate[str(
                    run)] = MuonWorkspaceWrapper(group_asymmetry)
                if show:
                    self._groups[group_name].workspace[str(run)].show(
                        directory + name)
                    self._groups[group_name]._asymmetry_estimate[str(
                        run)].show(directory + asym_name)
            else:
                self._groups[group_name]._workspace_rebin[str(
                    run)] = MuonWorkspaceWrapper(group_workspace)
                self._groups[group_name]._asymmetry_estimate_rebin[str(
                    run)] = MuonWorkspaceWrapper(group_asymmetry)
                if show:
                    self._groups[group_name]._workspace_rebin[str(run)].show(
                        directory + name)
                    self._groups[group_name]._asymmetry_estimate_rebin[str(
                        run)].show(directory + asym_name)