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.

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.1.7.tar.gz (5.7 MB view details)

Uploaded Source

Built Distributions

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

Uploaded CPython 3.8m Windows x86-64

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8 macOS 10.9+ x86-64

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

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m macOS 10.9+ x86-64

fisx-1.1.7-cp37-cp37m-macosx_10_6_intel.whl (6.5 MB view details)

Uploaded CPython 3.7m macOS 10.6+ intel

fisx-1.1.7-cp36-cp36m-win_amd64.whl (6.0 MB view details)

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m macOS 10.9+ x86-64

fisx-1.1.7-cp36-cp36m-macosx_10_6_intel.whl (6.6 MB view details)

Uploaded CPython 3.6m macOS 10.6+ intel

fisx-1.1.7-cp27-cp27m-win_amd64.whl (6.0 MB view details)

Uploaded CPython 2.7m Windows x86-64

fisx-1.1.7-cp27-cp27m-macosx_10_6_intel.whl (6.5 MB view details)

Uploaded CPython 2.7m macOS 10.6+ intel

File details

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

File metadata

  • Download URL: fisx-1.1.7.tar.gz
  • Upload date:
  • Size: 5.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.13.0 setuptools/40.2.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.4

File hashes

Hashes for fisx-1.1.7.tar.gz
Algorithm Hash digest
SHA256 5e065912e2b88f212c211bb3a98ee33364f943076cbb577007f1782b73f90720
MD5 0789214187fcaa28bdd001c4ad97169f
BLAKE2b-256 3af13fc083092693d12938b2ac61d3249eb2c9d809a046481d882d2cf66dd64e

See more details on using hashes here.

File details

Details for the file fisx-1.1.7-cp38-cp38m-win_amd64.whl.

File metadata

  • Download URL: fisx-1.1.7-cp38-cp38m-win_amd64.whl
  • Upload date:
  • Size: 5.9 MB
  • Tags: CPython 3.8m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.13.0 setuptools/40.2.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.4

File hashes

Hashes for fisx-1.1.7-cp38-cp38m-win_amd64.whl
Algorithm Hash digest
SHA256 d539720d6b74b2235caf5487c91e5a4a757a7feb047901250106790a7fe2fa39
MD5 ef8e90e56984561c0ff796de9e2ed3ad
BLAKE2b-256 bdffc71285d076683d6e187669e025981e91604cd942bf7af72d4b60b89d84f0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fisx-1.1.7-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/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.8.0

File hashes

Hashes for fisx-1.1.7-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 fec72fa1dd7c0596df655435944de2c5f89e69d4b2a4f39ba4c9c7d52c947430
MD5 c604c9b8975f866a3aa1383508df5f9d
BLAKE2b-256 58d8e2968668b8a02ee658a799acaf8366c6525dbced8b7d44c654fc04818592

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fisx-1.1.7-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 6.0 MB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.8.0

File hashes

Hashes for fisx-1.1.7-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c16e0ddc0314df1dfe505a3a54b0dab1c679bd1f5b4654ef0ea73f1a37e1f3f0
MD5 e786eac8c200b584c58aad184ec2dce6
BLAKE2b-256 2d8dc264f4b5829967b0707077839ca37cb03a7a5fc9fd0f7af88e8a1e601e04

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fisx-1.1.7-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/1.13.0 pkginfo/1.5.0.1 requests/2.13.0 setuptools/40.2.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.4

File hashes

Hashes for fisx-1.1.7-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 08a235dcccf4540569d9cf1e4245f43b19b8c463aacca0e25a83490b6a8bc3b0
MD5 954fe828033a6608e4e464b7a8fd6643
BLAKE2b-256 df098d8329174f4daca29688893d4c56a74db155573236a1963a7121b2f7731c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fisx-1.1.7-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 6.0 MB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.13.0 setuptools/40.2.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.4

File hashes

Hashes for fisx-1.1.7-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b63d321993e5341c0669f8ff967f48f3606b2758f5214598ea32ff41e4c7c5e8
MD5 1cdcd86626992f312e96a91f267eda38
BLAKE2b-256 16947752a886e5c7f45e62441ec07ff4af51f6982c4e06bacb91742e91bf6f24

