当前位置: 首页>>代码示例>>Python>>正文


Python AlgorithmManager.create方法代码示例

本文整理汇总了Python中mantid.api.AlgorithmManager.create方法的典型用法代码示例。如果您正苦于以下问题:Python AlgorithmManager.create方法的具体用法?Python AlgorithmManager.create怎么用?Python AlgorithmManager.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mantid.api.AlgorithmManager的用法示例。


在下文中一共展示了AlgorithmManager.create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_newestInstanceOf_returns_correct_instance

# 需要导入模块: from mantid.api import AlgorithmManager [as 别名]
# 或者: from mantid.api.AlgorithmManager import create [as 别名]
    def test_newestInstanceOf_returns_correct_instance(self):
        alg = AlgorithmManager.create("ConvertUnits")
        alg2 = AlgorithmManager.create("ConvertUnits")
        alg3 = AlgorithmManager.newestInstanceOf("ConvertUnits")

        self.assertEquals(alg2.getAlgorithmID(), alg3.getAlgorithmID())
        self.assertNotEqual(alg.getAlgorithmID(), alg3.getAlgorithmID())
开发者ID:rosswhitfield,项目名称:mantid,代码行数:9,代码来源:AlgorithmManagerTest.py

示例2: test_workspace_entries_must_be_q1d

# 需要导入模块: from mantid.api import AlgorithmManager [as 别名]
# 或者: from mantid.api.AlgorithmManager import create [as 别名]
    def test_workspace_entries_must_be_q1d(self):
        # create an input workspace that has multiple spectra
        create_alg = AlgorithmManager.create('CreateWorkspace')
        create_alg.setChild(True)
        create_alg.initialize()
        create_alg.setProperty('DataX', range(0, 1))
        create_alg.setProperty('DataY', [1, 2])
        create_alg.setProperty('NSpec', 2)  # Wrong number of spectra
        create_alg.setProperty('UnitX', 'MomentumTransfer')
        create_alg.setPropertyValue('OutputWorkspace', 'out_ws')
        create_alg.execute()
        multi_spectra_input = create_alg.getProperty('OutputWorkspace').value

        alg = AlgorithmManager.create('SANSStitch')
        alg.setChild(True)
        alg.initialize()
        alg.setProperty('Mode', 'Both')
        alg.setProperty('HABCountsSample', multi_spectra_input)
        alg.setProperty('LABCountsSample', multi_spectra_input)
        alg.setProperty('HABNormSample', multi_spectra_input)
        alg.setProperty('LABNormSample', multi_spectra_input)

        errors = alg.validateInputs()
        self.assertTrue('HABCountsSample' in errors)
        self.assertTrue('LABCountsSample' in errors)
        self.assertTrue('HABNormSample' in errors)
        self.assertTrue('LABNormSample' in errors)
开发者ID:mducle,项目名称:mantid,代码行数:29,代码来源:SANSStitchTest.py

示例3: test_strip_special_values

# 需要导入模块: from mantid.api import AlgorithmManager [as 别名]
# 或者: from mantid.api.AlgorithmManager import create [as 别名]
    def test_strip_special_values(self):
        create_alg = AlgorithmManager.create('CreateWorkspace')
        create_alg.setChild(True)
        create_alg.initialize()
        create_alg.setProperty('DataX', range(0, 10))
        y_data = np.array([1] * 7)
        y_data = np.append(y_data, [np.nan])
        y_data = np.append(y_data, [np.inf])
        create_alg.setProperty('DataY', y_data)
        create_alg.setProperty('NSpec', 1)
        create_alg.setProperty('UnitX', 'MomentumTransfer')
        create_alg.setPropertyValue('OutputWorkspace', 'out_ws')
        create_alg.execute()
        single_spectra_input = create_alg.getProperty('OutputWorkspace').value

        alg = AlgorithmManager.create('SANSStitch')
        alg.setChild(True)
        alg.initialize()
        alg.setProperty('Mode', 'Both')
        alg.setProperty('HABCountsSample', single_spectra_input)
        alg.setProperty('LABCountsSample', single_spectra_input)
        alg.setProperty('HABNormSample', single_spectra_input)
        alg.setProperty('LABNormSample', single_spectra_input)
        alg.setProperty('OutputWorkspace', 'dummy_name')
        # This would throw at the point of fitting in NaNs or infs where present
        alg.execute()
