跳转到主要内容

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

项目描述

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

https://travis-ci.org/vasole/fisx.svg?branch=master https://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-Ray Spectrometry 19 (1990) 145-154

以及以下文献中提到的修正

D.K.G. de Boer et al, X-Ray Spectrometry 22 (1993) 33-28

通过近似实现三级激发的考虑。

这些修正的准确性已通过实验数据和蒙特卡洛模拟进行测试。

许可证

此代码根据LICENSE文件中的详细内容在MIT许可证下发布。

安装

要安装Python库,只需使用 pip install fisx。如果您想从代码源仓库构建Python库,只需使用 pip install . 方法。

测试

安装后运行测试

python -m fisx.tests.testAll

示例

有一个 Web应用 使用此库来计算预期的X射线计数率。

以下Python代码片段显示了如何通过其Python绑定使用此库。

from fisx import Elements
from fisx import Material
from fisx import Detector
from fisx import XRF

elementsInstance = 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 keV
xrf.setBeamFilters([["Al1", 2.72, 0.11, 1.0]]) # Incident beam filters
# Steel composition of Schoonjans et al, 2012 used to generate table I
steel = {"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 thickness
xrf.setGeometry(45., 45.)               # Incident and fluorescent beam angles
detector = Detector("Si1", 2.33, 0.035) # Detector Material, density, thickness
detector.setActiveArea(0.50)            # Area and distance in consistent units
detector.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]]) # Attenuators
fluo = xrf.getMultilayerFluorescence(["Cr K", "Fe K", "Ni K"],
                                     elementsInstance,
                                     secondary=2,
                                     useMassFractions=1)
print("Element   Peak          Energy       Rate      Secondary  Tertiary")
for key in fluo:
    for layer in fluo[key]:
        peakList = list(fluo[key][layer].keys())
        peakList.sort()
        for peak in peakList:
            # energy of the peak
            energy = fluo[key][layer][peak]["energy"]
            # expected measured rate
            rate = 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 excitation
            enhancement2 = (primary + secondary) / primary
            enhancement3 = (primary + secondary + tertiary) / primary
            print("%s   %s    %.4f     %.3g     %.5g    %.5g" % \
                               (key, peak + (13 - len(peak)) * " ", energy,
                               rate, enhancement2, enhancement3))

项目详情


下载文件

下载适合您平台的文件。如果您不确定该选择哪个,请了解有关安装包的更多信息。

源代码分发

fisx-1.3.2.tar.gz (5.7 MB 查看哈希值)

上传时间 源代码

构建分发

fisx-1.3.2-cp312-cp312-win_amd64.whl (6.0 MB 查看哈希值)

上传时间 CPython 3.12 Windows x86-64

fisx-1.3.2-cp312-cp312-macosx_10_9_universal2.whl (6.7 MB 查看哈希值)

上传时间 CPython 3.12 macOS 10.9+ universal2 (ARM64, x86-64)

fisx-1.3.2-cp311-cp311-win_amd64.whl (6.0 MB 查看哈希值)

上传时间 CPython 3.11 Windows x86-64

fisx-1.3.2-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (13.3 MB 查看哈希值)

上传时间 CPython 3.11 manylinux: glibc 2.17+ ppc64le

fisx-1.3.2-cp311-cp311-macosx_10_9_universal2.whl (6.7 MB 查看哈希值)

上传时间 CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64)

fisx-1.3.2-cp310-cp310-win_amd64.whl (6.0 MB 查看哈希值)

上传时间 CPython 3.10 Windows x86-64

fisx-1.3.2-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (13.2 MB 查看哈希值)

上传时间 CPython 3.10 manylinux: glibc 2.17+ ppc64le

fisx-1.3.2-cp310-cp310-macosx_10_9_universal2.whl (6.7 MB 查看哈希值)

上传时间: CPython 3.10 macOS 10.9+ universal2 (ARM64, x86-64)

fisx-1.3.2-cp39-cp39-win_amd64.whl (6.0 MB 查看哈希值)

上传时间: CPython 3.9 Windows x86-64

fisx-1.3.2-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (13.2 MB 查看哈希值)

上传时间: CPython 3.9 manylinux: glibc 2.17+ ppc64le

fisx-1.3.2-cp39-cp39-macosx_10_9_x86_64.whl (6.1 MB 查看哈希值)

上传时间: CPython 3.9 macOS 10.9+ x86-64

fisx-1.3.2-cp39-cp39-macosx_10_9_universal2.whl (6.7 MB 查看哈希值)

上传时间: CPython 3.9 macOS 10.9+ universal2 (ARM64, x86-64)

fisx-1.3.2-cp38-cp38-win_amd64.whl (6.0 MB 查看哈希值)

上传时间: CPython 3.8 Windows x86-64

fisx-1.3.2-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (13.3 MB 查看哈希值)

上传时间: CPython 3.8 manylinux: glibc 2.17+ ppc64le

fisx-1.3.2-cp38-cp38-macosx_11_0_universal2.whl (6.7 MB 查看哈希值)

上传时间: CPython 3.8 macOS 11.0+ universal2 (ARM64, x86-64)

fisx-1.3.2-cp38-cp38-macosx_10_9_x86_64.whl (6.1 MB 查看哈希值)

上传时间: CPython 3.8 macOS 10.9+ x86-64

fisx-1.3.2-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (13.1 MB 查看哈希值)

上传时间: CPython 3.7m manylinux: glibc 2.17+ ppc64le

由以下支持