Skip to main content

Quantitative X-Ray Fluorescence Analysis Support Library

Project description

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 scondary 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 build the library for python use, just use the python setup.py install approach. It is convenient (but not mandatory) to have cython >= 0.17 installed.

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.0.6.zip (5.8 MB view details)

Uploaded Source

fisx-1.0.6.tar.gz (5.6 MB view details)

Uploaded Source

Built Distributions

fisx-1.0.6-cp35-none-win_amd64.whl (5.8 MB view details)

Uploaded CPython 3.5 Windows x86-64

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

Uploaded CPython 2.7 Windows x86-64

fisx-1.0.6-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.0.6-cp27-cp27m-win32.whl (5.8 MB view details)

Uploaded CPython 2.7m Windows x86

File details

Details for the file fisx-1.0.6.zip.

File metadata

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

File hashes

Hashes for fisx-1.0.6.zip
Algorithm Hash digest
SHA256 7255a600a8bd618afa8940b449b18bc6dff2220a39cf5a251f9bb8826c75aafc
MD5 e7a458bed1e900cddf4a5461655a802c
BLAKE2b-256 bfa935dd6e21919a9e6ce4151dbac2b13edc2cf5da8cfda5cf5bc64825466fef

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for fisx-1.0.6.tar.gz
Algorithm Hash digest
SHA256 d1d6f2dc65c9b6c9b1d14bb41e36886415b5cbd057e41497c51e02d929b1fd25
MD5 7e4defea3847a07a17718daf29b1cd8c
BLAKE2b-256 1e2d9c1e5e7895e197a2d2bf6792a64e69d075789ef1f6ea9d1a39d2b594fbc4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.0.6-cp35-none-win_amd64.whl
Algorithm Hash digest
SHA256 039ff0203a70a689ba6ec981c4749dc7a1c8aa04dae62630271a5724c9311621
MD5 c7b698ac6f8c5d9b10a403f0e95cf7a7
BLAKE2b-256 6b672b3f8fbe7c532ed4d0f913ef1c8afc56c89131a210514fd5edc5a5c8bff5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.0.6-cp27-none-win_amd64.whl
Algorithm Hash digest
SHA256 5cb7452a4300fd57a0f1427df6873ffded4570809c8c7648379fce49faf04a7e
MD5 8ae8eb1b17b3c6468082f47bc9936af2
BLAKE2b-256 ad123db4bbd966250b49da694877fe38e2347a4d5c108000f42b520dd8f14d7a

See more details on using hashes here.

File details

Details for the file fisx-1.0.6-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.0.6-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 4b062339668259fdb29cbd023910877df76ddd963f070e43a5ef61c2fc2c8721
MD5 b29580ee0979db22eaa6de3eb9e5c6fb
BLAKE2b-256 f62aac9af22eb034faba49f778c020a44dee0d0cdcf2a4cc28f5a0c010ec2c95

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fisx-1.0.6-cp27-cp27m-win32.whl
Algorithm Hash digest
SHA256 509c8ec0cc3bdba0ecc433afc2ed4619ead41f1729cb1e1be334e5d52193b325
MD5 9ec156b69e53e3938bbd4b72342d6524
BLAKE2b-256 33fdd9124a511ec30ea231084a3611ec418be155b1fb2700dbf4843a6c8a72a1

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