开发者ID:mducle,项目名称:mantid,代码行数:28,代码来源:SANSStitchTest.py

示例4: test_can_workspaces_required_if_process_can

# 需要导入模块: from mantid.api import AlgorithmManager [as 别名]
# 或者: from mantid.api.AlgorithmManager import create [as 别名]
    def test_can_workspaces_required_if_process_can(self):
        # create an input workspace that has multiple spectra
        create_alg = AlgorithmManager.create('CreateWorkspace')
        create_alg.setChild(True)
        create_alg.initialize()
        create_alg.setProperty('DataX', range(0, 1))
        create_alg.setProperty('DataY', [1])
        create_alg.setProperty('NSpec', 1)
        create_alg.setProperty('UnitX', 'MomentumTransfer')
        create_alg.setPropertyValue('OutputWorkspace', 'out_ws')
        create_alg.execute()
        single_spectra_input = create_alg.getProperty('OutputWorkspace').value

        alg = AlgorithmManager.create('SANSStitch')
        alg.setChild(True)
        alg.initialize()
        alg.setProperty('Mode', 'Both')
        alg.setProperty('HABCountsSample', single_spectra_input)
        alg.setProperty('LABCountsSample', single_spectra_input)
        alg.setProperty('HABNormSample', single_spectra_input)
        alg.setProperty('LABNormSample', single_spectra_input)
        alg.setProperty('ProcessCan', True)  # Now can workspaces should be provided

        errors = alg.validateInputs()
        self.assertTrue('HABCountsCan' in errors)
        self.assertTrue('LABCountsCan' in errors)
        self.assertTrue('HABNormCan' in errors)
        self.assertTrue('LABNormCan' in errors)
开发者ID:mducle,项目名称:mantid,代码行数:30,代码来源:SANSStitchTest.py

示例5: test_scale_only

# 需要导入模块: from mantid.api import AlgorithmManager [as 别名]
# 或者: from mantid.api.AlgorithmManager import create [as 别名]
    def test_scale_only(self):
        create_alg = AlgorithmManager.create('CreateWorkspace')
        create_alg.setChild(True)
        create_alg.initialize()
        create_alg.setProperty('NSpec', 1)
        create_alg.setProperty('UnitX', 'MomentumTransfer')
        create_alg.setPropertyValue('OutputWorkspace', 'out_ws')
        create_alg.setProperty('DataX', range(0, 10))

        # HAB as linear function y=x+5
        create_alg.setProperty('DataY', range(5, 14))
        create_alg.execute()
        hab_workspace = create_alg.getProperty('OutputWorkspace').value

        # LAB as linear function y=x+0
        create_alg.setProperty('DataY', range(0, 9))
        create_alg.execute()
        lab_workspace= create_alg.getProperty('OutputWorkspace').value

        alg = AlgorithmManager.create('SANSFitShiftScale')
        alg.setChild(True)
        alg.initialize()
        alg.setProperty('Mode', 'ScaleOnly')
        alg.setProperty('HABWorkspace', hab_workspace)
        alg.setProperty('LABWorkspace', lab_workspace)
        alg.setProperty('ShiftFactor', -5.0)
        alg.setProperty('ScaleFactor', 7.2)

        alg.execute()

        out_shift_factor = alg.getProperty('OutShiftFactor').value
        out_scale_factor = alg.getProperty('OutScaleFactor').value

        self.assertEquals(out_scale_factor, 1.0)
        self.assertEquals(out_shift_factor, -5.0)
开发者ID:DanNixon,项目名称:mantid,代码行数:37,代码来源:SANSFitShiftScaleTest.py

示例6: test_scale_none

