本文整理汇总了Python中diffpy.srreal.pdfcalculator.PDFCalculator.scatteringfactortable方法的典型用法代码示例。如果您正苦于以下问题:Python PDFCalculator.scatteringfactortable方法的具体用法?Python PDFCalculator.scatteringfactortable怎么用?Python PDFCalculator.scatteringfactortable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类diffpy.srreal.pdfcalculator.PDFCalculator
的用法示例。
在下文中一共展示了PDFCalculator.scatteringfactortable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _makePDFCalculator
# 需要导入模块: from diffpy.srreal.pdfcalculator import PDFCalculator [as 别名]
# 或者: from diffpy.srreal.pdfcalculator.PDFCalculator import scatteringfactortable [as 别名]
def _makePDFCalculator(crst, cfgdict):
'''Return a PDFCalculator object evaluated for a pyobjcryst.Crystal crst.
'''
inpdfcalc = lambda kv: kv[0] not in ('biso', 'type')
pdfcargs = dict(filter(inpdfcalc, cfgdict.items()))
pdfc = PDFCalculator(**pdfcargs)
if 'biso' in cfgdict:
setbiso = lambda sc: sc.mpScattPow.SetBiso(cfgdict['biso'])
map(setbiso, crst.GetScatteringComponentList())
if 'type' in cfgdict:
pdfc.scatteringfactortable = cfgdict['type']
pdfc.eval(crst)
# avoid metadata override by PDFFitStructure
for k, v in pdfcargs.items():
setattr(pdfc, k, v)
return pdfc
示例2: _makePDFCalculator
# 需要导入模块: from diffpy.srreal.pdfcalculator import PDFCalculator [as 别名]
# 或者: from diffpy.srreal.pdfcalculator.PDFCalculator import scatteringfactortable [as 别名]
def _makePDFCalculator(crst, cfgdict):
'''Return a PDFCalculator object evaluated for a pyobjcryst.Crystal crst.
'''
pdfcargs = {k : v for k, v in cfgdict.items()
if k not in ('biso', 'type')}
pdfc = PDFCalculator(**pdfcargs)
if 'biso' in cfgdict:
reg = crst.GetScatteringPowerRegistry()
for i in range(reg.GetNb()):
sp = reg.GetObj(i)
sp.SetBiso(cfgdict['biso'])
if 'type' in cfgdict:
pdfc.scatteringfactortable = cfgdict['type']
pdfc.eval(crst)
# avoid metadata override by PDFFitStructure
for k, v in pdfcargs.items():
setattr(pdfc, k, v)
return pdfc
示例3: test_ticker_override
# 需要导入模块: from diffpy.srreal.pdfcalculator import PDFCalculator [as 别名]
# 或者: from diffpy.srreal.pdfcalculator.PDFCalculator import scatteringfactortable [as 别名]
def test_ticker_override(self):
"""check Python override of ScatteringFactorTable.ticker.
"""
from diffpy.srreal.pdfcalculator import PDFCalculator
lsft = LocalTable()
self.assertEqual(0, lsft.tcnt)
et0 = lsft.ticker()
self.assertEqual(1, lsft.tcnt)
et1 = ScatteringFactorTable.ticker(lsft)
self.assertEqual(1, lsft.tcnt)
self.assertEqual(et0, et1)
et0.click()
self.assertEqual(et0, et1)
# check that implicit ticker call from PDFCalculator is
# handled by Python override of the ticker method.
pc = PDFCalculator()
pc.scatteringfactortable = lsft
pc.ticker()
self.assertEqual(2, lsft.tcnt)
return
示例4: test_picking_owned
# 需要导入模块: from diffpy.srreal.pdfcalculator import PDFCalculator [as 别名]
# 或者: from diffpy.srreal.pdfcalculator.PDFCalculator import scatteringfactortable [as 别名]
def test_picking_owned(self):
'''verify pickling of envelopes owned by PDF calculators.
'''
pc = PDFCalculator()
dbpc = DebyePDFCalculator()
ltb = LocalTable()
ltb.setCustomAs('Na', 'Na', 37)
ltb.foo = 'bar'
pc.scatteringfactortable = ltb
dbpc.scatteringfactortable = ltb
self.assertIs(ltb, pc.scatteringfactortable)
self.assertIs(ltb, dbpc.scatteringfactortable)
pc2 = pickle.loads(pickle.dumps(pc))
dbpc2 = pickle.loads(pickle.dumps(dbpc))
self.assertEqual('localtable', pc2.scatteringfactortable.type())
self.assertEqual('localtable', dbpc2.scatteringfactortable.type())
self.assertEqual(37, pc2.scatteringfactortable.lookup('Na'))
self.assertEqual(37, dbpc2.scatteringfactortable.lookup('Na'))
self.assertEqual('bar', pc2.scatteringfactortable.foo)
self.assertEqual('bar', dbpc2.scatteringfactortable.foo)
return