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


Python IndirectCommon类代码示例

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


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

示例1: test_loadInst

    def test_loadInst(self):
        indirect_common.loadInst('IRIS')

        ws_name = '__empty_IRIS'
        ws = mtd[ws_name]
        instrument = ws.getInstrument()
        self.assertEqual(instrument.getName(), 'IRIS')
开发者ID:,项目名称:,代码行数:7,代码来源:

示例2: test_transposeFitParametersTable_rename_output

    def test_transposeFitParametersTable_rename_output(self):
        ws = self.make_dummy_QENS_workspace()
        params_table = self.make_multi_domain_parameter_table(ws)
        output_name = "new_table"

        indirect_common.transposeFitParametersTable(params_table, output_name)

        self.assert_table_workspace_dimensions(params_table, expected_row_count=26, expected_column_count=3)
        self.assert_table_workspace_dimensions(output_name, expected_row_count=5, expected_column_count=11)
开发者ID:liyulun,项目名称:mantid,代码行数:9,代码来源:IndirectCommonTests.py

示例3: test_convertToElasticQ_workspace_already_in_Q

    def test_convertToElasticQ_workspace_already_in_Q(self):
        ws = self.make_dummy_QENS_workspace()
        e_fixed = indirect_common.getEfixed(ws)
        ConvertSpectrumAxis(ws,Target='ElasticQ',EMode='Indirect',EFixed=e_fixed,OutputWorkspace=ws)

        indirect_common.convertToElasticQ(ws)

        self.assert_workspace_units_match_expected('MomentumTransfer', ws)
        self.assert_has_numeric_axis(ws)
开发者ID:liyulun,项目名称:mantid,代码行数:9,代码来源:IndirectCommonTests.py

示例4: test_addSampleLogs

    def test_addSampleLogs(self):
        ws = CreateSampleWorkspace()
        logs = {}
        logs['FloatLog'] = 3.149
        logs['IntLog'] = 42
        logs['StringLog'] = "A String Log"
        logs['BooleanLog'] = True

        indirect_common.addSampleLogs(ws, logs)

        self.assert_logs_match_expected(ws.name(), logs)
开发者ID:,项目名称:,代码行数:11,代码来源:

示例5: test_convertToElasticQ_output_in_different_workspace

    def test_convertToElasticQ_output_in_different_workspace(self):
        ws = self.make_dummy_QENS_workspace()
        output_workspace = 'ws2'
        indirect_common.convertToElasticQ(ws, output_ws=output_workspace)

        #check original wasn't modified
        self.assert_workspace_units_match_expected('Label', ws)
        self.assert_has_spectrum_axis(ws)

        #check new workspace matches what we expect
        self.assert_workspace_units_match_expected('MomentumTransfer', output_workspace)
        self.assert_has_numeric_axis(output_workspace)
开发者ID:liyulun,项目名称:mantid,代码行数:12,代码来源:IndirectCommonTests.py

示例6: test_convertParametersToWorkspace

    def test_convertParametersToWorkspace(self):
        ws = self.make_dummy_QENS_workspace()

        #make a parameter table to search in
        function = "name=LinearBackground, A0=0, A1=0;"
        function += "name=Gaussian, Sigma=0.1, PeakCentre=0, Height=10;"
        table_ws = PlotPeakByLogValue(Input=ws + ",v0:10", Function=function)

        param_names = ['A0', 'Sigma', 'PeakCentre']
        indirect_common.convertParametersToWorkspace(table_ws.name(), 'axis-1', param_names, "params_workspace")
        params_workspace = mtd["params_workspace"]

        self.assert_matrix_workspace_dimensions(params_workspace.name(),
                                                expected_num_histograms=3, expected_blocksize=5)
开发者ID:liyulun,项目名称:mantid,代码行数:14,代码来源:IndirectCommonTests.py

示例7: test_getWSprefix_ISIS

    def test_getWSprefix_ISIS(self):
        config["default.facility"] = "ISIS"
        ws = self.make_dummy_QENS_workspace()

        ws_name = indirect_common.getWSprefix(ws)

        self.assertEqual(ws_name, "irs1_graphite002_", "The workspace prefix does not match the expected value")
开发者ID:nimgould,项目名称:mantid,代码行数:7,代码来源:IndirectCommonTests.py