# 需要导入模块: from mantid.api import AlgorithmManager [as 别名]
# 或者: from mantid.api.AlgorithmManager import create [as 别名]
    def test_scale_none(self):
        create_alg = AlgorithmManager.create('CreateWorkspace')
        create_alg.setChild(True)
        create_alg.initialize()
        create_alg.setProperty('DataX', range(0, 10))
        create_alg.setProperty('DataY', [1] * 9)
        create_alg.setProperty('NSpec', 1)
        create_alg.setProperty('UnitX', 'MomentumTransfer')
        create_alg.setPropertyValue('OutputWorkspace', 'out_ws')
        create_alg.execute()
        single_spectra_input = create_alg.getProperty('OutputWorkspace').value

        in_scale_factor = 1.0
        in_shift_factor = 1.0
        alg = AlgorithmManager.create('SANSFitShiftScale')
        alg.setChild(True)
        alg.initialize()
        alg.setProperty('Mode', 'None')
        alg.setProperty('HABWorkspace', single_spectra_input)
        alg.setProperty('LABWorkspace', single_spectra_input)
        alg.setProperty('ShiftFactor', in_shift_factor)
        alg.setProperty('ScaleFactor', in_scale_factor)
        alg.execute()
        out_shift_factor = alg.getProperty('OutShiftFactor').value
        out_scale_factor = alg.getProperty('OutScaleFactor').value

        self.assertEquals(out_scale_factor, in_scale_factor)
        self.assertEquals(out_shift_factor, in_shift_factor)
开发者ID:DanNixon,项目名称:mantid,代码行数:30,代码来源:SANSFitShiftScaleTest.py

示例7: test_stitch_2d_restricted_to_none

# 需要导入模块: from mantid.api import AlgorithmManager [as 别名]
# 或者: from mantid.api.AlgorithmManager import create [as 别名]
    def test_stitch_2d_restricted_to_none(self):
        # create an input workspace that has multiple spectra
        create_alg = AlgorithmManager.create('CreateWorkspace')
        create_alg.setChild(True)
        create_alg.initialize()
        create_alg.setProperty('DataX', range(0, 1))
        create_alg.setProperty('DataY', [1,1])
        create_alg.setProperty('NSpec', 2)
        create_alg.setProperty('UnitX', 'MomentumTransfer')
        create_alg.setPropertyValue('OutputWorkspace', 'out_ws')
        create_alg.execute()
        double_spectra_input = create_alg.getProperty('OutputWorkspace').value

        # Basic algorithm setup
        alg = AlgorithmManager.create('SANSStitch')
        alg.setChild(True)
        alg.initialize()
        alg.setProperty('HABCountsSample', double_spectra_input)
        alg.setProperty('LABCountsSample', double_spectra_input)
        alg.setProperty('HABNormSample', double_spectra_input)
        alg.setProperty('LABNormSample', double_spectra_input)
        alg.setProperty('ProcessCan', False)
        alg.setProperty('ShiftFactor', 1.0)
        alg.setProperty('ScaleFactor', 0.0)

        # 2D inputs Should not be allowed for mode Both
        alg.setProperty('Mode', 'Both')
        errors = alg.validateInputs()
        self.assertTrue('HABCountsSample' in errors)
        self.assertTrue('LABCountsSample' in errors)
        self.assertTrue('HABNormSample' in errors)
        self.assertTrue('LABNormSample' in errors)

        # 2D inputs Should not be allowed for mode ScaleOnly
        alg.setProperty('Mode', 'ScaleOnly')
        errors = alg.validateInputs()
        self.assertTrue('HABCountsSample' in errors)
        self.assertTrue('LABCountsSample' in errors)
        self.assertTrue('HABNormSample' in errors)
        self.assertTrue('LABNormSample' in errors)

        # 2D inputs Should not be allowed for mode ShiftOnly
        alg.setProperty('Mode', 'ShiftOnly')
        errors = alg.validateInputs()
        self.assertTrue('HABCountsSample' in errors)
        self.assertTrue('LABCountsSample' in errors)
        self.assertTrue('HABNormSample' in errors)
        self.assertTrue('LABNormSample' in errors)

        # With no fitting 2D inputs are allowed
        alg.setProperty('Mode', 'None')
        errors = alg.validateInputs()
        self.assertEqual(0, len(errors))
开发者ID:mducle,项目名称:mantid,代码行数:55,代码来源:SANSStitchTest.py

示例8: test_scale_both_without_can_with_q_fit_range

