本文整理汇总了Python中diffpy.srreal.pdfcalculator.PDFCalculator.rmin方法的典型用法代码示例。如果您正苦于以下问题:Python PDFCalculator.rmin方法的具体用法?Python PDFCalculator.rmin怎么用?Python PDFCalculator.rmin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类diffpy.srreal.pdfcalculator.PDFCalculator
的用法示例。
在下文中一共展示了PDFCalculator.rmin方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testGenerator
# 需要导入模块: from diffpy.srreal.pdfcalculator import PDFCalculator [as 别名]
# 或者: from diffpy.srreal.pdfcalculator.PDFCalculator import rmin [as 别名]
def testGenerator(self):
qmax = 27.0
gen = PDFGenerator()
gen.setScatteringType('N')
self.assertEqual('N', gen.getScatteringType())
gen.setQmax(qmax)
self.assertAlmostEqual(qmax, gen.getQmax())
from diffpy.Structure import PDFFitStructure
stru = PDFFitStructure()
ciffile = datafile("ni.cif")
stru.read(ciffile)
for i in range(4):
stru[i].Bisoequiv = 1
gen.setStructure(stru)
calc = gen._calc
# Test parameters
for par in gen.iterPars(recurse = False):
pname = par.name
defval = calc._getDoubleAttr(pname)
self.assertEquals(defval, par.getValue())
# Test setting values
par.setValue(1.0)
self.assertEquals(1.0, par.getValue())
par.setValue(defval)
self.assertEquals(defval, par.getValue())
r = numpy.arange(0, 10, 0.1)
y = gen(r)
# Now create a reference PDF. Since the calculator is testing its
# output, we just have to make sure we can calculate from the
# PDFGenerator interface.
from diffpy.srreal.pdfcalculator import PDFCalculator
calc = PDFCalculator()
calc.rstep = r[1] - r[0]
calc.rmin = r[0]
calc.rmax = r[-1] + 0.5 * calc.rstep
calc.qmax = qmax
calc.setScatteringFactorTableByType('N')
calc.eval(stru)
yref = calc.pdf
diff = y - yref
res = numpy.dot(diff, diff)
self.assertAlmostEquals(0, res)
return