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


Python Direct.ReductionHelpers类代码示例

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


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

示例1: __setattr__

 def __setattr__(self,name,val):
     if name is 'special':
         return
     elif name in self.__class__.__dict__:
         fp = self.__class__.__dict__[name]
         fp.__set__(self,val)
     else:
         helpers.gen_setter(self.__dict__,name,val)
开发者ID:DanNixon,项目名称:mantid,代码行数:8,代码来源:DirectReductionHelpersTest.py

示例2: test_split_file_name

    def test_split_file_name(self):
        fpath,nums,fext = helpers.parse_run_file_name('MER10100.nxs')

        self.assertEqual(fpath,'')
        self.assertEqual(nums,10100)
        self.assertEqual(fext,'.nxs')
        fpath,nums,fext = helpers.parse_run_file_name('c:/somepath/MER1011,MER10100.nxs')
        self.assertEqual(len(nums),2)
        self.assertEqual(nums[0],1011)
        self.assertEqual(nums[1],10100)
        self.assertEqual(fpath[0],'c:/somepath')
        self.assertEqual(fpath[1],'')

        fpath,nums,fext = helpers.parse_run_file_name('c:/somepath/MER1011:MER1014.nxs,1046')
        self.assertEqual(len(nums),5)
开发者ID:DanNixon,项目名称:mantid,代码行数:15,代码来源:DirectReductionHelpersTest.py

示例3: testbuild_properties_dict

    def testbuild_properties_dict(self):
        kkdict = {}
        kkdict['first']='kkk1:kkk2'
        kkdict['kkk1']=19
        kkdict['kkk2']=1000
        kkdict['other']='unrelated'
        kkdict['second']='ssss1:ssss2:third'
        kkdict['third']='Babara'

        subst = {}
        subst['ssss1']='kkk1'
        subst['ssss2']='other'

        subst_dict,descr = helpers.build_properties_dict(kkdict,subst)

        self.assertEqual(len(subst_dict),6)

        val = subst_dict['_first']
        self.assertTrue(type(val) is helpers.ComplexProperty)

        #self.assertEqual(val[0],'kkk1')
        #self.assertEqual(val[1],'kkk2')

        val = subst_dict['other']
        self.assertFalse(type(val) is helpers.ComplexProperty)
        self.assertEqual(val,'unrelated')

        val = subst_dict['_second']

        self.assertTrue(type(val) is helpers.ComplexProperty)
开发者ID:DanNixon,项目名称:mantid,代码行数:30,代码来源:DirectReductionHelpersTest.py

示例4: test_build_properties_dict_ksubst

    def test_build_properties_dict_ksubst(self):
        kkdict = {};
        kkdict['first']='kkk1:kkk2';
        kkdict['kkk1']=19;
        kkdict['kkk2']=1000;
        kkdict['other']='unrelated';
        kkdict['second']='ssss1:ssss2:third';
        kkdict['third']='Babara';

        subst = {};
        subst['first']=1;
        subst['ssss1']='kkk1';
        subst['ssss2']='other';
        subst['third']=3;
        subst['second']=2;

        subst_dict,descr_dict = helpers.build_properties_dict(kkdict,subst)

        self.assertEqual(len(subst_dict),6);

        val = subst_dict['_1']
        self.assertTrue(type(val) is helpers.ComplexProperty)

        #self.assertEqual(val[0],'kkk1');
        #self.assertEqual(val[1],'kkk2');

        val = subst_dict['other']
        self.assertFalse(type(val) is helpers.ComplexProperty)
        self.assertEqual(val,'unrelated');

        val = subst_dict['_2']
        self.assertTrue(type(val) is helpers.ComplexProperty)
开发者ID:mkoennecke,项目名称:mantid,代码行数:32,代码来源:DirectReductionHelpersTest.py