# 需要导入模块: from mantid.api import AlgorithmManager [as 别名]
# 或者: from mantid.api.AlgorithmManager import create [as 别名]
    def test_scale_both_without_can_with_q_fit_range(self):
        create_alg = AlgorithmManager.create('CreateWorkspace')
        create_alg.setChild(True)
        create_alg.initialize()
        create_alg.setProperty('NSpec', 1)
        create_alg.setProperty('UnitX', 'MomentumTransfer')
        create_alg.setPropertyValue('OutputWorkspace', 'out_ws')
        create_alg.setProperty('DataX', range(0, 12))

        # HAB as linear function y=x+5
        hab_range = list(range(5, 16))
        hab_range[0] = 15000
        hab_range[9] = 15000
        create_alg.setProperty('DataY', hab_range)
        create_alg.execute()
        hab_workspace = create_alg.getProperty('OutputWorkspace').value

        # LAB as linear function y=x+0
        create_alg.setProperty('DataY', range(0, 11))
        create_alg.execute()
        lab_workspace= create_alg.getProperty('OutputWorkspace').value

        # FLAT NORM
        create_alg.setProperty('DataY', [1] * 11)
        create_alg.execute()
        flat_norm = create_alg.getProperty('OutputWorkspace').value

        alg = AlgorithmManager.create('SANSStitch')
        alg.setChild(True)
        alg.initialize()
        alg.setProperty('Mode', 'Both')
        alg.setProperty('HABCountsSample', hab_workspace)
        alg.setProperty('LABCountsSample', lab_workspace)
        alg.setProperty('HABNormSample', flat_norm)
        alg.setProperty('LABNormSample', flat_norm)
        alg.setProperty('OutputWorkspace', 'dummy_name')
        alg.setProperty('FitMin', 1)
        alg.setProperty('FitMax', 9)
        alg.execute()
        out_ws = alg.getProperty('OutputWorkspace').value
        out_shift_factor = alg.getProperty('OutShiftFactor').value
        out_scale_factor = alg.getProperty('OutScaleFactor').value
        self.assertEquals(out_scale_factor, 1.0)
        self.assertEquals(out_shift_factor, -5.0)

        out_ws = alg.getProperty('OutputWorkspace').value

        y_array = out_ws.readY(0)

        expected_y_array = [7497.5, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 7502, 10.0]  # We scale and shift to the back (lab) detectors

        self.assertTrue(all(map(lambda element: element in y_array, expected_y_array)),
                        msg='All data should be scaled and shifted to the LAB scale=1 shift=-5')
开发者ID:DanNixon,项目名称:mantid,代码行数:55,代码来源:SANSStitchTest.py

示例9: test_that_zero_merge_range_has_discrete_transition

# 需要导入模块: from mantid.api import AlgorithmManager [as 别名]
# 或者: from mantid.api.AlgorithmManager import create [as 别名]
    def test_that_zero_merge_range_has_discrete_transition(self):
            # This tests that if a merge_max or merge_min is specified greater than the overlap region of
            # the HAB and LAB the relevant value is set to the maximum value.
            create_alg = AlgorithmManager.create('CreateWorkspace')
            create_alg.setChild(True)
            create_alg.initialize()
            create_alg.setProperty('DataX', range(0, 10))
            create_alg.setProperty('DataY', [1] * 9)
            create_alg.setProperty('NSpec', 1)
            create_alg.setProperty('UnitX', 'MomentumTransfer')
            create_alg.setPropertyValue('OutputWorkspace', 'out_ws')
            create_alg.execute()
            single_spectra_input = create_alg.getProperty('OutputWorkspace').value
            create_alg.setProperty('DataY', [2] * 9)
            create_alg.execute()
            single_spectra_input_HAB = create_alg.getProperty('OutputWorkspace').value
            create_alg.setProperty('DataY', [0.5] * 9)
            create_alg.execute()
            smaller_single_spectra_input = create_alg.getProperty('OutputWorkspace').value

            alg = AlgorithmManager.create('SANSStitch')
            alg.setChild(True)
            alg.initialize()
            alg.setProperty('Mode', 'None')
            alg.setProperty('HABCountsSample', single_spectra_input_HAB)
            alg.setProperty('LABCountsSample', single_spectra_input)
            alg.setProperty('HABNormSample', single_spectra_input)
            alg.setProperty('LABNormSample', single_spectra_input)
            alg.setProperty('ProcessCan', True)
            alg.setProperty('HABCountsCan', smaller_single_spectra_input)
            alg.setProperty('LABCountsCan', smaller_single_spectra_input)
            alg.setProperty('HABNormCan', single_spectra_input)
            alg.setProperty('LABNormCan', single_spectra_input)
            alg.setProperty('OutputWorkspace', 'dummy_name')
            alg.setProperty('ShiftFactor', 0.0)
            alg.setProperty('ScaleFactor', 1.0)
            alg.setProperty('MergeMask', True)
            alg.setProperty('MergeMin', 5)
            alg.setProperty('MergeMax', 5)
            alg.execute()
            out_ws = alg.getProperty('OutputWorkspace').value

            self.assertTrue(isinstance(out_ws, MatrixWorkspace))

            y_array = out_ws.readY(0)

            expected_y_array = [0.5] * 5 + [1.5] * 4
            
            np.testing.assert_equal(y_array, expected_y_array)
