定量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 Gradle嵌套项目配置   java一些mipmap没有显示   java如何使用按钮设置值以在wicket中输入文本   可分页的java自定义排序参数   java Android AdMob NoSuchMethodError:没有静态方法zzand()   java安卓工作室;启动到USB设备(手机),已安装但无法打开   java如何使用jsoup从HTML解析表   java如何自动生成arraylist?   java定制外观和感觉Nimbus   在Java中使用气泡排序对24位数组进行排序   java我无法将javafx与spring集成   java Play 2.7 http请求post请求   Java哈希表在“put”期间用新密钥覆盖现有密钥   如何找到java更新版本?