本文整理匯總了Python中diffpy.srreal.pdfcalculator.PDFCalculator.peakprofile方法的典型用法代碼示例。如果您正苦於以下問題:Python PDFCalculator.peakprofile方法的具體用法?Python PDFCalculator.peakprofile怎麽用?Python PDFCalculator.peakprofile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類diffpy.srreal.pdfcalculator.PDFCalculator
的用法示例。
在下文中一共展示了PDFCalculator.peakprofile方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_ticker_override
# 需要導入模塊: from diffpy.srreal.pdfcalculator import PDFCalculator [as 別名]
# 或者: from diffpy.srreal.pdfcalculator.PDFCalculator import peakprofile [as 別名]
def test_ticker_override(self):
"""check method override for PeakProfile.ticker in a derived class.
"""
pkf = MySawTooth()
self.assertEqual(0, pkf.tcnt)
et0 = pkf.ticker()
self.assertEqual(1, pkf.tcnt)
et1 = PeakProfile.ticker(pkf)
self.assertEqual(1, pkf.tcnt)
self.assertEqual(et0, et1)
et0.click()
self.assertEqual(et0, et1)
# check that implicit ticker call from PDFCalculator is
# handled by the Python ticker override.
pc = PDFCalculator()
pc.peakprofile = pkf
pc.ticker()
self.assertEqual(2, pkf.tcnt)
return
示例2: loadStructure
# 需要導入模塊: from diffpy.srreal.pdfcalculator import PDFCalculator [as 別名]
# 或者: from diffpy.srreal.pdfcalculator.PDFCalculator import peakprofile [as 別名]
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from matplotlib.pyplot import *
from diffpy.Structure import loadStructure
from diffpy.srreal.pdfcalculator import PDFCalculator
from rectangleprofile import RectangleProfile
ni = loadStructure('ni.cif')
# The CIF file had no displacement data so we supply them here:
ni.Uisoequiv = 0.005
# Calculate PDF with default profile function
pc1 = PDFCalculator()
r1, g1 = pc1(ni)
print "standard peakprofile:\n " + repr(pc1.peakprofile)
# Create new calculator that uses the custom profile function
pc2 = PDFCalculator()
pc2.peakprofile = RectangleProfile()
# Note: pc2.peakprofile = 'rectangleprofile'
# would do the same, because RectangleProfile class was registered
# under its 'rectangleprofile' identifier.
print "custom peakprofile:\n " + repr(pc1.peakprofile)
r2, g2 = pc2(ni)
# compare both simulated curves
plot(r1, g1, r2, g2)
draw()
show()