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


Python AlgorithmManager.createUnmanaged方法代码示例

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


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

示例1: test_AlgorithmID_compares_by_value

# 需要导入模块: from mantid.api import AlgorithmManager [as 别名]
# 或者: from mantid.api.AlgorithmManager import createUnmanaged [as 别名]
 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,代码行数:9,代码来源:AlgorithmTest.py

示例2: setUp

# 需要导入模块: from mantid.api import AlgorithmManager [as 别名]
# 或者: from mantid.api.AlgorithmManager import createUnmanaged [as 别名]
 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,代码行数:9,代码来源:PropertyWithValueTest.py

示例3: validateInputs

# 需要导入模块: from mantid.api import AlgorithmManager [as 别名]
# 或者: from mantid.api.AlgorithmManager import createUnmanaged [as 别名]
 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,代码行数:13,代码来源:LoadAndMerge.py

示例4: test_alg_with_overridden_attrs

# 需要导入模块: from mantid.api import AlgorithmManager [as 别名]
# 或者: from mantid.api.AlgorithmManager import createUnmanaged [as 别名]
 def test_alg_with_overridden_attrs(self):
     testhelpers.assertRaisesNothing(self,AlgorithmManager.createUnmanaged, "TestPyAlgOverriddenAttrs")
     alg = AlgorithmManager.createUnmanaged("TestPyAlgOverriddenAttrs")
     self.assertEquals(alg.name(), "TestPyAlgOverriddenAttrs")
     self.assertEquals(alg.version(), 2)
     self.assertEquals(alg.category(), "BestAlgorithms")
     self.assertEquals(alg.helpURL(), "Optional documentation URL")
开发者ID:mantidproject,项目名称:mantid,代码行数:9,代码来源:PythonAlgorithmTraitsTest.py

示例5: _load_workspace

# 需要导入模块: from mantid.api import AlgorithmManager [as 别名]
# 或者: from mantid.api.AlgorithmManager import createUnmanaged [as 别名]
    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,代码行数:33,代码来源:SANSBeamCentreFinderCoreTest.py

示例6: _run_beam_centre_core

# 需要导入模块: from mantid.api import AlgorithmManager [as 别名]
# 或者: from mantid.api.AlgorithmManager import createUnmanaged [as 别名]
    def _run_beam_centre_core(self, state, workspace, monitor, transmission=None, direct=None,
                              detector_type=DetectorType.LAB, component=DataType.Sample, centre_1 = 0.1, centre_2 = -0.1
                              ,r_min = 0.06, r_max = 0.26):
        beam_centre_core_alg = AlgorithmManager.createUnmanaged("SANSBeamCentreFinderCore")
        beam_centre_core_alg.setChild(True)
        beam_centre_core_alg.initialize()

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

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

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

        beam_centre_core_alg.setProperty("Component", DetectorType.to_string(detector_type))
        beam_centre_core_alg.setProperty("DataType", DataType.to_string(component))
        beam_centre_core_alg.setProperty("Centre1", centre_1)
        beam_centre_core_alg.setProperty("Centre2", centre_2)
        beam_centre_core_alg.setProperty("RMax", r_max)
        beam_centre_core_alg.setProperty("RMin", r_min)

        beam_centre_core_alg.setProperty("OutputWorkspaceLeft", EMPTY_NAME)
        beam_centre_core_alg.setProperty("OutputWorkspaceRight", EMPTY_NAME)
        beam_centre_core_alg.setProperty("OutputWorkspaceTop", EMPTY_NAME)
        beam_centre_core_alg.setProperty("OutputWorkspaceBottom", EMPTY_NAME)

        # Act
        beam_centre_core_alg.execute()
        self.assertTrue(beam_centre_core_alg.isExecuted())
        return beam_centre_core_alg
开发者ID:stuartcampbell,项目名称:mantid,代码行数:36,代码来源:SANSBeamCentreFinderCoreTest.py

示例7: get_geometry_information_raw

