本文整理匯總了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