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

Uploaded Source

Built Distributions

fisx-1.3.1-cp312-cp312-win_amd64.whl (6.0 MB view details)

Uploaded CPython 3.12 Windows x86-64

fisx-1.3.1-cp312-cp312-macosx_10_9_universal2.whl (6.6 MB view details)

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

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

Uploaded CPython 3.11 Windows x86-64

fisx-1.3.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (13.1 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ppc64le

fisx-1.3.1-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.1-cp310-cp310-win_amd64.whl (5.9 MB view details)

Uploaded CPython 3.10 Windows x86-64

fisx-1.3.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (13.0 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ppc64le

fisx-1.3.1-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.1-cp39-cp39-win_amd64.whl (5.9 MB view details)

Uploaded CPython 3.9 Windows x86-64

fisx-1.3.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (13.0 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ppc64le

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

Uploaded CPython 3.8 Windows x86-64

fisx-1.3.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (13.0 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ppc64le

fisx-1.3.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.3.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.3.1-cp37-cp37m-win_amd64.whl (5.9 MB view details)

Uploaded CPython 3.7m Windows x86-64

fisx-1.3.1-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (12.9 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ ppc64le

fisx-1.3.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.3.1-cp36-cp36m-win_amd64.whl (5.9 MB view details)

Uploaded CPython 3.6m Windows x86-64

fisx-1.3.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.3.1.tar.gz.

File metadata

  • Download URL: fisx-1.3.1.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.1.tar.gz
Algorithm Hash digest
SHA256 483894b3272b6c7d457d193f2a31bd417083fc9035b6965c43fd32223a3f6a4b
MD5 92719ae4ad435dc01fdd805bbcb0f9d0
BLAKE2b-256 25c9a385e952e9d84c760891865d6615f7027ec524f170900c4a84198a3ec762

See more details on using hashes here.

File details

Details for the file fisx-1.3.1-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: fisx-1.3.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 6.0 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for fisx-1.3.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a0ace2ccd2671bf9ffa1adfe46ffa77f628e7fdb5c0fc3933259f972040df0ff
MD5 6d3543bf46ec9bf5e07bea1491f1bb21
BLAKE2b-256 b801c69b644c9ebca5a16da49897a94e1b1edb46358edfaa028dc5dc8b8885f1

See more details on using hashes here.

File details

Details for the file fisx-1.3.1-cp312-cp312-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for fisx-1.3.1-cp312-cp312-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 7e608de3fe53a2df7522ebe743fc9f30e9e5e33ec783435432a53a498baca5ef
MD5 5309cd07c70f3b892fcc4000855aec6a
BLAKE2b-256 519ccff5bf091fa6053988b4973a0636df740e87ef5d04e3951eea658549d7ce

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for fisx-1.3.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 7d4f652a0a69de1dfe3c468d2b086bd130a12118eaf9ab6d6cb5f91403e36fe6
MD5 24aafee27722bca5a98e7ad62881f8ca
BLAKE2b-256 4a72f52b44cec93b455365c07891e5efd10aa4b2987e37c765eda9910e0b946e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.3.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 224e5c9eb0e45bd93423f6c7be63cdfa7fff24798b9c32025ca7f6d9dd1ee891
MD5 17297fe12123f45b0396a0a6bcd850cd
BLAKE2b-256 1dcea852f6816bc53aa75fc9b1d0990d7ce69844853c339c0a271e9859108e0c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.3.1-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 a808639b7a786b76cb157efc735f56b3a8d9c7f36b098fb40069ff6aae5c3cbe
MD5 694de7cdef3e3eb44d840628dd7e24a0
BLAKE2b-256 9ed4869145ae5cbfec2826ba43dd1ebed1beb2f6afdbc966ec417fc92fd14134

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for fisx-1.3.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 0212ced6249da5fee5bfbb45c1d090a2afe4be4b230c3342f4ae6ad40398df5c
MD5 4d1100954be2c6690d0e09ebf3e05d3c
BLAKE2b-256 778d5de1858802dec1af331d36b46a9f407c2d5718fd1e6c09f61e360c43dac3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.3.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 72234c149a6f4209ab4451a45ac8f2ba078558b5aa686c3d778ba85de33b43e9
MD5 2237269748cd7056fff0ea8cffd0d9e7
BLAKE2b-256 84c18d45d7232ce0e6144910148258ec2dee51bafd49e5cb02c2b3b260d58cca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.3.1-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 9187ff5d211f9c0886245fe94fa55d511b84a3dd9b0cc602e74485bfa0edf4ea
MD5 a32e547702da558248bce1f1bd4438e1
BLAKE2b-256 0b7442db93d98dedae376728de8204a41ca1a9da5a9a4ab9ee256ef82db70fcf

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for fisx-1.3.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 2ae60dca9e62618fb120a573582f012d721f14e1c055f39dad9653d9d7a776db
MD5 c544514a5afe3284727907bdc6b3ca4b
BLAKE2b-256 567464903a2a8592fd82e9a134a290d2fa2db1b212ac1629925b228e283f7eb6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.3.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 ec4bb3a0a8fef78762f924faff4e58748be36797c5092f96b5a843f01dd92737
MD5 5343078b50c5edb3064da2c8a64c38de
BLAKE2b-256 4762eba64702577a963ad7030732b4e22f6b84f77d8ead7faf448ca644a5c7e8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.3.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1955a1da240ed3296ac12abf534fb5d39dfd2c633975ca5cc7755560747557ba
MD5 34fe721d4ba1cede4a607b1cbf2f282c
BLAKE2b-256 04b509931c9d4664fa7d44025bc1131dea3d5c22075259b4b449480d7330e0da

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.3.1-cp39-cp39-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 3e3c32cf1f0ef09fd923319608bd02a6c07920c2ff0aa5fbebf2239384855301
MD5 779f93004a98ebd3b219b2fe7457d912
BLAKE2b-256 213d16bf699249519d56b77a98af3dc1926a4aa69197b426ac6b02511240048e

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for fisx-1.3.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 0abc408bd31a024613d31d43d692160d1fcbeaac5646f8489a0df552d5faff7c
MD5 e7d6ca939cdc5b8274003a699664e1de
BLAKE2b-256 3a9062e406f85c1647c06eb7241edecfe668372edaaf9dedb9e89e65f58e2a5a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.3.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 a3009e69d4cf82929a451dd16ffc9ec617a36ad898ce76a8101b5333a6c70423
MD5 8cbdc91a1274f01c99d29aad43276d31
BLAKE2b-256 52f40c8bee92c96cf36386ad9a9c2e422b712f82e8e6119cf349ade2b3d4421e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.3.1-cp38-cp38-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 aefba3329095322b831be51d31e683400f06b2bc8102468af47680244d35080c
MD5 3beaafc2808bdaef9169dc44c3c794f8
BLAKE2b-256 9c02f1ddeb9df29c14616acd64ba19bde2c20b0ad993d9030a27507324f19394

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.3.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 84d59d5476afa2d3fbae4e836f2c19b51736cb26ec18a4f55d40d60ef7869454
MD5 263d5585ebfee0c9292bca74338d9334
BLAKE2b-256 ccfb332b3e9cb2762de648c96d15b111313eef359748480a6fdd03c974526889

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for fisx-1.3.1-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 81e5409d34dc9807cebf12a7dd95207b0a6dc431e1a69d2c7e7b4598024c665f
MD5 fbb88ac7ee456fb8c4d5579a2cd2800d
BLAKE2b-256 8f69d6113e31ce4fffe00f5e3e6c8fdd63e0c83697883eb06b738ca8d1c5d0e7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.3.1-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 53a234f2e21c4aa586378bad1b0504074e9c1ba392ab3ad45c3ecb428ae65281
MD5 211e334cf9d188dfc36d65c9e006f799
BLAKE2b-256 77a3a3623e02dd0385b135a651d7d524955771ef25232cb895e4b720f11f0a9e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.3.1-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3f9b783316679ee37348ac082b81cd78dde006f5fd99bcb8a1c2ea51692453db
MD5 e105b278843230ec30d62dd51ae23b9c
BLAKE2b-256 279bcb84cb60c323407dec4920fd01f0cdc7685cf862a5d735a13f78d7737159

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for fisx-1.3.1-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 b9b61544a6a241546ea9336f3af787cd2836821f7ba4d22423862fa60958c288
MD5 de5720738cb17020de5de2c1f277f91e
BLAKE2b-256 bce831c1803c5b7b6f8aa4efa19df0c66552289945561be38c6272ccd7d44c41

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.3.1-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 06ab83070f73c344c7f901d32972a6ca88678023defca20a02f38ed47772aca4
MD5 2acd70f5c5976d8fe9b15ce5448ad8c7
BLAKE2b-256 ecc99970c275f894f2ff40e2e9749ddf3a5c20cda1130478e225603235375e60

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