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


Python Structure.pdffit['scale']方法代码示例

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


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

示例1: test_nometa

# 需要导入模块: from diffpy.Structure import Structure [as 别名]
# 或者: from diffpy.Structure.Structure import pdffit['scale'] [as 别名]
 def test_nometa(self):
     '''check NoMetaStructureAdapter.
     '''
     r0, g0 = PDFCalculator()(self.nickel)
     ni1 = Structure(self.nickel)
     ni1.pdffit['scale'] = 2.0
     r1, g1 = PDFCalculator()(ni1)
     self.assertTrue(numpy.array_equal(r0, r1))
     self.assertTrue(numpy.allclose(2 * g0, g1))
     ni1nm = nometa(ni1)
     self.assertTrue(ni1nm is nometa(ni1nm))
     r1nm, g1nm = PDFCalculator()(ni1nm)
     self.assertTrue(numpy.array_equal(r0, r1nm))
     self.assertTrue(numpy.allclose(g0, g1nm))
     ni2 = Structure(self.nickel)
     ni2.pdffit['delta2'] = 4
     r2, g2 = PDFCalculator()(ni2)
     r2, g2nm = PDFCalculator()(nometa(ni2))
     self.assertFalse(numpy.allclose(g0, g2))
     self.assertTrue(numpy.allclose(g0, g2nm))
     adpt2 = createStructureAdapter(ni2)
     ra2, ga2 = PDFCalculator()(adpt2)
     ra2, ga2nm = PDFCalculator()(nometa(adpt2))
     self.assertTrue(numpy.allclose(g2, ga2))
     self.assertTrue(numpy.allclose(g0, ga2nm))
     return
开发者ID:pavoljuhas,项目名称:diffpy.srreal,代码行数:28,代码来源:teststructureadapter.py

示例2: test_nometa_pickling

# 需要导入模块: from diffpy.Structure import Structure [as 别名]
# 或者: from diffpy.Structure.Structure import pdffit['scale'] [as 别名]
 def test_nometa_pickling(self):
     '''check pickling of the NoMetaStructureAdapter wrapper.
     '''
     r0, g0 = PDFCalculator()(self.nickel)
     ni1 = Structure(self.nickel)
     ni1.pdffit['scale'] = 2.0
     ni1nm = cPickle.loads(cPickle.dumps(nometa(ni1)))
     self.assertFalse(ni1nm is ni1)
     r1nm, g1nm = PDFCalculator()(ni1nm)
     self.assertTrue(numpy.array_equal(r0, r1nm))
     self.assertTrue(numpy.array_equal(g0, g1nm))
     return
开发者ID:pavoljuhas,项目名称:diffpy.srreal,代码行数:14,代码来源:teststructureadapter.py


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