开发者ID:mantidproject,项目名称:mantid,代码行数:51,代码来源:SANSStitchTest.py

示例10: test_scale_none_with_can_and_q_merge_range

# 需要导入模块: from mantid.api import AlgorithmManager [as 别名]
# 或者: from mantid.api.AlgorithmManager import create [as 别名]
    def test_scale_none_with_can_and_q_merge_range(self):
        create_alg = AlgorithmManager.create('CreateWorkspace')
        create_alg.setChild(True)
        create_alg.initialize()
        create_alg.setProperty('DataX', range(0, 10))
        create_alg.setProperty('DataY', [1] * 9)
        create_alg.setProperty('NSpec', 1)
        create_alg.setProperty('UnitX', 'MomentumTransfer')
        create_alg.setPropertyValue('OutputWorkspace', 'out_ws')
        create_alg.execute()
        single_spectra_input = create_alg.getProperty('OutputWorkspace').value
        create_alg.setProperty('DataY', [2] * 9)
        create_alg.execute()
        single_spectra_input_HAB = create_alg.getProperty('OutputWorkspace').value
        create_alg.setProperty('DataY', [0.5] * 9)
        create_alg.execute()
        smaller_single_spectra_input = create_alg.getProperty('OutputWorkspace').value

        alg = AlgorithmManager.create('SANSStitch')
        alg.setChild(True)
        alg.initialize()
        alg.setProperty('Mode', 'None')
        alg.setProperty('HABCountsSample', single_spectra_input_HAB)
        alg.setProperty('LABCountsSample', single_spectra_input)
        alg.setProperty('HABNormSample', single_spectra_input)
        alg.setProperty('LABNormSample', single_spectra_input)
        alg.setProperty('ProcessCan', True)
        alg.setProperty('HABCountsCan', smaller_single_spectra_input)
        alg.setProperty('LABCountsCan', smaller_single_spectra_input)
        alg.setProperty('HABNormCan', single_spectra_input)
        alg.setProperty('LABNormCan', single_spectra_input)
        alg.setProperty('OutputWorkspace', 'dummy_name')
        alg.setProperty('ShiftFactor', 0.0)
        alg.setProperty('ScaleFactor', 1.0)
        alg.setProperty('MergeMask', True)
        alg.setProperty('MergeMin', 2)
        alg.setProperty('MergeMax', 7)
        alg.execute()
        out_ws = alg.getProperty('OutputWorkspace').value

        self.assertTrue(isinstance(out_ws, MatrixWorkspace))

        y_array = out_ws.readY(0)

        expected_y_array = [0.5] * 2 + [1.0] * 5 + [1.5] * 2

        self.assertTrue(all(map(lambda element: element in y_array, expected_y_array)),
                        msg='can gets subtracted so expect 1 - 0.5 as output signal. Proves the can workspace gets used correctly.')
开发者ID:DanNixon,项目名称:mantid,代码行数:50,代码来源:SANSStitchTest.py

示例11: test_fit_shift_requires_scale_factor

# 需要导入模块: from mantid.api import AlgorithmManager [as 别名]
# 或者: from mantid.api.AlgorithmManager import create [as 别名]
 def test_fit_shift_requires_scale_factor(self):
     alg = AlgorithmManager.create('SANSFitShiftScale')
     alg.setChild(True)
     alg.initialize()
     alg.setProperty('Mode', 'ShiftOnly')
     errors = alg.validateInputs()
     self.assertTrue('ScaleFactor' in errors)
开发者ID:DanNixon,项目名称:mantid,代码行数:9,代码来源:SANSFitShiftScaleTest.py

示例12: test_generic_dialog

# 需要导入模块: from mantid.api import AlgorithmManager [as 别名]
# 或者: from mantid.api.AlgorithmManager import create [as 别名]
 def test_generic_dialog(self):
     dialog = GenericDialog()
     alg = AlgorithmManager.create('AlgorithmDialogMockAlgorithm')
     dialog.setAlgorithm(alg)
     dialog.initializeLayout()
     input_widgets = dialog.findChildren(QLineEdit)
     self.assertEqual(len(input_widgets), 3)
