本文整理汇总了Python中diffpy.pdffit2.PdfFit.pdesel方法的典型用法代码示例。如果您正苦于以下问题:Python PdfFit.pdesel方法的具体用法?Python PdfFit.pdesel怎么用?Python PdfFit.pdesel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类diffpy.pdffit2.PdfFit
的用法示例。
在下文中一共展示了PdfFit.pdesel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestPdfFit
# 需要导入模块: from diffpy.pdffit2 import PdfFit [as 别名]
# 或者: from diffpy.pdffit2.PdfFit import pdesel [as 别名]
#.........这里部分代码省略.........
# return
#
# def test_setphase(self):
# """check PdfFit.setphase()
# """
# return
#
# def test_setdata(self):
# """check PdfFit.setdata()
# """
# return
#
def test_psel(self):
"""check PdfFit.psel()
"""
def doalloc():
self.P.alloc('X', 30.0, 0.05, 2, 10, 100)
return
self.assertRaises(pdffit2.unassignedError, self.P.psel, 0)
self.assertRaises(pdffit2.unassignedError, self.P.psel, 1)
self.P.read_struct(datafile('Ni.stru'))
doalloc()
self.P.calc()
G1 = self.P.getpdf_fit()
self.P.reset()
self.P.read_struct(datafile('PbScW25TiO3.stru'))
doalloc()
self.P.calc()
G2 = self.P.getpdf_fit()
self.P.reset()
self.P.read_struct(datafile('Ni.stru'))
self.P.read_struct(datafile('PbScW25TiO3.stru'))
doalloc()
self.P.pdesel('ALL')
self.P.psel(1)
self.P.calc()
self.assertEqual(G1, self.P.getpdf_fit())
self.P.pdesel('ALL')
self.P.psel(2)
self.P.calc()
self.assertEqual(G2, self.P.getpdf_fit())
self.P.psel('ALL')
self.P.calc()
Gall = self.P.getpdf_fit()
dGmax = max([abs(g1 + g2 - gall)
for g1, g2, gall in zip(G1, G2, Gall)])
self.assertAlmostEqual(0, dGmax, self.places)
self.assertRaises(pdffit2.unassignedError, self.P.psel, 10)
self.assertRaises(pdffit2.unassignedError, self.P.psel, 0)
self.assertRaises(pdffit2.unassignedError, self.P.psel, -100)
return
def test_pdesel(self):
"""check PdfFit.pdesel()
"""
def doalloc():
self.P.alloc('X', 30.0, 0.05, 2, 10, 100)
return
self.assertRaises(pdffit2.unassignedError, self.P.pdesel, 0)
self.assertRaises(pdffit2.unassignedError, self.P.pdesel, 1)
self.P.read_struct(datafile('Ni.stru'))
doalloc()
self.P.calc()
G1 = self.P.getpdf_fit()
self.P.reset()
self.P.read_struct(datafile('PbScW25TiO3.stru'))