Ejemplo n.º 1
0
    def test_calculate_group_with_no_relevant_periods_returns_none(self):
        # Generate the pre_process_data workspace
        run_pre_processing(self.context, [self.run_number], rebin=False)
        counts_workspace, asymmetry_workspace, group_asymmetry_unormalised = self.context.calculate_group(
            MuonGroup('fwd', periods=(3, 4)), run=[19489])

        self.assertEqual(counts_workspace, None)
        self.assertEqual(asymmetry_workspace, None)
        self.assertEqual(group_asymmetry_unormalised, None)
Ejemplo n.º 2
0
    def test_calculate_group_with_no_relevant_periods_returns_none(self):
        # Generate the pre_process_data workspace
        run_pre_processing(self.context, [self.run_number], rebin=False)

        group = MuonGroup('fwd', periods=(3, 4))
        counts_workspace = self.context.calculate_counts(self.run_list, group)
        asymmetry_workspaces = self.context.calculate_asymmetry(self.run_list, group)

        self.assertEqual(counts_workspace, None)
        self.assertEqual(asymmetry_workspaces, None)
Ejemplo n.º 3
0
    def _calculate_all_counts(self, rebin):
        for run in self._data_context.current_runs:
            run_pre_processing(context=self, run=run, rebin=rebin)
            for group in self._group_pair_context.groups:
                counts_workspace = self.calculate_counts(run, group, rebin)

                if not counts_workspace:
                    continue

                self.group_pair_context[group.name].update_counts_workspace(
                    MuonRun(run), counts_workspace, rebin)
Ejemplo n.º 4
0
    def test_calculate_group_calculates_group_for_given_run(self):
        # Generate the pre_process_data workspace
        run_pre_processing(self.context, [self.run_number], rebin=False)
        counts_workspace, asymmetry_workspace, group_asymmetry_unormalised = self.context.calculate_group(
            'fwd', run=[19489])

        self.assertEqual(counts_workspace, 'EMU19489; Group; fwd; Counts; MA')
        self.assertEqual(asymmetry_workspace,
                         'EMU19489; Group; fwd; Asymmetry; MA')
        self.assertEqual(group_asymmetry_unormalised,
                         '__EMU19489; Group; fwd; Asymmetry; MA_unnorm')
Ejemplo n.º 5
0
    def calculate_all_pairs(self):
        for run in self._data_context.current_runs:
            run_pre_processing(context=self, run=run, rebin=self._do_rebin())
            for pair_name in self._group_pair_context.pair_names:
                pair_asymmetry_workspace = self.calculate_pair(pair_name, run)
                self.group_pair_context[pair_name].update_asymmetry_workspace(
                    pair_asymmetry_workspace, run)

                if self._do_rebin():
                    pair_asymmetry_workspace = self.calculate_pair(pair_name,
                                                                   run,
                                                                   rebin=True)
                    self.group_pair_context[
                        pair_name].update_asymmetry_workspace(
                            pair_asymmetry_workspace, run, rebin=True)
Ejemplo n.º 6
0
    def _calculate_groups(self, rebin):
        for run in self._data_context.current_runs:
            run_pre_processing(context=self, run=run, rebin=rebin)
            for group in self._group_pair_context.groups:
                group_workspace, group_asymmetry, group_asymmetry_unormalised = \
                     self.calculate_group(group, run, rebin=rebin)

                # If this run contains none of the relevant periods for the group no
                # workspace is created.
                if not group_workspace:
                    continue

                self.group_pair_context[group.name].update_workspaces(
                    run,
                    group_workspace,
                    group_asymmetry,
                    group_asymmetry_unormalised,
                    rebin=rebin)
Ejemplo n.º 7
0
    def calculate_all_groups(self):
        for run in self._data_context.current_runs:
            run_pre_processing(context=self, run=run, rebin=self._do_rebin())
            for group_name in self._group_pair_context.group_names:
                group_workspace, group_asymmetry, group_asymmetry_unormalised = self.calculate_group(
                    group_name, run)
                self.group_pair_context[group_name].update_workspaces(
                    run,
                    group_workspace,
                    group_asymmetry,
                    group_asymmetry_unormalised,
                    rebin=False)

                if self._do_rebin():
                    group_workspace, group_asymmetry, group_asymmetry_unormalised = self.calculate_group(
                        group_name, run, rebin=True)
                    self.group_pair_context[group_name].update_workspaces(
                        run,
                        group_workspace,
                        group_asymmetry,
                        group_asymmetry_unormalised,
                        rebin=True)
Ejemplo n.º 8
0
    def test_calculate_pair_calculates_pair_for_given_run(self):
        # Generate the pre_process_data workspace
        run_pre_processing(self.context, [self.run_number], rebin=False)
        pair_asymmetry = self.context.calculate_pair('long', run=[19489])

        self.assertEqual(pair_asymmetry, 'EMU19489; Pair Asym; long; MA')