Skip to main content

Quantitative X-Ray Fluorescence Analysis Support Library

Project description

Main development website: 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

This software library implements formulas to calculate, given an experimental setup, the expected x-ray fluorescence intensities. The library accounts for secondary and tertiary excitation, K, L and M shell emission lines and de-excitation cascade effects. The basic implementation is written in C++ and a Python binding is provided.

Account for secondary excitation is made via the reference:

D.K.G. de Boer, X-Ray Spectrometry 19 (1990) 145-154

with the correction mentioned in:

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

Tertiary excitation is accounted for via an appproximation.

The accuracy of the corrections has been tested against experimental data and Monte Carlo simulations.

License

This code is relased under the MIT license as detailed in the LICENSE file.

Installation

To install the library for Python just use pip install fisx. If you want build the library for python use from the code source repository, just use one of the pip install . or the python setup.py install approaches. It is convenient (but not mandatory) to have cython >= 0.17 installed for it.

Testing

To run the tests after installation run:

python -m fisx.tests.testAll

Example

There is a web application using this library for calculating expected x-ray count rates.

Basic Doxygen documentation of the underlying C++ library is available.

This piece of Python code shows how the library can be used via its python binding.

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))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fisx-1.2.1.tar.gz (6.0 MB view details)

Uploaded Source

Built Distributions

fisx-1.2.1-cp311-cp311-win_amd64.whl (5.9 MB view details)

Uploaded CPython 3.11 Windows x86-64

fisx-1.2.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (12.7 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ppc64le

fisx-1.2.1-cp311-cp311-macosx_10_9_universal2.whl (6.4 MB view details)

Uploaded CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64)

fisx-1.2.1-cp310-cp310-win_amd64.whl (5.9 MB view details)

Uploaded CPython 3.10 Windows x86-64

