本文整理汇总了Python中diffpy.srreal.pdfcalculator.PDFCalculator.addEnvelope方法的典型用法代码示例。如果您正苦于以下问题:Python PDFCalculator.addEnvelope方法的具体用法?Python PDFCalculator.addEnvelope怎么用?Python PDFCalculator.addEnvelope使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类diffpy.srreal.pdfcalculator.PDFCalculator
的用法示例。
在下文中一共展示了PDFCalculator.addEnvelope方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_picking_owned
# 需要导入模块: from diffpy.srreal.pdfcalculator import PDFCalculator [as 别名]
# 或者: from diffpy.srreal.pdfcalculator.PDFCalculator import addEnvelope [as 别名]
def test_picking_owned(self):
'''verify pickling of envelopes owned by PDF calculators.
'''
pbl = makePDFEnvelope('parabolaenvelope',
parabola_envelope, a=1, b=2, c=3)
pbl.a = 7
pbl.foobar = 'asdf'
pc = PDFCalculator()
pc.envelopes = (pbl,)
dbpc = DebyePDFCalculator()
dbpc.envelopes = (pbl,)
self.assertIs(pbl, pc.envelopes[0])
self.assertIs(pbl, dbpc.envelopes[0])
pc.addEnvelope(self.fscale)
dbpc.addEnvelope(self.fscale)
self.fscale.scale = 3.5
self.assertEqual(3.5, pc.scale)
self.assertEqual(3.5, dbpc.scale)
pc2 = pickle.loads(pickle.dumps(pc))
dbpc2 = pickle.loads(pickle.dumps(dbpc))
self.assertEqual(3.5, pc2.scale)
self.assertEqual(3.5, dbpc2.scale)
pblcopies = [pc2.getEnvelope("parabolaenvelope"),
dbpc2.getEnvelope("parabolaenvelope")]
for pbl2 in pblcopies:
self.assertEqual(7, pbl2.a)
self.assertEqual('asdf', pbl2.foobar)
self.assertEqual('parabolaenvelope', pbl2.type())
return