示例8: test_getWSprefix_ILL

    def test_getWSprefix_ILL(self):
        config["default.facility"] = "ILL"
        ws = self.make_dummy_QENS_workspace(instrument_name="IN16B")

        ws_name = indirect_common.getWSprefix(ws)

        self.assertEqual(ws_name, "in16b_1_", "The workspace prefix does not match the expected value")
开发者ID:nimgould,项目名称:mantid,代码行数:7,代码来源:IndirectCommonTests.py

示例9: test_getEFixed

    def test_getEFixed(self):
        ws = CreateSampleWorkspace()
        ws = self.load_instrument(ws,'IRIS')

        e_fixed = indirect_common.getEfixed(ws.name())
        self.assertEqual(e_fixed, 1.8450,
                         "The EFixed value does not match the expected value")
开发者ID:liyulun,项目名称:mantid,代码行数:7,代码来源:IndirectCommonTests.py

示例10: test_getWSprefix_ILL

    def test_getWSprefix_ILL(self):
        config['default.facility'] = 'ILL'
        ws = self.make_dummy_QENS_workspace(instrument_name='IN16B')

        ws_name = indirect_common.getWSprefix(ws)

        self.assertEqual(ws_name, 'in16b_1_',
                         "The workspace prefix does not match the expected value")
开发者ID:liyulun,项目名称:mantid,代码行数:8,代码来源:IndirectCommonTests.py

示例11: test_getInstrRun_from_workspace

    def test_getInstrRun_from_workspace(self):
        ws = self.make_dummy_QENS_workspace(add_logs=False)
        ws = RenameWorkspace(ws, OutputWorkspace="IRS26173")

        (instrument, run_number) = indirect_common.getInstrRun(ws.name())

        self.assertEqual(run_number, '26173')
        self.assertEqual(instrument, 'irs')
开发者ID:liyulun,项目名称:mantid,代码行数:8,代码来源:IndirectCommonTests.py

示例12: test_createQaxis

 def test_createQaxis(self):
     ws = self.make_dummy_QENS_workspace()
     expected_result = [
         0.48372274526965614,
         0.5253047207470043,
         0.5667692111215948,
         0.6079351677527526,
         0.6487809073399486,
     ]
     actual_result = indirect_common.createQaxis(ws)
     self.assert_lists_almost_match(expected_result, actual_result)
开发者ID:nimgould,项目名称:mantid,代码行数:11,代码来源:IndirectCommonTests.py

示例13: test_convertToElasticQ_with_numeric_axis_not_in_Q

    def test_convertToElasticQ_with_numeric_axis_not_in_Q(self):
        ws = self.make_dummy_QENS_workspace()

        #convert spectrum axis to units of Q
        e_fixed = indirect_common.getEfixed(ws)
        ConvertSpectrumAxis(ws,Target='ElasticQ',EMode='Indirect',EFixed=e_fixed,OutputWorkspace=ws)
        #set the units to be something we didn't expect
        unit = mtd[ws].getAxis(1).setUnit("Label")
        unit.setLabel('Random Units', '')

        self.assertRaises(RuntimeError, indirect_common.convertToElasticQ, ws)
开发者ID:liyulun,项目名称:mantid,代码行数:11,代码来源:IndirectCommonTests.py

示例14: test_search_for_fit_params

    def test_search_for_fit_params(self):
        ws = self.make_dummy_QENS_workspace()

        #make a parameter table to search in
        function = "name=LinearBackground, A0=0, A1=0;"
        function += "name=Gaussian, Sigma=0.1, PeakCentre=0, Height=10;"
        table_ws = PlotPeakByLogValue(Input=ws+",v", Function=function)

        params = indirect_common.search_for_fit_params("Sigma", table_ws.name())

        self.assertEqual(len(params), 1)
        self.assertEqual(params[0], "f1.Sigma")
开发者ID:liyulun,项目名称:mantid,代码行数:12,代码来源:IndirectCommonTests.py

示例15: test_loadNexus

 def test_loadNexus(self):
     ws_name = indirect_common.loadNexus('IRS26173_ipg.nxs')
     self.assertEqual(ws_name, 'IRS26173_ipg')
     self.assertTrue(mtd.doesExist(ws_name))
开发者ID:,项目名称:,代码行数:4,代码来源:


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