當前位置: 首頁>>代碼示例>>Python>>正文


Python PDFCalculator.scatteringfactortable方法代碼示例

本文整理匯總了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
開發者ID:pavoljuhas,項目名稱:diffpy.srreal,代碼行數:18,代碼來源:testpdfcalcobjcryst.py

示例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
開發者ID:diffpy,項目名稱:diffpy.srreal,代碼行數:20,代碼來源:testpdfcalcobjcryst.py

示例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
開發者ID:diffpy,項目名稱:diffpy.srreal,代碼行數:22,代碼來源:testscatteringfactortable.py

示例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
開發者ID:diffpy,項目名稱:diffpy.srreal,代碼行數:23,代碼來源:testscatteringfactortable.py


注:本文中的diffpy.srreal.pdfcalculator.PDFCalculator.scatteringfactortable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。