# 需要导入模块: from mantid.api import AlgorithmManager [as 别名]
# 或者: from mantid.api.AlgorithmManager import createUnmanaged [as 别名]
def get_geometry_information_raw(file_name):
    """
    Gets the geometry information form the table workspace with the spb information

    :param file_name: the full file name to an existing raw file.
    :return: height, width, thickness and shape
    """
    alg_info = AlgorithmManager.createUnmanaged("RawFileInfo")
    alg_info.initialize()
    alg_info.setChild(True)
    alg_info.setProperty("Filename", file_name)
    alg_info.setProperty("GetRunParameters", False)
    alg_info.setProperty("GetSampleParameters", True)
    alg_info.execute()

    sample_parameters = alg_info.getProperty("SampleParameterTable").value
    keys = sample_parameters.getColumnNames()

    height_id = E_HEIGHT
    width_id = E_WIDTH
    thickness_id = E_THICK
    shape_id = E_GEOM

    height = sample_parameters.column(keys.index(height_id))[0]
    width = sample_parameters.column(keys.index(width_id))[0]
    thickness = sample_parameters.column(keys.index(thickness_id))[0]
    shape_flag = sample_parameters.column(keys.index(shape_id))[0]
    shape = convert_to_shape(shape_flag)
    return height, width, thickness, shape
开发者ID:samueljackson92,项目名称:mantid,代码行数:31,代码来源:file_information.py

示例8: _run_reduction_core

# 需要导入模块: from mantid.api import AlgorithmManager [as 别名]
# 或者: from mantid.api.AlgorithmManager import createUnmanaged [as 别名]
    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,代码行数:31,代码来源:SANSReductionCoreTest.py

示例9: plot_guess

# 需要导入模块: from mantid.api import AlgorithmManager [as 别名]
# 或者: from mantid.api.AlgorithmManager import createUnmanaged [as 别名]
    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,代码行数:30,代码来源:fitpropertybrowser.py

示例10: run_algorithm

# 需要导入模块: from mantid.api import AlgorithmManager [as 别名]
# 或者: from mantid.api.AlgorithmManager import createUnmanaged [as 别名]
def run_algorithm(name, **kwargs):
    """Run a named algorithm and return the
    algorithm handle

    Parameters:
        name - The name of the algorithm
        kwargs - A dictionary of property name:value pairs
    """
    alg = AlgorithmManager.createUnmanaged(name)
    alg.initialize()
    # Avoid problem that Load needs to set Filename first if it exists
    if name == 'Load' and 'Filename' in kwargs:
        alg.setPropertyValue('Filename', kwargs['Filename'])
        del kwargs['Filename']
    if 'child'in kwargs:
        alg.setChild(True)
        del kwargs['child']
        if 'OutputWorkspace' in alg:
            alg.setPropertyValue("OutputWorkspace","UNUSED_NAME_FOR_CHILD")
    if 'rethrow' in kwargs:
        alg.setRethrows(True)
        del kwargs['rethrow']
    for key, value in kwargs.iteritems():
        alg.setProperty(key, value)
    alg.execute()
    return alg
开发者ID:trnielsen,项目名称:mantid,代码行数:28,代码来源:testhelpers.py

示例11: _provide_sample_workspace

# 需要导入模块: from mantid.api import AlgorithmManager [as 别名]
# 或者: from mantid.api.AlgorithmManager import createUnmanaged [as 别名]
 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,代码行数:9,代码来源:log_tagger_test.py

示例12: _provide_workspace_with_x_errors