开发者ID:samueljackson92,项目名称:mantid,代码行数:9,代码来源:test_algorithm_dialog.py

示例13: test_finish_handle

# 需要导入模块: from mantid.api import AlgorithmManager [as 别名]
# 或者: from mantid.api.AlgorithmManager import create [as 别名]
 def test_finish_handle(self):
     algorithm = AlgorithmManager.create("MockAlgorithm", -1)
     observer = MockObserver()
     observer.observeFinish(algorithm)
     algorithm.execute()
     self.assertTrue(observer.finish_handled)
     self.assertTrue(observer.error_message is None)
开发者ID:DanNixon,项目名称:mantid,代码行数:9,代码来源:test_algorithm_observer.py

示例14: test_scale_none_with_can_and_q_merge_range_equal

# 需要导入模块: from mantid.api import AlgorithmManager [as 别名]
# 或者: from mantid.api.AlgorithmManager import create [as 别名]
    def test_scale_none_with_can_and_q_merge_range_equal(self):
        create_alg = AlgorithmManager.create('CreateWorkspace')
        create_alg.setChild(True)
        create_alg.initialize()
        create_alg.setProperty('DataX', range(0, 10))
        create_alg.setProperty('DataY', [1] * 9)
        create_alg.setProperty('NSpec', 1)
        create_alg.setProperty('UnitX', 'MomentumTransfer')
        create_alg.setPropertyValue('OutputWorkspace', 'out_ws')
        create_alg.execute()
        single_spectra_input = create_alg.getProperty('OutputWorkspace').value
        create_alg.setProperty('DataY', [2] * 9)
        create_alg.execute()
        single_spectra_input_HAB = create_alg.getProperty('OutputWorkspace').value
        create_alg.setProperty('DataY', [0.5] * 9)
        create_alg.execute()
        smaller_single_spectra_input = create_alg.getProperty('OutputWorkspace').value

        alg = AlgorithmManager.create('SANSStitch')
        alg.setChild(True)
        alg.initialize()
        alg.setProperty('Mode', 'None')
        alg.setProperty('HABCountsSample', single_spectra_input_HAB)
        alg.setProperty('LABCountsSample', single_spectra_input)
        alg.setProperty('HABNormSample', single_spectra_input)
        alg.setProperty('LABNormSample', single_spectra_input)
        alg.setProperty('ProcessCan', True)
        alg.setProperty('HABCountsCan', smaller_single_spectra_input)
        alg.setProperty('LABCountsCan', smaller_single_spectra_input)
        alg.setProperty('HABNormCan', single_spectra_input)
        alg.setProperty('LABNormCan', single_spectra_input)
        alg.setProperty('OutputWorkspace', 'dummy_name')
        alg.setProperty('ShiftFactor', 0.0)
        alg.setProperty('ScaleFactor', 1.0)
        alg.setProperty('MergeMask', True)
        alg.setProperty('MergeMin', 5)
        alg.setProperty('MergeMax', 5)
        alg.execute()
        out_ws = alg.getProperty('OutputWorkspace').value

        self.assertTrue(isinstance(out_ws, MatrixWorkspace))

        y_array = out_ws.readY(0)

        expected_y_array = [0.5] * 5 + [1.5] * 4
        
        np.testing.assert_equal(y_array, expected_y_array)
开发者ID:mantidproject,项目名称:mantid,代码行数:49,代码来源:SANSStitchTest.py

示例15: test_progress_handle

# 需要导入模块: from mantid.api import AlgorithmManager [as 别名]
# 或者: from mantid.api.AlgorithmManager import create [as 别名]
 def test_progress_handle(self):
     algorithm = AlgorithmManager.create("MockAlgorithm", -1)
     observer = MockObserver()
     observer.observeProgress(algorithm)
     algorithm.execute()
     self.assertTrue(observer.first_progress_reported)
     self.assertTrue(observer.second_progress_reported)
     self.assertEqual(observer.progress_message, 'Half way')
开发者ID:DanNixon,项目名称:mantid,代码行数:10,代码来源:test_algorithm_observer.py


注:本文中的mantid.api.AlgorithmManager.create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。