本文整理汇总了Python中diffpy.pdffit2.PdfFit.selectAtomType方法的典型用法代码示例。如果您正苦于以下问题:Python PdfFit.selectAtomType方法的具体用法?Python PdfFit.selectAtomType怎么用?Python PdfFit.selectAtomType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类diffpy.pdffit2.PdfFit
的用法示例。
在下文中一共展示了PdfFit.selectAtomType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: selectAtomTypeExceptions
# 需要导入模块: from diffpy.pdffit2 import PdfFit [as 别名]
# 或者: from diffpy.pdffit2.PdfFit import selectAtomType [as 别名]
class selectAtomTypeExceptions(unittest.TestCase):
def setUp(self):
self.P = PdfFit()
self.iset = 1
self.i = 1
def tearDown(self):
del self.P
def test_unassignedError1(self):
"""raise pdffit2.unassignedError when set does not exist"""
self.assertRaises(pdffit2.unassignedError, self.P.selectAtomType,
self.iset, 'i', 'Ni', True)
def test_unassignedError2(self):
"""raise pdffit2.unassignedError when set does not exist"""
self.P.read_struct(datafile("Ni.stru"))
# selectAtomType should pass with one phase defined
self.P.read_data(datafile("Ni.dat"), 'X', 25.0, 0.0)
self.P.selectAtomType(self.iset, 'i', 'Ni', True)
self.P.selectAtomType(self.iset, 'j', 'Ni', False)
# but fail for phase 2 which is not present
self.assertRaises(pdffit2.unassignedError, self.P.selectAtomType,
2, 'i', 'Ca', True)
def test_ijcharValueError(self):
"""raise ValueError when ijchar is neither 'i' nor 'j'"""
self.P.read_struct(datafile("Ni.stru"))
self.P.read_data(datafile("Ni.dat"), 'X', 25.0, 0.0)
self.P.selectAtomType(self.iset, 'i', 'Ni', True)
self.P.selectAtomType(self.iset, 'j', 'Ni', True)
self.assertRaises(ValueError, self.P.selectAtomType,
self.iset, 'k', 'Ni', True)