示例5: test_build_subst_dictionary

    def test_build_subst_dictionary(self):
        self.assertEqual(dict(), helpers.build_subst_dictionary(""))
        self.assertEqual(dict(), helpers.build_subst_dictionary())

        self.assertRaises(AttributeError, helpers.build_subst_dictionary, 10)
        self.assertRaises(AttributeError, helpers.build_subst_dictionary, "A=")
        self.assertRaises(AttributeError, helpers.build_subst_dictionary, "B=C;A=")

        rez=dict()
        rez['A']='B'
        self.assertEqual(rez, helpers.build_subst_dictionary(rez))

        myDict = helpers.build_subst_dictionary("A=B")
        self.assertEqual(myDict['B'],'A')

        myDict = helpers.build_subst_dictionary("A=B;C=DD")
        self.assertEqual(myDict['B'],'A')
        self.assertEqual(myDict['DD'],'C')
        myDict = helpers.build_subst_dictionary("A=B=C=DD")
        self.assertEqual(myDict['B'],'A')
        self.assertEqual(myDict['DD'],'A')
        self.assertEqual(myDict['C'],'A')

        myDict = helpers.build_subst_dictionary("A = B = C=DD")
        self.assertEqual(myDict['B'],'A')
        self.assertEqual(myDict['DD'],'A')
        self.assertEqual(myDict['C'],'A')
开发者ID:DanNixon,项目名称:mantid,代码行数:27,代码来源:DirectReductionHelpersTest.py

示例6: test_get_default_idf_param_list

    def test_get_default_idf_param_list(self):
        pInstr=self.getInstrument()

        param_list = helpers.get_default_idf_param_list(pInstr)
        self.assertTrue(isinstance(param_list,dict))
        # check couple of parameters which are certainly in IDF
        self.assertTrue('deltaE-mode' in param_list)
        self.assertTrue('normalise_method' in param_list)
        self.assertTrue('diag_samp_lo' in param_list)
开发者ID:DanNixon,项目名称:mantid,代码行数:9,代码来源:DirectReductionHelpersTest.py

示例7: __getattribute__

 def __getattribute__(self,name):
     if name[:2] == '__':
         attr = object.__getattribute__(self,name)
         return attr
     else:
         attr_dic = object.__getattribute__(self,'__dict__')
         if name is '__dict__':
             return attr_dic
         else:
             return helpers.gen_getter(attr_dic,name)
         pass
开发者ID:DanNixon,项目名称:mantid,代码行数:11,代码来源:DirectReductionHelpersTest.py

示例8: testbuild_properties_dict_pref

    def testbuild_properties_dict_pref(self):
        kkdict = {}
        kkdict['first']='kkk1:kkk2'
        kkdict['kkk1']=19
        kkdict['kkk2']=1000
        kkdict['other']='unrelated'
        kkdict['second']='ssss1:ssss2:third'
        kkdict['third']='Babara'
        kkdict['descr1']='ddd'
        kkdict['descr2']='kkk1:kkk2'
        kkdict['descr3']=10

        subst = {}
        subst['ssss1']='kkk1'
        subst['ssss2']='other'
        subst['descr2']='des222'


        prop_dict,desct = helpers.build_properties_dict(kkdict,subst,['descr1','des222','descr3'])
        self.assertEqual(len(desct),3)
        self.assertEqual(desct['descr3'],10)
        self.assertEqual(desct['descr1'],'ddd')
        self.assertTrue('des222' in desct.keys())


        self.assertEqual(len(prop_dict),6)

        val = prop_dict['_first']
        self.assertTrue(type(val) is helpers.ComplexProperty)

        #elf.assertEqual(val[0],'_kkk1')
        #self.assertEqual(val[1],'_kkk2')

        val = prop_dict['other']
        self.assertFalse(type(val) is helpers.ComplexProperty)
        self.assertEqual(val,'unrelated')

        val = prop_dict['_second']
        self.assertTrue(type(val) is helpers.ComplexProperty)

        #self.assertEqual(val[0],'_kkk1')
        #self.assertEqual(val[1],'_other')
        #self.assertEqual(val[2],'_third')


        val = prop_dict['third']
        self.assertFalse(type(val) is helpers.ComplexProperty)
        self.assertEqual(val,'Babara')
