定量x射线荧光分析支持库

fisx的Python项目详细描述


主要开发网站:https://github.com/vasole/fisx

https://travis-ci.org/vasole/fisx.svg?branch=masterhttps://ci.appveyor.com/api/projects/status/github/vasole/fisx?branch=master&svg=true

该软件库实现了在给定实验装置的情况下计算预期x射线荧光强度的公式。这个库解释了二次和三次激发,k,l和m壳层发射线和去激发级联效应。基本实现是用C++编写的,提供了Python绑定。

二次励磁的说明通过参考:

D.K.G.de Boer,X射线光谱法19(1990)145-154

更正如下:

D.K.G.de Boer等人,《X射线光谱法》22(1993)33-28

<>第三次激发是通过一个近似来解释的。

通过实验数据和蒙特卡罗模拟验证了修正的准确性。

许可证

此代码在麻省理工学院的许可证下转发,详见许可证文件。

安装

要安装python库,只需使用pip install fisx。如果要从代码源存储库中构建python使用的库,只需使用pip install .python setup.py install方法之一。安装cython>;=0.17很方便(但不是强制性的)。

测试

要在安装后运行测试,请运行:

python -m fisx.tests.testAll

示例

有一个web application正在使用此库计算预期的X射线计数率。

这段python代码展示了如何通过其python绑定使用库。

fromfisximportElementsfromfisximportMaterialfromfisximportDetectorfromfisximportXRFelementsInstance=Elements()elementsInstance.initializeAsPyMca()# After the slow initialization (to be made once), the rest is fairly fast.xrf=XRF()xrf.setBeam(16.0)# set incident beam as a single photon energy of 16 keVxrf.setBeamFilters([["Al1",2.72,0.11,1.0]])# Incident beam filters# Steel composition of Schoonjans et al, 2012 used to generate table Isteel={"C":0.0445,"N":0.04,"Si":0.5093,"P":0.02,"S":0.0175,"V":0.05,"Cr":18.37,"Mn":1.619,"Fe":64.314,# calculated by subtracting the sum of all other elements"Co":0.109,"Ni":12.35,"Cu":0.175,"As":0.010670,"Mo":2.26,"W":0.11,"Pb":0.001}SRM_1155=Material("SRM_1155",1.0,1.0)SRM_1155.setComposition(steel)elementsInstance.addMaterial(SRM_1155)xrf.setSample([["SRM_1155",1.0,1.0]])# Sample, density and thicknessxrf.setGeometry(45.,45.)# Incident and fluorescent beam anglesdetector=Detector("Si1",2.33,0.035)# Detector Material, density, thicknessdetector.setActiveArea(0.50)# Area and distance in consistent unitsdetector.setDistance(2.1)# expected cm2 and cm.xrf.setDetector(detector)Air=Material("Air",0.0012048,1.0)Air.setCompositionFromLists(["C1","N1","O1","Ar1","Kr1"],[0.0012048,0.75527,0.23178,0.012827,3.2e-06])elementsInstance.addMaterial(Air)xrf.setAttenuators([["Air",0.0012048,5.0,1.0],["Be1",1.848,0.002,1.0]])# Attenuatorsfluo=xrf.getMultilayerFluorescence(["Cr K","Fe K","Ni K"],elementsInstance,secondary=2,useMassFractions=1)print("Element   Peak          Energy       Rate      Secondary  Tertiary")forkeyinfluo:forlayerinfluo[key]:peakList=list(fluo[key][layer].keys())peakList.sort()forpeakinpeakList:# energy of the peakenergy=fluo[key][layer][peak]["energy"]# expected measured raterate=fluo[key][layer][peak]["rate"]# primary photons (no attenuation and no detector considered)primary=fluo[key][layer][peak]["primary"]# secondary photons (no attenuation and no detector considered)secondary=fluo[key][layer][peak]["secondary"]# tertiary photons (no attenuation and no detector considered)tertiary=fluo[key][layer][peak].get("tertiary",0.0)# correction due to secondary excitationenhancement2=(primary+secondary)/primaryenhancement3=(primary+secondary+tertiary)/primaryprint("%s%s%.4f%.3g%.5g%.5g"% \
                               (key,peak+(13-len(peak))*" ",energy,rate,enhancement2,enhancement3))

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
Java Websocket在对同一socket发出下一个请求之前等待响应   java对图像CameraPreview图像提要应用过滤器   java Appium如何在iOS设备上设置地理位置?   java无法通过报表中的超链接发送请求参数   java Spring@ConfigurationProperties解析器忽略外部化属性   java如何调用nvcc打开。cu文件没有委托给其他编译器?   java当javadoc未附加到依赖项时,如何在Maven的eclipse插件中将javadoc引用到依赖项   java如何禁用Hibernate的集合缓存   java字符串反向操作最佳时间复杂度:是O(n)还是O(n/2)?   java无法读取InputStream   java如何关闭被锁定在无限循环中的socket?   asynctask刷新后尝试访问适配器时出现java nullPointer异常   SwingJava:等待输入并在JFrames之间传输信息   java我不理解这个ThreadPoolExecutor行为   java使用JOOQ,如何将SQLException映射到业务异常?   java“无法将IntentReceiver解析为类型”。为什么?   在Eclipse中运行RSE java项目   筛选如何将映射添加到Java流的foreach中   JTabbedPane的java MouseeEvent   java面向对象语言和非面向对象语言之间有什么区别?