# 需要导入模块: from mantid.api import AlgorithmManager [as 别名]
# 或者: from mantid.api.AlgorithmManager import createUnmanaged [as 别名]
    def _provide_workspace_with_x_errors(self, workspace_name, use_xerror = True, nspec = 1,
                                         x_in = [1,2,3,4,5,6,7,8,9,10], y_in = [2,2,2,2,2,2,2,2,2],
                                         e_in = [1,1,1,1,1,1,1,1,1],  x_error = [1.1,2.2,3.3,4.4,5.5,6.6,7.7,8.8,9.9, 10.1]):
        x = []
        y = []
        e = []
        for item in range(0, nspec):
            x = x + x_in
            y = y + y_in
            e = e + e_in
        ws_alg = AlgorithmManager.createUnmanaged("CreateWorkspace")
        ws_alg.initialize()
        ws_alg.setChild(True)
        ws_alg.setProperty("DataX", x)
        ws_alg.setProperty("DataY", y)
        ws_alg.setProperty("DataE", e)
        ws_alg.setProperty("NSpec", nspec)
        ws_alg.setProperty("UnitX", "MomentumTransfer")
        ws_alg.setProperty("OutputWorkspace", workspace_name)
        ws_alg.execute()

        ws = ws_alg.getProperty("OutputWorkspace").value
        if use_xerror:
            for hists in range(0, nspec):
                x_error_array = np.asarray(x_error)
                ws.setDx(hists, x_error_array)
        return ws
开发者ID:mducle,项目名称:mantid,代码行数:29,代码来源:SANSStitchTest.py

示例13: _save_workspaces

# 需要导入模块: from mantid.api import AlgorithmManager [as 别名]
# 或者: from mantid.api.AlgorithmManager import createUnmanaged [as 别名]
    def _save_workspaces(self, directory):
        """
        Save all workspaces present in the ADS to the given directory
        :param directory: String; Path to where to save the workspaces
        """
        # Get all present workspaces
        ws_list = ADS.getObjectNames()

        if len(ws_list) == 0:
            return

        start_time = UsageService.getStartTime().toISO8601String()

        alg_name = "GeneratePythonScript"
        alg = AlgorithmManager.createUnmanaged(alg_name, 1)
        alg.setChild(True)
        alg.setLogging(False)

        for index, ws in enumerate(ws_list):
            if self._empty_group_workspace(ws):
                continue

            filename = str(index) + ".py"
            filename = os.path.join(directory, filename)

            alg.initialize()
            alg.setProperty("AppendTimestamp", True)
            alg.setProperty("AppendExecCount", True)
            alg.setProperty("InputWorkspace", ws)
            alg.setPropertyValue("Filename", filename)
            alg.setPropertyValue("StartTimestamp", start_time)
            alg.setProperty("IgnoreTheseAlgs", ALGS_TO_IGNORE)
            alg.setProperty("IgnoreTheseAlgProperties", ALG_PROPERTIES_TO_IGNORE)

            alg.execute()
开发者ID:mantidproject,项目名称:mantid,代码行数:37,代码来源:projectrecoverysaver.py

示例14: _create_algorithm

# 需要导入模块: from mantid.api import AlgorithmManager [as 别名]
# 或者: from mantid.api.AlgorithmManager import createUnmanaged [as 别名]
 def _create_algorithm(self, **kwargs):
     alg = AlgorithmManager.createUnmanaged("VesuvioPreFit")
     alg.initialize()
     alg.setChild(True)
     alg.setProperty("OutputWorkspace", "__unused")
     for key, value in kwargs.iteritems():
         alg.setProperty(key, value)
     return alg
开发者ID:liyulun,项目名称:mantid,代码行数:10,代码来源:VesuvioPreFitTest.py

示例15: load_workspace

# 需要导入模块: from mantid.api import AlgorithmManager [as 别名]
# 或者: from mantid.api.AlgorithmManager import createUnmanaged [as 别名]
def load_workspace(file_name):
    alg = AlgorithmManager.createUnmanaged("Load")
    alg.initialize()
    alg.setChild(True)
    alg.setProperty("Filename", file_name)
    alg.setProperty("OutputWorkspace", "dummy")
    alg.execute()
    return alg.getProperty("OutputWorkspace").value
开发者ID:stuartcampbell,项目名称:mantid,代码行数:10,代码来源:SANSMoveTest.py


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