def test_that_create_manage_non_child_algorithm_is_called_once_in_centre_finder_new(
            self, make_algorithm_mock, load_data_mock):
        r_min = 5
        r_max = 10
        position_1_start = 300
        position_2_start = -300
        tolerance = 0.001
        find_direction = FindDirectionEnum.All
        iterations = 10
        verbose = False

        load_data_mock.return_value = {
            SANSDataType.SampleScatter: [mock.MagicMock()]
        }, {
            SANSDataType.SampleScatter: [mock.MagicMock()]
        }

        beam_centre_finder = "SANSBeamCentreFinder"
        beam_centre_finder_options = {
            "Component": 'LAB',
            "Iterations": iterations,
            "RMin": r_min / 1000,
            "RMax": r_max / 1000,
            "Position1Start": position_1_start,
            "Position2Start": position_2_start,
            "Tolerance": tolerance,
            "Direction": FindDirectionEnum.to_string(find_direction),
            "Verbose": verbose
        }

        centre_finder_new(self.state,
                          r_min=r_min,
                          r_max=r_max,
                          iterations=iterations,
                          position_1_start=position_1_start,
                          position_2_start=position_2_start,
                          tolerance=tolerance,
                          find_direction=find_direction,
                          verbose=verbose,
                          component=DetectorType.LAB)

        make_algorithm_mock.assert_called_once_with(
            beam_centre_finder, **beam_centre_finder_options)
    def test_that_create_manage_non_child_algorithm_is_called_once_in_centre_finder_new(self, make_algorithm_mock, load_data_mock):
        r_min = 5
        r_max = 10
        position_1_start = 300
        position_2_start = -300
        tolerance = 0.001
        find_direction = FindDirectionEnum.All
        iterations = 10
        verbose = False

        load_data_mock.return_value = {SANSDataType.SampleScatter: [mock.MagicMock()]}, {
            SANSDataType.SampleScatter: [mock.MagicMock()]}

        beam_centre_finder = "SANSBeamCentreFinder"
        beam_centre_finder_options = {"Component":'LAB', "Iterations": iterations, "RMin": r_min / 1000, "RMax": r_max / 1000,
                                      "Position1Start": position_1_start, "Position2Start": position_2_start,
                                      "Tolerance": tolerance, "Direction": FindDirectionEnum.to_string(find_direction),
                                      "Verbose": verbose}

        centre_finder_new(self.state, r_min=r_min, r_max=r_max, iterations=iterations, position_1_start=position_1_start
                          ,position_2_start=position_2_start, tolerance=tolerance, find_direction=find_direction
                          ,verbose=verbose, component=DetectorType.LAB)

        make_algorithm_mock.assert_called_once_with(beam_centre_finder, **beam_centre_finder_options)
Beispiel #3
0
 def _execute_reduction_method(state, r_min, r_max, max_iter, xstart,
                               ystart, tolerance, find_direction):
     # Perform the beam centre finder algorithm
     return centre_finder_new(state, r_min, r_max, max_iter, xstart, ystart,
                              tolerance, find_direction)
Beispiel #4
0
 def _execute_reduction_method(state, r_min, r_max, max_iter, xstart, ystart, tolerance, find_direction, verbose):
     # Perform the beam centre finder algorithm
     return centre_finder_new(state, r_min, r_max, max_iter, xstart, ystart, tolerance, find_direction, verbose)