本文整理汇总了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
示例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