当前位置: 首页>>代码示例>>Python>>正文


Python PDFCalculator.peakprofile方法代码示例

本文整理汇总了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
开发者ID:hjjvandam,项目名称:diffpy.srreal,代码行数:21,代码来源:testpeakprofile.py

示例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()
开发者ID:ahmedpsi,项目名称:cmi_exchange,代码行数:32,代码来源:nirectpdf.py


注:本文中的diffpy.srreal.pdfcalculator.PDFCalculator.peakprofile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。