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 the pip install . approach.

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

Uploaded Source

Built Distributions

fisx-1.3.2-cp313-cp313-win_amd64.whl (6.0 MB view details)

Uploaded CPython 3.13 Windows x86-64

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

Uploaded CPython 3.12 Windows x86-64

fisx-1.3.2-cp312-cp312-macosx_10_9_universal2.whl (6.7 MB view details)

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

fisx-1.3.2-cp311-cp311-win_amd64.whl (6.0 MB view details)

Uploaded CPython 3.11 Windows x86-64

fisx-1.3.2-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (13.3 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ppc64le

fisx-1.3.2-cp311-cp311-macosx_10_9_universal2.whl (6.7 MB view details)

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

fisx-1.3.2-cp310-cp310-win_amd64.whl (6.0 MB view details)

Uploaded CPython 3.10 Windows x86-64

fisx-1.3.2-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (13.2 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ppc64le

fisx-1.3.2-cp310-cp310-macosx_10_9_universal2.whl (6.7 MB view details)

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

fisx-1.3.2-cp39-cp39-win_amd64.whl (6.0 MB view details)

Uploaded CPython 3.9 Windows x86-64

fisx-1.3.2-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (13.2 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ppc64le

fisx-1.3.2-cp39-cp39-macosx_10_9_x86_64.whl (6.1 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

fisx-1.3.2-cp39-cp39-macosx_10_9_universal2.whl (6.7 MB view details)

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

fisx-1.3.2-cp38-cp38-win_amd64.whl (6.0 MB view details)

Uploaded CPython 3.8 Windows x86-64

fisx-1.3.2-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (13.3 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ppc64le

fisx-1.3.2-cp38-cp38-macosx_11_0_universal2.whl (6.7 MB view details)

Uploaded 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 view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

fisx-1.3.2-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (13.1 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ ppc64le

File details

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

File metadata

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

File hashes

Hashes for fisx-1.3.2.tar.gz
Algorithm Hash digest
SHA256 3c818b016b69bb50476bd246ab14cf06e8e3653114c2f2524dce11d6bc070e9a
MD5 01cb65c609166bf1129f29ec49588a9b
BLAKE2b-256 d09769d465bc0095876d4c43ba63e0b208ced8f5b9471d3df4e857e010f5336c

See more details on using hashes here.

File details

Details for the file fisx-1.3.2-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: fisx-1.3.2-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 6.0 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.0

File hashes

Hashes for fisx-1.3.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 1e9d8ab4498c160cab18a39f97b5759c6a18b509deea9bb3872c19d64717da91
MD5 9e54f8561b865ec2316ce6c3e8ac5c32
BLAKE2b-256 52c41fd3def6667af52e846f1114298f5e4bb3fe095f48a8ec68c025b067cc82

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fisx-1.3.2-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/5.1.0 CPython/3.12.3

File hashes

Hashes for fisx-1.3.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 51d46390627a13005860e3df85d35cb74bf9506e8d376492de4d2a87fa5b9b42
MD5 97fbb5b634083e320e6e38df17688eaf
BLAKE2b-256 b078f3027f37df4995457654ad1b861a348d7037a9bd86fa8d7fe0408a256762

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.3.2-cp312-cp312-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 78e0243e3bfd7fbcf8de21facfab09dde68e0050bd1890672af79de5b0cfdd0a
MD5 fb1a6db99ae4f4759560d57c9f3dde1e
BLAKE2b-256 fad59b35feb0eb211949d5dc565b7cf46502de35458ad9908271c7202779fef7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fisx-1.3.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 6.0 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for fisx-1.3.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 423b879e265ef98cd3fd229d42d964353ef8eadff0a0b29c9e1fda404cbfc606
MD5 ce4dcf7946cb28bcf084f4dbd288b446
BLAKE2b-256 0953ba252aae812c9b3e0aa0a308a8cc2d9926c4208485f8a9008349367c309d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.3.2-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 d3a702d28da7737a8dd337ab3c467f95fdd4aef394af629bc72cd381a71ee995
MD5 90317355c04863bab29c3426e09f34a2
BLAKE2b-256 3dcbd8f176a5871e6db074d3777e2250a9cb32065ad6088375d4442327275003

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.3.2-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 87264dbe86a0343f123df0b44e15190ff301b9003b4374bb1fd35429850dd214
MD5 613d8d4b1c64dc596f49a1e2657ef260
BLAKE2b-256 613e5a60313b41d88313705ce584e90498837a405fd3288dd7f4f255e5ee5646

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fisx-1.3.2-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 6.0 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for fisx-1.3.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 2e671a8b6e0463cf6de63679b86cb54fb23126d92e618b88d4ac6026fb3cdd15
MD5 8e7b26942246eca8b5caf3b4c60740c4
BLAKE2b-256 2bf08779e9d7ee1cc1418efa1039c4e19e19680e233b94907c26c11841e091c7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.3.2-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 dff16c69f8c9e77809d2306f377645ad3dc96386fc762311fa39d870873217d9
MD5 325dd3ffe6c97d2a325fcb6d73fe90b9
BLAKE2b-256 1ced2c81fba300561d9dbee9e58bfc3a9939610b0018391568d0ee72c8da851e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.3.2-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 3d4067d335cbfd1d1e26fe74ceadad31eadb6f2303428784af20545d5cb72b33
MD5 68e1f7a304c8cfee9582f24dc6fd4c60
BLAKE2b-256 1ee992856a87517a5d9992b6a607677f569d179621ca45e0c7c61250694c2d8a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fisx-1.3.2-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 6.0 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for fisx-1.3.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 9be11382b9e8fd2a1ea80613c1b819af84167f48097928fe7d7e5ce889d3e720
MD5 4679095ed4077645ec29a6ace63c2144
BLAKE2b-256 ae2d056052e45314eed47cf07cbc8f97be7f7cc535965ba90a52fc4b26906ebb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.3.2-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 7c8604bbac031471967c623920255279d658875d1057529072954e65109fbbe7
MD5 4f0d70313541b3aa7d7d66d3432d408d
BLAKE2b-256 dbd193e0552011574ef630a767cd0b266360fb127ef47a0a7c69032b077b4873

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.3.2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6385410e9bc21d96341308c8f168bbaa57901f026474b8af1295108ff11f5b99
MD5 3427660871ba56ea508cf1f4cdd59ea4
BLAKE2b-256 9ff19d683b14b435ab1733bbf2d01f9974cbedefaab4ac22dc95024d0f3c2826

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.3.2-cp39-cp39-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 c03ef3cd7bf1c4a390e6294e4b9b80a0bcecdde9ec1b50a25054418caa57ba1e
MD5 402efbb5c55ef030601b5aff21801a04
BLAKE2b-256 6a527c7e1d552736ef8a10871575fc2496471aae8a8354eec9a2cd4b3428e074

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fisx-1.3.2-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 6.0 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for fisx-1.3.2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 7f0b0080e52adb83c58877562c2c2438f465286d59bdf8c8cdab36b1ef1640b8
MD5 f1fb5fa15133e4b45de71213a0b6bf36
BLAKE2b-256 8dec5c898ab8d3b14d4b706116fc06227efa6f6af8c7db1baaa47ab07676f958

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.3.2-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 fca7bbf6279ae58d5cd35fff2ce448781a699683b99834ed949433dab7f98084
MD5 227e3461a572131c2a0b7bc2d8c3ec5c
BLAKE2b-256 9ffa1afe88dd3ccf0d6660a0682b3d363f31ff4de5d16321019e32dd3afbf39d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.3.2-cp38-cp38-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 9925584af88fdba5d0fd166cfb20cc0ba6c3958a16de52696e926fe066228781
MD5 abf2e851f030c956fac7d75f41ccee71
BLAKE2b-256 9826eac69ee1c8ea204514104987d96d79e9333fddd145f0ba7e6ca9b8bc2fc0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.3.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 eca1e28d792b01b010407da8a8a1d0478a6d88ab7d4d0346488b1f088549b452
MD5 033a6c5f0ae6e339ea442cf5325149b0
BLAKE2b-256 5f68d4c333ce99028afc68143faac165b0d824f8c4c316c30e1ab0ebdf593841

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.3.2-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 71cfeb2e2d55b1928b40deee97f77ad0163c0a19def300db30333cc4a27ed1b7
MD5 1dbd718d3ada2c720bdd862307a2782a
BLAKE2b-256 db611e1d7b11618ea172824856c68e136d69ef47fd014e80b8e75816e2a8fbbf

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