开发者ID:DanNixon,项目名称:mantid,代码行数:48,代码来源:DirectReductionHelpersTest.py

示例9: test_gen_setter

    def test_gen_setter(self):
        kkdict = {}
        kkdict['A']=helpers.ComplexProperty(['B','C'])
        kkdict['B']=19
        kkdict['C']=1000


        helpers.gen_setter(kkdict,'B',0)
        self.assertEqual(kkdict['B'],0)
        helpers.gen_setter(kkdict,'C',10)
        self.assertEqual(kkdict['C'],10)

        self.assertRaises(KeyError,helpers.gen_setter,kkdict,'A',100)
        self.assertEqual(kkdict['B'],0)

        helpers.gen_setter(kkdict,'A',[1,10])
        self.assertEqual(kkdict['B'],1)
        self.assertEqual(kkdict['C'],10)

        helpers.gen_setter(kkdict,'A',(2,20))
        self.assertEqual(kkdict['B'],2)
        self.assertEqual(kkdict['C'],20)
开发者ID:DanNixon,项目名称:mantid,代码行数:22,代码来源:DirectReductionHelpersTest.py

示例10: test_gen_getter

    def test_gen_getter(self):
        kkdict = {}
        kkdict['first']='kkk1:kkk2'
        kkdict['kkk1']=19
        kkdict['kkk2']=1000
        kkdict['other']='unrelated'
        kkdict['second']='ssss1:ssss2:third'
        kkdict['third']='Babara'

        subst = {}
        subst['ssss1']='kkk1'
        subst['ssss2']='other'

        subst_dict,descr = helpers.build_properties_dict(kkdict,subst)
        self.assertEqual(helpers.gen_getter(subst_dict,'kkk1'),19)
        self.assertEqual(helpers.gen_getter(subst_dict,'kkk2'),1000)
        self.assertEqual(helpers.gen_getter(subst_dict,'first'),(19,1000))
        self.assertEqual(helpers.gen_getter(subst_dict,'other'),'unrelated')
        self.assertEqual(helpers.gen_getter(subst_dict,'second'),[19,'unrelated','Babara'])
        self.assertEqual(helpers.gen_getter(subst_dict,'third'),'Babara')
开发者ID:DanNixon,项目名称:mantid,代码行数:20,代码来源:DirectReductionHelpersTest.py

示例11: test_gen_setter

    def test_gen_setter(self):
        kkdict = {};
        kkdict['A']=helpers.ComplexProperty(['B','C']);
        kkdict['B']=19;
        kkdict['C']=1000;
   

        helpers.gen_setter(kkdict,'B',0)
        self.assertEqual(kkdict['B'],0);
        helpers.gen_setter(kkdict,'C',10)
        self.assertEqual(kkdict['C'],10);

        self.assertRaises(KeyError,helpers.gen_setter,kkdict,'A',100)
        self.assertEqual(kkdict['B'],0);

        helpers.gen_setter(kkdict,'A',[1,10])
        self.assertEqual(kkdict['B'],1);
        self.assertEqual(kkdict['C'],10);
开发者ID:mkoennecke,项目名称:mantid,代码行数:18,代码来源:DirectReductionHelpersTest.py

示例12: __getattr__

 def __getattr__(self,name):
     return helpers.gen_getter(self.__dict__,name)
开发者ID:DanNixon,项目名称:mantid,代码行数:2,代码来源:DirectReductionHelpersTest.py

示例13: __get__

    def __get__(self,instance,type=None):
        if instance is None:
           return self

        return prop_helpers.gen_getter(instance.__dict__,'use_hard_mask_only')
开发者ID:mkoennecke,项目名称:mantid,代码行数:5,代码来源:PropertiesDescriptors.py


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