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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.11 Windows x86-64

fisx-1.3.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (12.9 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ppc64le

fisx-1.3.0-cp311-cp311-macosx_10_9_universal2.whl (6.5 MB view details)

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

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

Uploaded CPython 3.10 Windows x86-64

fisx-1.3.0-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (12.9 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ppc64le

fisx-1.3.0-cp310-cp310-macosx_10_9_universal2.whl (6.5 MB view details)

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

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

Uploaded CPython 3.9 Windows x86-64

fisx-1.3.0-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (12.9 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ppc64le

fisx-1.3.0-cp39-cp39-macosx_10_9_x86_64.whl (6.0 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

fisx-1.3.0-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.3.0-cp38-cp38-win_amd64.whl (5.9 MB view details)

Uploaded CPython 3.8 Windows x86-64

fisx-1.3.0-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (12.9 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ppc64le

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

Uploaded CPython 3.8 macOS 10.9+ x86-64

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

Uploaded CPython 3.7m Windows x86-64

fisx-1.3.0-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (12.8 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ ppc64le

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

Uploaded CPython 3.7m macOS 10.9+ x86-64

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

Uploaded CPython 3.6m Windows x86-64

fisx-1.3.0-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.3.0.tar.gz.

File metadata

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

File hashes

Hashes for fisx-1.3.0.tar.gz
Algorithm Hash digest
SHA256 364fe0a2e96f29b281da58e5b419cde041f33cc327b90091b8dab372e3225dcf
MD5 a5e67497fa93826be2e364fe53a9c6ac
BLAKE2b-256 7c4b88712a6f57e4f7e40c9c3595405159ace33513bba477c0e76004513d8217

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fisx-1.3.0-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.10

File hashes

Hashes for fisx-1.3.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 2ab101e32ce2adebd89d2c080b392f8253d9fc9423f8a73ed475ae774b9d6952
MD5 3c9ea1353df87bca542ea3aa8afd3806
BLAKE2b-256 902d4366f0e63bee4c1792ec3c1fab99b501fedb7d3a0fda22bde9b42044c71f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.3.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 e1eac033d1f524c81f2777c9646ca4d45258b3d1c9d50277ee68a85d1f3623d9
MD5 640f100ed59b52999c28da7453c95b5b
BLAKE2b-256 35e1fca85b5944b69a440a1e0fc5868c658abe4918534110de83e2c6a2cbedcf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.3.0-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 ee88fac1d191bb66396c492217884dc5513e7ff499138e0d15d1535447dba596
MD5 bf14b35ebf00681e882a6cb2aef30ec9
BLAKE2b-256 05f6805355c1e1a3efc1a11ea3e0c136d3030090f75e38d046be3032f3cff536

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fisx-1.3.0-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.10

File hashes

Hashes for fisx-1.3.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 4d2f5ac90373a57202b6e6cbd265e90780b4090314bc4dbaa50f435933d71e30
MD5 08e1b201ae3e68f2d8f7953762f9173a
BLAKE2b-256 83edd2eecbd2ffa2c436384f2bad169a9aca8c8504f79d8d075d977607af0945

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.3.0-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 770dcc075523f026d7f2b86a3c8d9e99206aa0d2661a29962b880d3be1db62ad
MD5 2599dabb54e67714120d18bd32f5a8da
BLAKE2b-256 7eb1622c416ecbe9859b09cda1551d5295e4a78b5777789b0034218bc3294cf1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.3.0-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 ed78bde6ca1543571cd5662c3b5c07b4624dc8e6ff7789bedd4ffea28c72731a
MD5 74cd07395ce4ddf9f77a9ad93909748d
BLAKE2b-256 00acd2953c9bcc5bd8ed591bd91d1b49a4ef2a114a138fecf1aa5a89f95c1904

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fisx-1.3.0-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.10

File hashes

Hashes for fisx-1.3.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 8ea56576d7796ed13d3c55ca54f687c889999dbd774aa2093f855af2a3dc28c2
MD5 1fdcdbe4f57e10d4b526d126f73364cf
BLAKE2b-256 b4ed64528ef1dbe266a4a4363fa7ec59a5570a55576e847ce873eff7cea6b946

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.3.0-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 620d09d6b9617a1b2a2a1e9ce7d2774d7cdcc535272352a99fdbe4ec3963a4e6
MD5 3c05148b5075fa955641b6806f8e2ccf
BLAKE2b-256 57f378558185f6c393aff5a672ed183cb28e5892817abce27279940002d4295d

See more details on using hashes here.

File details

Details for the file fisx-1.3.0-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for fisx-1.3.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 670ec404ff7e2cf85535be9957d3c697e527b524d9356eb1f474284684e40fb4
MD5 065527148ed99e8dc98a978176a5ba9e
BLAKE2b-256 b52b55c97f3014cb92f6d2b0cdb710c9fe7be8bb50f1c72c7279d2218955d3f3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.3.0-cp39-cp39-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 ebc11ccda79bc054a1447e609976504bee3ed14bd74a60c6432b59191e2b8f03
MD5 d463869a5507eccd81ac261f4d9c4201
BLAKE2b-256 8b909004d808e2c4a11050fc235af5045d13e0127b93f2b57485341cc1c843c5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fisx-1.3.0-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.10

File hashes

Hashes for fisx-1.3.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 ba38c73b07b2d58a0fee88154424314c5b3f61a0c0fc86648c1d9bfad68e0046
MD5 b80509d32fa538db5fbca6c74b1ec4bb
BLAKE2b-256 55ae08fd1b7118e5f47728f84a0bf6078c41a2f312e5d4684d44c724c69c8662

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.3.0-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 f9c67ae5adf6bd7d0c999b3fca006d6bdbd77dd3434e9d32b31b2ac0ca25b1d8
MD5 655bfe9208488827e0797e4e2d764d1f
BLAKE2b-256 63d0301414938b97af0ebdff79cac5005804ca080d441a4d2318fa6b1da194d8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.3.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8ea8e8477fa819d61fb2ae5f227228cef805fda2c811de3d6aee04048e307542
MD5 31ee297598ca9af980e2b146d8f97f51
BLAKE2b-256 17efac65b55677e0890bfb4efd7c335d8cbb76685e6669b53e5a1f08f27b7f9a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fisx-1.3.0-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.10

File hashes

Hashes for fisx-1.3.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 613b9921c38c19dc9b8bafb053d67c709bf6e51f546a2626efdf6de3973e5c6e
MD5 ef6f4a8ece4b711c132740c81e8df9f1
BLAKE2b-256 6bcff920e997fa7a0fe4ab7aec7cd1dd5d5d2476311284dd92d7ede463860047

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.3.0-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 de689cc84375068b79e2e7e6c60b7c2240fda1e907869a5c9768942f1ab10387
MD5 bf5a0de5a421bee5a7e34a5303914226
BLAKE2b-256 a2e4b4b21844f24fef12b4a40b73724b2b38098193cd81a12d85e5b51187ce57

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.3.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 dd194de06587ba12b05ecc764271067cc9d6647ff29a5e15419c234128a8029f
MD5 d67902a802aed7e1a06ca2b18f305490
BLAKE2b-256 35c5f9c6e084dc95af3aaa0ae4c016670e795bc731f7f0a32efd1298888fe49b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fisx-1.3.0-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.10

File hashes

Hashes for fisx-1.3.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 7300d85644d80f4f8ac4c5b5e0f2e30f79f97a0d5210c6fc9c476c7c0e5f8d07
MD5 f09eba5164b3ddf83747a8087dffa5e4
BLAKE2b-256 d9b55082624f8fc02a2c6d66befe8106cfba61ff903c51333a653c001a070089

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.3.0-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d78880594d5d3b3c9147d221b341dbe250fa9b6a0200a47c87c800e72f99f146
MD5 4b89523ce65d4863dbd00e42ec00eeaa
BLAKE2b-256 9982bac6168cad00c316efaea5416b0c1bdffad333a7c2470a8d5b950e26cc58

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