See more details on using hashes here.

File details

Details for the file fisx-1.1.7-cp37-cp37m-macosx_10_6_intel.whl.

File metadata

  • Download URL: fisx-1.1.7-cp37-cp37m-macosx_10_6_intel.whl
  • Upload date:
  • Size: 6.5 MB
  • Tags: CPython 3.7m, macOS 10.6+ intel
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.13.0 setuptools/40.2.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.4

File hashes

Hashes for fisx-1.1.7-cp37-cp37m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 abf83aa34a35718f51546643f9aa7c38828d6a79e5ea22f10960e489ea9958bf
MD5 036b912c63ed1d5f2bfe31b3c1e58bed
BLAKE2b-256 97b00e18195bf35d23e8f035c25b64a294689e5f2427416b0fd126e01d5dca72

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fisx-1.1.7-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 6.0 MB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.13.0 setuptools/40.2.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.4

File hashes

Hashes for fisx-1.1.7-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 054bd523d33c28740c96e35f2866cd07322ae4518b16dfb3f3d68763521a0ba6
MD5 6805047d3db3e92cf92ce55e273d1bc7
BLAKE2b-256 ecc833d019e8e489a30a4bde47db301702e8028cbc47d91e86d343075636dd9b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fisx-1.1.7-cp36-cp36m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 6.0 MB
  • Tags: CPython 3.6m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.13.0 setuptools/40.2.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.4

File hashes

Hashes for fisx-1.1.7-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 15a92d25a412b741cd0109599e9028bffe2d2507154399d68396cca844cd43a7
MD5 5329789762040964d3e0c875a5888551
BLAKE2b-256 cada167b31b84abf66bf19e3b1d3c666a4991213962a32b00d5448b0a5a859d6

See more details on using hashes here.

File details

Details for the file fisx-1.1.7-cp36-cp36m-macosx_10_6_intel.whl.

File metadata

  • Download URL: fisx-1.1.7-cp36-cp36m-macosx_10_6_intel.whl
  • Upload date:
  • Size: 6.6 MB
  • Tags: CPython 3.6m, macOS 10.6+ intel
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.13.0 setuptools/40.2.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.4

File hashes

Hashes for fisx-1.1.7-cp36-cp36m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 386a4c1d55d9e3c4d4daa88118017c0737d63695439c000bfcb5331e4337b5c3
MD5 00fa4009404bf6449b05293a9ad2ab40
BLAKE2b-256 dd58882e25ef5df6822f684618f5a0f382df0ba10b82e0af52c76a19dc071504

See more details on using hashes here.

File details

Details for the file fisx-1.1.7-cp27-cp27m-win_amd64.whl.

File metadata

  • Download URL: fisx-1.1.7-cp27-cp27m-win_amd64.whl
  • Upload date:
  • Size: 6.0 MB
  • Tags: CPython 2.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.10.0 setuptools/20.10.1 requests-toolbelt/0.8.0 tqdm/4.21.0 CPython/2.7.12

File hashes

Hashes for fisx-1.1.7-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 0f2682029f5e6223ccec6a3fc06611e59d8b1d5c0ccf85fd965e108e703e5e81
MD5 73d306015a78ef90a8bd31891a3231c9
BLAKE2b-256 c18439555fa81318da8ecb6cf8043263f576111ff31a919e676dde5b83963184

See more details on using hashes here.

File details

Details for the file fisx-1.1.7-cp27-cp27m-macosx_10_6_intel.whl.

File metadata

  • Download URL: fisx-1.1.7-cp27-cp27m-macosx_10_6_intel.whl
  • Upload date:
  • Size: 6.5 MB
  • Tags: CPython 2.7m, macOS 10.6+ intel
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.13.0 setuptools/40.2.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.4

File hashes

Hashes for fisx-1.1.7-cp27-cp27m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 6699c4333ef2b04956ae357d5e92656b5394ec6af067938567b42d9f138c0b01
MD5 fe4f8a3f042d38e25b8acedd2087dc29
BLAKE2b-256 dc548baab9020bb0bf9db91ba10fbe08e28a1f424b3417aceef6aabe6f689fa4

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