• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python api.AlgorithmManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_strip_special_values

    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,代码行数:26,代码来源:SANSStitchTest.py


示例2: test_AlgorithmID_compares_by_value

 def test_AlgorithmID_compares_by_value(self):
     alg = AlgorithmManager.createUnmanaged('Load')
     id = alg.getAlgorithmID()
     self.assertEquals(id, id) # equals itself
     alg2 = AlgorithmManager.createUnmanaged('Load')
     id2 = alg2.getAlgorithmID()
     self.assertNotEqual(id2, id)
开发者ID:mantidproject,项目名称:mantid,代码行数:7,代码来源:AlgorithmTest.py


示例3: setUp

 def setUp(self):
     if self._integration is None:
         self.__class__._integration = AlgorithmManager.createUnmanaged("Integration")
         self.__class__._integration.initialize()
     if self._mask_dets is None:
         self.__class__._mask_dets = AlgorithmManager.createUnmanaged("MaskDetectors")
         self.__class__._mask_dets.initialize()
开发者ID:BigShows,项目名称:mantid,代码行数:7,代码来源:PropertyWithValueTest.py


示例4: test_workspace_entries_must_be_q1d

    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,代码行数:27,代码来源:SANSStitchTest.py


示例5: test_can_workspaces_required_if_process_can

    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,代码行数:28,代码来源:SANSStitchTest.py


示例6: test_scale_only

    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,代码行数:35,代码来源:SANSFitShiftScaleTest.py


示例7: test_scale_none

    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,代码行数:28,代码来源:SANSFitShiftScaleTest.py


示例8: test_newestInstanceOf_returns_correct_instance

    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,代码行数:7,代码来源:AlgorithmManagerTest.py


示例9: test_runningInstancesOf_returns_python_list

    def test_runningInstancesOf_returns_python_list(self):
        algs = AlgorithmManager.runningInstancesOf("ConvertUnits")
        self.assertTrue(isinstance(algs, list))

        import threading
        class AlgThread(threading.Thread):
            def __init__(self):
                threading.Thread.__init__(self)
                self.algorithm = AlgorithmManager.create("Pause")
            def run(self):
                self.algorithm.initialize()
                self.algorithm.setProperty("Duration", -1.0) #forever
                self.algorithm.execute()
        # end class
        pause_thread = AlgThread()
        try:
            pause_thread.start()
            while not pause_thread.algorithm.isRunning():
                pass
            # should now be running
            algs = AlgorithmManager.runningInstancesOf("Pause")
            self.assertTrue(isinstance(algs, list))
            self.assertEquals(1, len(algs))
        except:
            pause_thread.algorithm.cancel()
            pause_thread.join()
            raise
        finally:
            pause_thread.algorithm.cancel()
            pause_thread.join()
开发者ID:rosswhitfield,项目名称:mantid,代码行数:30,代码来源:AlgorithmManagerTest.py


示例10: validateInputs

 def validateInputs(self):
     issues = dict()
     loader = self.getPropertyValue('LoaderName')
     version = self.getProperty('LoaderVersion').value
     try:
         AlgorithmManager.createUnmanaged(loader, version)
     except RuntimeError:
         message = loader + '-v' + str(version) + ' is not registered with Mantid.'
         issues['LoaderName'] = message
         issues['LoaderVersion'] = message
     return issues
开发者ID:mantidproject,项目名称:mantid,代码行数:11,代码来源:LoadAndMerge.py


示例11: test_stitch_2d_restricted_to_none

    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,代码行数:53,代码来源:SANSStitchTest.py


示例12: test_scale_both_without_can_with_q_fit_range

    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,代码行数:53,代码来源:SANSStitchTest.py


示例13: test_that_zero_merge_range_has_discrete_transition

    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,代码行数:49,代码来源:SANSStitchTest.py


示例14: test_scale_none_with_can_and_q_merge_range

    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,代码行数:48,代码来源:SANSStitchTest.py