fisx-1.2.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (12.7 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ppc64le

fisx-1.2.1-cp310-cp310-macosx_10_9_universal2.whl (6.4 MB view details)

Uploaded CPython 3.10 macOS 10.9+ universal2 (ARM64, x86-64)

fisx-1.2.1-cp39-cp39-win_amd64.whl (5.9 MB view details)

Uploaded CPython 3.9 Windows x86-64

fisx-1.2.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (12.7 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ppc64le

fisx-1.2.1-cp39-cp39-macosx_10_9_universal2.whl (6.5 MB view details)

Uploaded CPython 3.9 macOS 10.9+ universal2 (ARM64, x86-64)

fisx-1.2.1-cp38-cp38-win_amd64.whl (5.9 MB view details)

Uploaded CPython 3.8 Windows x86-64

fisx-1.2.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (12.7 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ppc64le

fisx-1.2.1-cp38-cp38-macosx_11_0_universal2.whl (6.5 MB view details)

Uploaded CPython 3.8 macOS 11.0+ universal2 (ARM64, x86-64)

fisx-1.2.1-cp38-cp38-macosx_10_9_x86_64.whl (6.0 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

fisx-1.2.1-cp37-cp37m-win_amd64.whl (5.9 MB view details)

Uploaded CPython 3.7m Windows x86-64

fisx-1.2.1-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (12.6 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ ppc64le

fisx-1.2.1-cp37-cp37m-macosx_10_9_x86_64.whl (6.0 MB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

fisx-1.2.1-cp36-cp36m-win_amd64.whl (5.9 MB view details)

Uploaded CPython 3.6m Windows x86-64

fisx-1.2.1-cp36-cp36m-macosx_10_9_x86_64.whl (6.0 MB view details)

Uploaded CPython 3.6m macOS 10.9+ x86-64

File details

Details for the file fisx-1.2.1.tar.gz.

File metadata

  • Download URL: fisx-1.2.1.tar.gz
  • Upload date:
  • Size: 6.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.1

File hashes

Hashes for fisx-1.2.1.tar.gz
Algorithm Hash digest
SHA256 384a9abaf883a15273cebd8ba9195543a06e3ad60c4d02cd7dd84da2e9822ba9
MD5 7cb1c4454816bf03c55a3d85f5780452
BLAKE2b-256 d9db164fc6fad0bad203e9dffb16b2922ca93379b4cbc424f5b5c00b3a70e901

See more details on using hashes here.

File details

Details for the file fisx-1.2.1-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: fisx-1.2.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 5.9 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.1

File hashes

Hashes for fisx-1.2.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a7527e91655d9ea02f7cec4c17d0ef3cc266bccdbdc7a51be0ac6a6872d03fd4
MD5 960bd8dc778de4bcbcdabdb7da99f1d0
BLAKE2b-256 50c72bbdc4b78d22757ec79b113b323349bfcf9e5bcc901a5b058fd447bc1a80

See more details on using hashes here.

File details

Details for the file fisx-1.2.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for fisx-1.2.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 39d182e1dca311472e10700415bdb02acd84c738bf7258cdd05dc4aa1b3a3f08
MD5 a2360ccd432fa51c5cd94cd94ca33137
BLAKE2b-256 a1789e1a8bbd7f6ecd087e5f596ac0766cf623c862eeb42354803544939078c8

See more details on using hashes here.

File details

Details for the file fisx-1.2.1-cp311-cp311-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for fisx-1.2.1-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 6f869e0321c2802ab7bb6100212ae7d65e5692a054b448d82db147a00b3a548c
MD5 5590d244e9378d942ee76e07ba6d45a9
BLAKE2b-256 0575c4154d96384a0beea77a52b84266907925372a806f13b11c50510583cc62

See more details on using hashes here.

File details

Details for the file fisx-1.2.1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: fisx-1.2.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 5.9 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.1

File hashes

Hashes for fisx-1.2.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 bc37943b692388b71cffd5c1f9ab134be50ed29d4702a04d50e5e7ea6df500c5
MD5 7274fe648ce5f04bcb88da6ffc230883
BLAKE2b-256 03be17ad6533bbb9ac08836fea6f4df72e0f93c18719badd596c826f4bf909b2

See more details on using hashes here.

File details

Details for the file fisx-1.2.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for fisx-1.2.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 9025f8704092451584d33e898fe2fce576842ca98c74c379a258a4c6142308a0
MD5 8326d1776d890240707af2050dbfa8f5
BLAKE2b-256 0cf62f39a5d02a8142ab0de9cef5a676e35e1d45ed78f899178a3e5a01846988

See more details on using hashes here.

File details

Details for the file fisx-1.2.1-cp310-cp310-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for fisx-1.2.1-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 b7bd79c1dcb12864ca9bbf16dad473929650092eee75ea06d389463b05d3f194
MD5 e07e95ee69b87e88f4aa609e7c331bf1
BLAKE2b-256 123681261c9f13f3478b38bc7c310a44619f34bf1f8412e904d8d9b18828f292

See more details on using hashes here.

File details

Details for the file fisx-1.2.1-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: fisx-1.2.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 5.9 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.1

File hashes

Hashes for fisx-1.2.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 93f23feb4880a6439f3ae326d12351fc1f43767e2f7ba911a8465356388b1c97
MD5 c88e095d86457bd65f09e7915f26b2a9
BLAKE2b-256 83427c9872fcd49455014361e8a89337d640069e4f6ed861b879b00677a57a87

See more details on using hashes here.

File details

Details for the file fisx-1.2.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for fisx-1.2.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 8722086ce2d8c39424fa804d00fefd22606550633d9b7d59bed7c840cf02c64a
MD5 62144c27723bbae8a32bb59541fb9449
BLAKE2b-256 3478a576f475cacae3639388de310965a1c1865ac98eac58efe9691827c77ad4

See more details on using hashes here.

File details

Details for the file fisx-1.2.1-cp39-cp39-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for fisx-1.2.1-cp39-cp39-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 b6ddaef5faff90601cbf5fb781534ac4bbbb71c13a8e8a4dd78439ddd1bc0ebe
MD5 cbdb78afef9aeb5ace7fec94560a3c07
BLAKE2b-256 2155b745ba929acaff64d2479394ccaca33af703b363493490a3fa60f4495871

See more details on using hashes here.

File details

Details for the file fisx-1.2.1-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: fisx-1.2.1-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 5.9 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.1

File hashes

Hashes for fisx-1.2.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 226e935b609bf9036e94d852e39f5612d09031e6e86d52858366f50966243962
MD5 0e590e73e8d70a298dad3e681dd3717f
BLAKE2b-256 9f81883bbfedc226f9f0289126d9019c05f49bd0c9f062614efcf4dbedf69643

See more details on using hashes here.

File details

Details for the file fisx-1.2.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for fisx-1.2.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 9d5b4b9985061c22a52ef880a38eeb12795e19417c4ffbdabc3a2dfa7ab645b8
MD5 3ff80bcda3fd2812e9c040a5cb8b5a8e
BLAKE2b-256 5bcbc53903db37042f46bcf785d1b9f411efcc8cbc62927ad664baeec33a69cf

See more details on using hashes here.

File details

Details for the file fisx-1.2.1-cp38-cp38-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for fisx-1.2.1-cp38-cp38-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 e79b2fe286d58ff37800621e6f20e9f21b7bf57e6a7130b146bc2ce4c947781a
MD5 ae8603d2cc9d8935bf53f1083276d0ca
BLAKE2b-256 03be67cecdd9be17ac3ef39fd4136df115e1c28f80e81bf038edbff368a9be99

See more details on using hashes here.

File details

Details for the file fisx-1.2.1-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for fisx-1.2.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c5c85b8fd400ffdb8331f1ebc150ed79bcdc35ab82cbafa34b7c544d4b2d48a8
MD5 bc34db4c1823b2a97b56b61ace1b1f30
BLAKE2b-256 4a468a1ca91882f64c767710c1e263f34133344a0abd0f1c9873cc3d3d4043cd

See more details on using hashes here.

File details

Details for the file fisx-1.2.1-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: fisx-1.2.1-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 5.9 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.1

File hashes

Hashes for fisx-1.2.1-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 16c638640d029d2f0da644815ac8f74bc9192d64b8babfe0c599bbb5e5e334ae
MD5 551fbf65816afb120d0ca2eb8bb5b354
BLAKE2b-256 c59a024899840e647e727caf344f3197cd514be8d3e9478cc17c735810a2894d

See more details on using hashes here.

File details

Details for the file fisx-1.2.1-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for fisx-1.2.1-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 f6c2aff367fc29e9b507ac3263f340340c3f0d6ce1a970f51f1faec911fb3761
MD5 d9b421d0b7665ad960f29dcc191c53ec
BLAKE2b-256 ba2e9f3e8d9cf894866536777bb76ed85f2cc5bd819cf47a3806ec7d8efab6c4

See more details on using hashes here.

File details

Details for the file fisx-1.2.1-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for fisx-1.2.1-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b9e7d83a89c29b104a11984b0072069152eb5d190eca89f24a5275205d05a0d3
MD5 fbce13740336ffae76130e09907aaebf
BLAKE2b-256 9bce4bd125e0a8ee2de73e025c07902775489de8fe3afcad500f0005301e0e46

See more details on using hashes here.

File details

Details for the file fisx-1.2.1-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: fisx-1.2.1-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 5.9 MB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.1

File hashes

Hashes for fisx-1.2.1-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 ca1eea5baa64c697ab097f31cc24bae829d1dd1b3fc190c1ba5c3f774086e958
MD5 4ea2293db2486f413208d940270b4f1d
BLAKE2b-256 5c1c59a67e2309b18a0170ffe4c5aa61ca061a5d465db140dbba690b0f6dd86c

See more details on using hashes here.

File details

Details for the file fisx-1.2.1-cp36-cp36m-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for fisx-1.2.1-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 98276007047a729ea7978f943e7f9b4e80c41b16100e805e7912f95d6c8cef70
MD5 b6dc50dbdb858c5467c9f9c9b2f72330
BLAKE2b-256 0453fe8fca0fb4ba4acfef0033f427a387e6d05471e7b0985235bdd2c53664f5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page