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 Distributions

fisx-1.1.2.zip (5.8 MB view details)

Uploaded Source

fisx-1.1.2.tar.gz (5.7 MB view details)

Uploaded Source

Built Distributions

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

Uploaded CPython 3.6m Windows x86-64

fisx-1.1.2-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (6.5 MB view details)

Uploaded CPython 3.6m macOS 10.10+ intel macOS 10.10+ x86-64 macOS 10.6+ intel macOS 10.9+ intel macOS 10.9+ x86-64

fisx-1.1.2-cp35-none-win_amd64.whl (5.9 MB view details)

Uploaded CPython 3.5 Windows x86-64

fisx-1.1.2-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (6.5 MB view details)

Uploaded CPython 3.5m macOS 10.10+ intel macOS 10.10+ x86-64 macOS 10.6+ intel macOS 10.9+ intel macOS 10.9+ x86-64

fisx-1.1.2-cp27-none-win_amd64.whl (5.9 MB view details)

Uploaded CPython 2.7 Windows x86-64

fisx-1.1.2-cp27-none-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (6.5 MB view details)

Uploaded CPython 2.7 macOS 10.10+ intel macOS 10.10+ x86-64 macOS 10.6+ intel macOS 10.9+ intel macOS 10.9+ x86-64

fisx-1.1.2-cp27-cp27m-win32.whl (5.8 MB view details)

Uploaded CPython 2.7m Windows x86

File details

Details for the file fisx-1.1.2.zip.

File metadata

  • Download URL: fisx-1.1.2.zip
  • Upload date:
  • Size: 5.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for fisx-1.1.2.zip
Algorithm Hash digest
SHA256 352043cd7c1e4afc356ec5b6ab1188b86d782ae179e1bfa98a216b165ca188a7
MD5 f14db2c8ea5695fa9e972354510ca79c
BLAKE2b-256 c6db2f6b1cb8955dbc1f432c235333f4401f07ca87a1f7c2002c26d80f7b852b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fisx-1.1.2.tar.gz
  • Upload date:
  • Size: 5.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for fisx-1.1.2.tar.gz
Algorithm Hash digest
SHA256 15d0c36203a58fec7a63e38ae7c2fb240d4213a5e48a4ee60289605427604193
MD5 e10d812ae2480322d10d9f5d684161e3
BLAKE2b-256 58c6576ff4452d145aebcf1a5ff92fdcd9efa50d3f393acdf7937566e782c304

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.1.2-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 d0f6b95314604387295ad46aebb6b42d9e97d757fabd086e3169063a200eecfa
MD5 b1ed55d4e4fd3377d27bd898474474d8
BLAKE2b-256 4933ee9a095c1d8adc73ef5c419dd8212060f8902ee11950ecffde90c921cffc

See more details on using hashes here.

File details

Details for the file fisx-1.1.2-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl.

File metadata

File hashes

Hashes for fisx-1.1.2-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm Hash digest
SHA256 fffb58d45f36f06095cb48d57eed9ff50f87c16f8d39e28ffad8a9cc0852dec8
MD5 3440121cc6a846e241069741919694b6
BLAKE2b-256 95cc19b470def2152b351246612ebd4da6d9b36a7f6fa619ad7f259d52e640f0

See more details on using hashes here.

File details

Details for the file fisx-1.1.2-cp35-none-win_amd64.whl.

File metadata

File hashes

Hashes for fisx-1.1.2-cp35-none-win_amd64.whl
Algorithm Hash digest
SHA256 aeee815d9c0111588ca5510dd3bce2d9c37f5ba4fcd0a8b75cc15c60ecbe0124
MD5 5a1ded9a9ebadd4870940da5e53e6297
BLAKE2b-256 7dea3bde0436345f2a3967065e3a933b4f5ee61e0cd7b523df27532ec2017e5f

See more details on using hashes here.

File details

Details for the file fisx-1.1.2-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl.

File metadata

File hashes

Hashes for fisx-1.1.2-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm Hash digest
SHA256 1be99ca0ec3e400242352244f5d3e512634d133db2a15ecd2f8f264bb24438f7
MD5 271980d1b615148b0bc768882c8fe8eb
BLAKE2b-256 5d829b84d2896dfc64c800c425979d7e9f756ef58d6a263a2f20d46f149b5838

See more details on using hashes here.

File details

Details for the file fisx-1.1.2-cp27-none-win_amd64.whl.

File metadata

File hashes

Hashes for fisx-1.1.2-cp27-none-win_amd64.whl
Algorithm Hash digest
SHA256 1ba16c8d6c8534e50d58cae04354fe1e6715dc3c23a6e6346e56166f73e02636
MD5 a9c293b979cb8ead675fcf8c1aff9fc3
BLAKE2b-256 685aea640f7dab18ac1bc56cd2ef21c64b5a18baffc4db291db93c20adae12af

See more details on using hashes here.

File details

Details for the file fisx-1.1.2-cp27-none-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl.

File metadata

File hashes

Hashes for fisx-1.1.2-cp27-none-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm Hash digest
SHA256 ec8b85bcfd7c17e261af2b18de984b4dc45ccd312e1bee3a9055bf8a2393ba69
MD5 0134fa2db9d843aedb18d870fab9cd5d
BLAKE2b-256 21f4b61b34d7e30d8df2f470a157956beae4e573d2e0bce2fab05868db3e2425

See more details on using hashes here.

File details

Details for the file fisx-1.1.2-cp27-cp27m-win32.whl.

File metadata

File hashes

Hashes for fisx-1.1.2-cp27-cp27m-win32.whl
Algorithm Hash digest
SHA256 987bf65b9a0afb2e8776727e251df767bd88b9cbf96e61b5146e4014f18a6ae5
MD5 a0f2e8460907a87b14d4caca71d14fd1
BLAKE2b-256 510f5ff17d6455e581c837bd60802ddf4039015b8dcab901ea28902b1143ef05

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