本文整理汇总了Python中diffpy.pdffit2.PdfFit.num_datasets方法的典型用法代码示例。如果您正苦于以下问题:Python PdfFit.num_datasets方法的具体用法?Python PdfFit.num_datasets怎么用?Python PdfFit.num_datasets使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类diffpy.pdffit2.PdfFit
的用法示例。
在下文中一共展示了PdfFit.num_datasets方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestPdfFit
# 需要导入模块: from diffpy.pdffit2 import PdfFit [as 别名]
# 或者: from diffpy.pdffit2.PdfFit import num_datasets [as 别名]
#.........这里部分代码省略.........
self.P.read_struct(datafile('Ni.stru'))
self.P.read_struct(datafile('PbScW25TiO3.stru'))
self.P.setphase(1)
a1 = self.P.get_atoms()
a2 = self.P.get_atoms(2)
self.assertEqual(4*['NI'], a1)
self.assertEqual(8*['PB']+24*['O']+8*['SC']+8*['W']+8*['TI'], a2)
return
def test_get_atom_types(self):
"""check PdfFit.get_atom_types()
"""
self.P.read_struct(datafile('Ni.stru'))
self.P.read_struct(datafile('PbScW25TiO3.stru'))
self.P.setphase(1)
atp1 = self.P.get_atom_types()
atp2 = self.P.get_atom_types(2)
self.assertEqual(['NI'], atp1)
self.assertEqual(['PB', 'O', 'SC', 'W', 'TI'], atp2)
return
def test_num_phases(self):
"""check PdfFit.num_phases()
"""
self.assertEqual(0, self.P.num_phases())
self.P.read_struct(datafile('Ni.stru'))
self.assertEqual(1, self.P.num_phases())
self.P.read_struct(datafile('PbScW25TiO3.stru'))
self.assertEqual(2, self.P.num_phases())
self.P.reset()
self.assertEqual(0, self.P.num_phases())
return
def test_num_datasets(self):
"""check PdfFit.num_datasets()
"""
self.assertEqual(0, self.P.num_datasets())
self.P.read_data(datafile('Ni.dat'), 'X', 25.0, 0.5)
self.assertEqual(1, self.P.num_datasets())
# failed data should not increase num_datasets
try:
self.P.read_data(datafile('badNi.dat'))
except:
pass
self.assertEqual(1, self.P.num_datasets())
# alloc should increase number of datasets
# alloc requires a loaded structure
self.P.read_struct(datafile('Ni.stru'))
self.P.alloc('X', 30.0, 0.05, 2, 10, 100)
self.assertEqual(2, self.P.num_datasets())
self.P.reset()
self.assertEqual(0, self.P.num_datasets())
return
def test_getcrw(self):
"""check PdfFit.getcrw()
"""
import numpy
self.assertEqual(0, self.P.num_datasets())
# Setting qmax=0 so that partial crw are not disturbed by
# termination ripples.
self.P.read_data(datafile('Ni.dat'), 'X', 0.0, 0.0)
# crw is empty before data refinement
self.assertEqual([], self.P.getcrw())
self.P.read_struct(datafile('Ni.stru'))
self.P.pdfrange(1, 2, 19)