示例15: _load_workspace

    def _load_workspace(self, state):
        load_alg = AlgorithmManager.createUnmanaged("SANSLoad")
        load_alg.setChild(True)
        load_alg.initialize()

        state_dict = state.property_manager
        load_alg.setProperty("SANSState", state_dict)
        load_alg.setProperty("PublishToCache", False)
        load_alg.setProperty("UseCached", False)
        load_alg.setProperty("MoveWorkspace", False)
        load_alg.setProperty("SampleScatterWorkspace", EMPTY_NAME)
        load_alg.setProperty("SampleScatterMonitorWorkspace", EMPTY_NAME)
        if state.data.sample_transmission:
            load_alg.setProperty("SampleTransmissionWorkspace", EMPTY_NAME)
        if state.data.sample_direct:
            load_alg.setProperty("SampleDirectWorkspace", EMPTY_NAME)

        # Act
        load_alg.execute()
        self.assertTrue(load_alg.isExecuted())
        sample_scatter = load_alg.getProperty("SampleScatterWorkspace").value
        sample_scatter_monitor_workspace = load_alg.getProperty("SampleScatterMonitorWorkspace").value
        if state.data.sample_transmission:
            transmission_workspace = load_alg.getProperty("SampleTransmissionWorkspace").value
        else:
            transmission_workspace = None
        if state.data.sample_direct:
            direct_workspace = load_alg.getProperty("SampleDirectWorkspace").value
        else:
            direct_workspace = None
        return sample_scatter, sample_scatter_monitor_workspace, transmission_workspace, direct_workspace
开发者ID:stuartcampbell,项目名称:mantid,代码行数:31,代码来源:SANSBeamCentreFinderCoreTest.py


示例16: _provide_sample_workspace

 def _provide_sample_workspace():
     alg = AlgorithmManager.createUnmanaged("CreateSampleWorkspace")
     alg.setChild(True)
     alg.initialize()
     alg.setProperty("OutputWorkspace", "dummy")
     alg.execute()
     return alg.getProperty("OutputWorkspace").value
开发者ID:DanNixon,项目名称:mantid,代码行数:7,代码来源:log_tagger_test.py


示例17: test_generic_dialog

 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,代码行数:7,代码来源:test_algorithm_dialog.py


示例18: test_fit_shift_requires_scale_factor

 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,代码行数:7,代码来源:SANSFitShiftScaleTest.py


示例19: plot_guess

    def plot_guess(self):
        """
        Plot the guess curve.
        """
        from mantidqt.plotting.functions import plot
        fun = self.getFittingFunction()
        ws_name = self.workspaceName()
        if fun == '' or ws_name == '':
            return
        ws_index = self.workspaceIndex()
        out_ws_name = '{}_guess'.format(ws_name)

        alg = AlgorithmManager.createUnmanaged('EvaluateFunction')
        alg.setChild(True)
        alg.initialize()
        alg.setProperty('Function', fun)
        alg.setProperty('InputWorkspace', ws_name)
        alg.setProperty('WorkspaceIndex', ws_index)
        alg.setProperty('OutputWorkspace', out_ws_name)
        alg.execute()
        out_ws = alg.getProperty('OutputWorkspace').value

        plot([out_ws], wksp_indices=[1], fig=self.canvas.figure, overplot=True, plot_kwargs={'label': out_ws_name})
        for lin in self.get_lines():
            if lin.get_label().startswith(out_ws_name):
                self.guess_line = lin
                self.setTextPlotGuess('Remove Guess')
        self.canvas.draw()
开发者ID:mantidproject,项目名称:mantid,代码行数:28,代码来源:fitpropertybrowser.py


示例20: _run_reduction_core

    def _run_reduction_core(self, state, workspace, monitor, transmission=None, direct=None,
                            detector_type=DetectorType.LAB, component=DataType.Sample):
        reduction_core_alg = AlgorithmManager.createUnmanaged("SANSReductionCore")
        reduction_core_alg.setChild(True)
        reduction_core_alg.initialize()

        state_dict = state.property_manager
        reduction_core_alg.setProperty("SANSState", state_dict)
        reduction_core_alg.setProperty("ScatterWorkspace", workspace)
        reduction_core_alg.setProperty("ScatterMonitorWorkspace", monitor)

        if transmission:
            reduction_core_alg.setProperty("TransmissionWorkspace", transmission)

        if direct:
            reduction_core_alg.setProperty("DirectWorkspace", direct)

        reduction_core_alg.setProperty("Component", DetectorType.to_string(detector_type))
        reduction_core_alg.setProperty("DataType", DataType.to_string(component))

        reduction_core_alg.setProperty("OutputWorkspace", EMPTY_NAME)

        reduction_core_alg.setProperty("CalculatedTransmissionWorkspace", EMPTY_NAME)
        reduction_core_alg.setProperty("UnfittedTransmissionWorkspace", EMPTY_NAME)

        # Act
        reduction_core_alg.execute()
        self.assertTrue(reduction_core_alg.isExecuted())
        return reduction_core_alg
开发者ID:mantidproject,项目名称:mantid,代码行数:29,代码来源:SANSReductionCoreTest.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python api.AnalysisDataService类代码示例发布时间:2022-05-27
下一篇:
Python api.AlgorithmFactory类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap