NeXLCore.jl

Core algorithms and data for X-ray microanalysis calculations
Author usnistgov
Popularity
2 Stars
Updated Last
1 Year Ago
Started In
September 2019

NeXL LogoCore

Core X-ray Microanalysis Data and Algorithms

Documentation Build Status

Installation

NeXLCore and its dependencies are all available on the Julia registry.

] add NeXLCore

NeXLCore is part of the NeXL collection of Julia language packages.

Released

  • NeXLUncertainties - Basic data structures and algorithms for single uncertain values and collects of related uncertain values
  • NeXLCore - Core data and algorithms for X-ray microanalysis (elements, shells, transitions and their properties)
  • NeXLSpectrum - Data structures and algorithms for EDS spectrum and hyperspectral data (reading/writing/fitting/etc.)
  • NeXLMatrixCorrection - Data structures and algorithms for matrix correction of electron excited X-ray k-ratios

Under rapid development but largely functional (pre-α)

  • NeXLDatabase - A database for handling NeXL library datatypes
  • NeXLParticle - Data structures and algorithms for dealing with particle data (particularly ASPEX Zeppelin datasets)

Standards in NeXL

To reduce ambiguity, the following X-ray microanalysis-standard units are used by all packages even when there are more common or accessible units for a quantity. Thus stage position is in cm (not mm), coating thicknesses are in cm (not nm), etc. This means you never need to consult the documentation to know what units a function expects.

  • Mass is measured in grams (g)
  • Length is measured in centimeters (cm)
  • Time is measured in seconds (s)
  • Energy is measured in electron-volts (eV)
  • Pressure is measured in Pascal (p)
  • Mixed units are expressed in combinations of these units (MACS are in cm2/g)

NeXLCore implements a @n_str macro to parse Element, SubShell and Transition objects at compile time. The n"???" notation is used throughout NeXL.

n"Fe" # constructs an Element representing iron
n"L3" # constructs a SubShell object representing an L3 shell (not element specific)
      # Note: The ambiguiuty between potassium K and shell K is handled by calling the shell n"K1"
n"Fe L3" # constructs an AtomicSubShell representing the iron L3 sub-shell.
n"L3-M5" # constructs a Transition representing the L3-M5 transition (not element specific)
n"Fe L3-M5" # Constructs a CharXRay representing the L3-M5 transition in iron.

To access the characteristic energies associated with these items, use the function energy(...) which returns eV.

energy(n"Fe K") # 7112.0
energy(n"Fe K-L3") # 6403.9

NeXL uses https://github.com/JuliaPhysics/PeriodicTable.jl for elemental data.

NeXLCore also implements many generally useful X-ray and electron physics algorithms including Bremstrahlung generation, Bethe energy loss, mean-ionization potential, elastic scattering cross-sections and others.

NeXL implements spectrum file support in the NeXLSpectrum package including spectrum file input/output. Various different X-ray microanalysis related file types are recognise by a combination of file extension and file content and can be read using code like

using FileIO
using NeXLSpectrum
spec = loadspectrum("~/home/data/spectrum.msa") # To read an EMSA spectrum

NeXL uses Gadfly (https://github.com/GiovineItalia/Gadfly.jl) to plot data items. However, the Gadfly support is not loaded unless/until the user using Gadfly elsewhere in their code. Thus Gadfly support is lightweight and doesn't hinder those who don't want to use it. However, NeXL implements different specializations of the Gadfly.plot(...) method to handle NeXL-related data types.

using Gadfly
plot([ n"K-L3", n"L3-M5" ]) # plots the edge-energies associated with these shells over the range of supported elements

or (when using NeXLSpectrum)

using Gadfly
plot(spec,klms=[n"Fe",n"Si",n"O",n"Al"])#  To plot a spectrum with KLM lines.
plot([spec1,spec2,spec3],klms=[n"Fe",n"Si",n"O",n"Al"]) #  To plot a list of spectra with KLM lines.

NeXL uses DataFrames to tabulate data. To convert an object or list of objects to a DataFrame use asa(DataFrame,item).