# Core - Part of the NeXL X-ray Microanalysis Library

## Installing NeXLCore.jl

NeXLCore is available throught the standard Julia registry and can be installed using the standard package manager.

julia> ]add NeXLCore

or

julia> using Pkg
julia> Pkg.add("NeXLCore")

## Using NeXLCore

NeXLCore provides the core data and algorithms used throughout the NeXL libraries for elemental and X-ray-related data and calculations.

#### Standards

For consistency, function arguments and outputs will be use the following standard (unless otherwise mentioned.)

• All lengths are in centimeters
• All masses are in grams
• All energies are in eV
• All angles are in radians
• Mixed units are in combinations of these units (MACs are in cm²/g etc.)

The special macro n"..." has been defined to make constructing objects representing elements, subshells, atomic shells, transitions and characteristic x-rays quick and easy.

Examples:

n"Fe" == element(26)
n"L3" == subshell("L3")
n"Fe L3" == atomicsubshell(n"Fe",shell("L3"))
n"L3-M5" == transition(shell("L3"),shell("M5"))
n"Fe L3-M5" == CharXRay(26, transition(shell("L3"),shell("M5")))
NeXLCore.atomic_weightConstant
atomic_weight[elm::Element]::Union{NumberInterval, UncertainValue}

Atomic weights from the 2020 tabulation at https://ciaaw.org/atomic-weights.htm. Not all elements are represented because not all elements have a nominal isotopic distribution. Some, like Tc, don't exist in nature. Others, like Pm, are instable. Most atomic weights are given as UncertainValue instances while a few are NumberInterval instances. For example, the atomic weight of Pb is highly variable and is thus given as a range. (See the website for more details.)

source
NeXLCore.transitionsbygroupConstant
transitionsbygroup

A Dict{String,Tuple{Transition}} mapping group name into a list of transitions. Keys are "K","L","M","N","O" and "Kα", "Ka", "Kβ", "Kb" and "Kother".

source
NeXLCore.AFtoNMFType
AFtoNMF

Converts atomic fraction into mass fraction - since the results in by necessity normalized, both the MassFractionLabel and NormMassFractionLabel versions are populated with identical information.

source
NeXLCore.Berger1982Type

@techreport{berger1982national, title={National Bureau of Standards, Report NBSIR 82-2550}, author={Berger, MJ and Seltzer, SM}, journal={NBS, Washington, DC}, year={1982}, url={https://nvlpubs.nist.gov/nistpubs/Legacy/IR/nbsir82-2550A.pdf} }

According to B&S "The continuous-slowing-down approximation, i.e., the use of a stopping power to describe the gradual energy loss along the electron track, ceases to be meaningful at energies below several hundred eV."

source
NeXLCore.Bloch1933Type

@article{von1933bremsvermogen, title={Bremsverm{"o}gen von Atomen mit mehreren Elektronen (Braking capabilities of multi-electron atoms)}, author={von Bloch, F}, journal={Z. Phys}, volume={81}, pages={363}, year={1933} }

source
NeXLCore.Brizuela1990Type

@article{brizuela1990study, title={Study of mean excitation energy and K-shell effect for electron probe microanalysis}, author={Brizuela, Horacio and Riveros, Jos{'e} Alberto}, journal={X-Ray Spectrometry}, volume={19}, number={4}, pages={173–176}, year={1990}, publisher={Wiley Online Library} }

source
NeXLCore.Castellano2004aType

@article{castellano2004analytical, title={Analytical model for the bremsstrahlung spectrum in the 0.25–20 keV photon energy range}, author={Castellano, Gustavo and Osan, Janos and Trincavelli, Jorge}, journal={Spectrochimica Acta Part B: Atomic Spectroscopy}, volume={59}, number={3}, pages={313–319}, year={2004}, publisher={Elsevier} }

source
NeXLCore.CustomMACType

Implements tabulated MACs from various literature sources including Henke1974, Henke1982, Bastin1988, Bastin1989, Henke1993, Bastin1997, Ruste1979, Kohlhaas1970, Weisweiler1975, Bastin1990, Poml2020, Ruste1975, Farthing1990 and Sabbatucci2016.

The custom MACs are stored in the file data/specialmacs.csv.

source
NeXLCore.ElementByDifferenceType
ElementByDifference

Computes one element as the different between a sum of 1.0 mass fraction. If the sum of the other element's mass fraction is already 1.0 or larger, returns zero.

source
NeXLCore.FFASTDBType

FFAST represents an implementation of mass-absorption coefficients and associated edge and other elemental data. It is a thin wrapper around the FFAST library.

source
NeXLCore.Jensen1937Type

@article{jensen1937eigenschwingungen, title={Eigenschwingungen eines fermi-gases und anwendung auf die blochsche bremsformel f{"u}r schnelle teilchen}, author={Jensen, Hans}, journal={Zeitschrift f{"u}r Physik}, volume={106}, number={9-10}, pages={620–632}, year={1937}, publisher={Springer} }

source
NeXLCore.KRatioType
KRatio

The k-ratio is the ratio of two similar intensity measurements - one on a material of unknown composition and one on a standard with known composition. Each measurement has properties like :BeamEnergy (req), :TakeOffAngle (req), :Coating (opt) that characterize the measurement. A minimal set of properties includes:

Properties: (These Symbols are intentionally the same used in NeXLSpectrum)

:BeamEnergy incident beam energy in eV
:Coating A NeXLCore.Film object or Film[] detailing a conductive coating

Some algorithms may require additional properties.

k-ratios are associated with characteristic X-rays (CharXRay) from a single element. WDS k-ratios are typically associated with a single CharXRay while EDS measurements may be associated with many CharXRay that are similar in energy. k-ratios are always relative to another material. Usually the composition of this Material is well-known. However, when a k-ratio is restandardized, it is possible for the intermediate material to be less well-known.

source
NeXLCore.KRatiosType

KRatios represents the hyper-spectral equivalent of the KRatio type. Each pixel in the KRatios object must be characterized by the same unknown and standard properties, the same X-ray lines and the other properties.

source
NeXLCore.Kramers1923Type

@article{kramers1923, author = { Kramers, H. A. }, title = {XCIII. On the theory of X-ray absorption and of the continuous X-ray spectrum}, journal = {The London, Edinburgh, and Dublin Philosophical Magazine and Journal of Science}, volume = {46}, number = {275}, pages = {836-871}, year = {1923}, publisher = {Taylor & Francis}, doi = {10.1080/14786442308565244}, URL = { https://doi.org/10.1080/14786442308565244 }, eprint = { https://doi.org/10.1080/14786442308565244} }

source
NeXLCore.Lifshin1974Type

@InProceedings{ lifshin1974, author={Lifshin, E.}, journal="Proceedings Ninth National Conference on Electron Probe Analysis, Ottowa, CA", year={1974}, volume={174}, number={3}, }

source
NeXLCore.Liljequist1989Type

Liljequist's simple refinement of the basic ScreenedRutherford algorithm.

Journal of Applied Physics, 65, 24-31 (1989) as corrected in J. Appl. Phys. 68 (7) 3061-3065 (1990)

source
NeXLCore.LoveScott1978ηType

@article{Love_1978, doi = {10.1088/0022-3727/11/10/002}, url = {https://doi.org/10.1088%2F0022-3727%2F11%2F10%2F002}, year = 1978, month = {jul}, publisher = {{IOP} Publishing}, volume = {11}, number = {10}, pages = {1369–1376}, author = {G Love and V D Scott}, title = {Evaluation of a new correction procedure for quantitative electron probe microanalysis}, journal = {Journal of Physics D: Applied Physics}, abstract = {A new correction procedure for converting electron-probe microanalysis measurements into true weight concentration is proposed. It incorporates a new atomic number correction and an absorption correction based upon Bishop's model (1974). Unlike earlier treatments the model does not have to rely upon any empirical optimisation of input parameters. The correction procedure has been tested by applying it to a wide range of microanalysis data including light-element results, and it is shown to give greater accuracy than the established methods.} }

source
NeXLCore.MaterialType
Material

Holds basic data about a material including name, composition in mass fraction and optional propreties.

Properties

• :Density Density in g/cm³
• :Description Human friendly
• :Pedigree Quality indicator for compositional data ("SRM-XXX", "CRM-XXX", "NIST K-Glass", "Stoichiometry", "Wet-chemistry by ???", "WDS by ???", "???")
• :Conductivity => :Insulator, :Semiconductor, :Conductor
source
NeXLCore.MaterialFractionLabelType
MaterialFraction

This label represents the amount of a material constituent in material in a material defined as the mixture of other materials.

source
NeXLCore.NeXLBremsstrahlungType

An abstract structure that implements

NeXLCore.bremsstrahlung(::Type{<:NeXLBremsstrahlung}, e::AbstractFloat, e0::AbstractFloat, elm::Element; kwargs...)
source
NeXLCore.NeXLMeanIonizationPotentialType

Algorithms that implement the mean ionization potential. The mean ionization potential is the primary parameter in continuous slowing down models of electron energy loss in matter. Electrons primarily lose energy through two mechanisms - 1) collision stopping power parameterized by J, the mean ionization potential; and 2) Bremsstrahlung production. Two or three orders of magnitude more energy is lost to collisional loss so collisional loss dominates the process and losses due to Bremsstrahlung production are insignificant relative to the uncertainty in collisional loss.

Implement this:

J(::Type{<:NeXLMeanIonizationPotential}, z)  # in eV

Also provided:

J(::Type{<:NeXLMeanIonizationPotential}, elm::Element)  # in eV
source
NeXLCore.NormalizeByShellType

NormalizeByShell normalizes the sum of all the weights associated with a shell to unity. Example:

sum(cxr=>weight(NormalizeByShell, cxr), characteristic(n"Fe", ltransitions))==1.0
source
NeXLCore.NormalizeBySubShellType

NormalizeBySubShell normalizes the sum of all the weights associated with a sub-shell to unity.

Example:

sum(cxr=>weight(NormalizeBySubShell, cxr), characteristic(n"Fe", ltransitions))==1.0+1.0+1.0
source
NeXLCore.NormalizeToUnityType

NormalizeToUnity normalizes intensities such that the most intense line in each shell to 1.0.

Example:

sum(cxr=>weight(NormalizeBySubShell, cxr), n"Fe K-L3")==1.0
source
NeXLCore.ParticleType

Particle represents a type that may be simulated using a transport Monte Carlo. It must provide these methods:

position(el::Particle)::Position
previous(el::Particle)::Position
energy(el::Particle)::Float64

The position of the current and previous elastic scatter locations which are stored in that Particle type.

T(prev::Position, curr::Position, energy::Energy) where {T <: Particle }
T(el::T, 𝜆::Float64, 𝜃::Float64, 𝜑::Float64, ΔE::Float64) where {T <: Particle }

Two constructors: One to create a defined Particle and the other to create a new Particle based off another which is translated by λ at a scattering angle (θ, ϕ) which energy change of ΔE

transport(pc::T, mat::Material)::NTuple{4, Float64} where {T <: Particle }

A function that generates the values of ( λ, θ, ϕ, ΔE) for the specified Particle in the specified Material.

source
NeXLCore.RectangularShapeType

The MonteCarlo uses the shapes defined in GeometryBasics basics as the foundation for its sample construction mechanisms. However, GeometryBasics basics does not provide all the necessary methods. Three additional methods are

isinside(r::Shape, pos::Position)

Is pos strictly inside r?

intersection(r::Shape, pos0::Particle, pos1::Particle)::Float64

Return a number f which represent the fraction of the distance from pos0 to pos1 that first intersects the Shape r. The intersection point will equal pos0 .+ f*(pos1 .- pos0). If f is between 0.0 and 1.0 then the intersection is on the interval between pos0 and pos1. If the ray from pos0 towards pos2 does not intersect r then this function returns Inf64.

source
NeXLCore.Reed1975Type

@article{reed1975shape, title={The shape of the continuous X-ray spectrum and background corrections for energy-dispersive electron microprobe analysis}, author={Reed, SJB}, journal={X-Ray Spectrometry}, volume={4}, number={1}, pages={14–17}, year={1975}, publisher={Wiley Online Library} }

source
NeXLCore.RegionType
Region

A Region combines a geometric primative and a Material (with :Density property) and may fully contain zero or more child Regions.

source
NeXLCore.Small1987Type

@article{small1987modeling, title={Modeling of the bremsstrahlung radiation produced in pure-element targets by 10–40 keV electrons}, author={Small, John A and Leigh, Stefan D and Newbury, Dale E and Myklebust, Robert L}, journal={Journal of applied physics}, volume={61}, number={2}, pages={459–469}, year={1987}, publisher={American Institute of Physics} }

source
NeXLCore.Smith1975Type

@article{ smithgoldtomlinson1975 title="The atomic number dependence of the X‐ray continuum intensity and the practical calculation of background in energy dispersive electron microprobe analysis", author = {Smith, D. G. W. and Gold, C. M. and Tomlinson, D. A.}, journal={X-ray Spectrometry}, volume={4}, pages={149-156}, year={1975}, doi={10.1002/xrs.1300040311}, }

source
NeXLCore.Springer1967Type

@article{springer1967electron, title={Electron Transport in Amorphous Materials. I}, author={Springer, Bernard}, journal={Physical Review}, volume={154}, number={3}, pages={614}, year={1967}, publisher={APS} }

source
NeXLCore.Sternheimer1964Type

Cited personal communication in @article{berger196410, title={10. Tables of energy-losses and ranges of electrons and positrons}, author={Berger, M and Seltzer, S}, journal={Studies in penetration of charged particles in matter}, number={39}, pages={205}, year={1964} }

source
NeXLCore.SubShellType
SubShell

Represents one of the various subshells in an atom. (See AtomicSubShell to combine the element with a SubShell.) Member data items are index::Int where 1=>K, 2=>L1, ..., 36=>P11. Construct using SubShell(name::AbstractString) where name = "K", "L1"...,"P11"

source
NeXLCore.Tomlin1963Type

@article{Tomlin_1963, doi = {10.1088/0370-1328/82/3/118}, url = {https://doi.org/10.1088%2F0370-1328%2F82%2F3%2F118}, year = 1963, month = {sep}, publisher = {{IOP} Publishing}, volume = {82}, number = {3}, pages = {465–466}, author = {S G Tomlin}, title = {The Back-scattering of Electrons from Solids}, journal = {Proceedings of the Physical Society}, abstract = {Archard's diffusion model of electron back-scattering is discussed on the basis of a result obtained by Tomlin and Metchnik in 1963 in their treatment of x-ray emission intensities. The resulting simple formula for the back-scattering coefficient is in reasonably good agreement with measured values.} }

The implementation adapted to not return negative numbers for z<5.

source
NeXLCore.TransitionType
Transition

Represents an inner and outer shell that describe an X-ray transition. Only transitions for which one or more element has a characteristic x-ray are supported according to the default line weight database (weight > 0 for one or more Z). This structure does not contain the Element information necessary to specify a characteristic X-ray.

Data items:

innerShell::SubShell
outerShell::SubShell

Example:

tr1 = Transition(n"K",n"L3")
tr2   = Transition(SubShell(1),SubShell(4))
@assert tr1==tr2
source
NeXLCore.Trincavelli1997Type

@article{trincavelli1998model, title={Model for the bremsstrahlung spectrum in EPMA. Application to standardless quantification}, author={Trincavelli, Jorge and Castellano, Gustavo and Riveros, J Alberto}, journal={X-Ray Spectrometry: An International Journal}, volume={27}, number={2}, pages={81–86}, year={1998}, publisher={Wiley Online Library} }

source
NeXLCore.Wilson1941Type

@article{wilson1941range, title={Range and ionization measurements on high speed protons}, author={Wilson, Robert R}, journal={Physical Review}, volume={60}, number={11}, pages={749}, year={1941}, publisher={APS} }

source
NeXLCore.Zeller1973Type

@article{coulon1973determination, title={D{'e}termination th{'e}oretique du facteur de r{'e}trodiffusion en microanalyse par {'e}mission X}, author={Coulon, J and Zeller, C}, journal={CR Acad Sci Paris}, volume={276}, pages={215–218}, year={1973} }

source
Base.convertMethod
Base.convert(::Type{Material}, str::AbstractString)

Convert a DTSA-II style string into a material.

source
Base.findfirstMethod
Base.findfirst(krs::AbstractVector{<:KRatioBase}, cxr::CharXRay)

Find the first KRatio or KRatios in which the .xrays field contains the cxr::CharXRay.

source
Base.haskeyMethod
haskey(mat::Material, elm::Element)
haskey(mat::Material, z::Int)

Does this material contain this element?

source
Base.isapproxMethod
Base.isapprox(mat1::Material, mat2::Material; atol = 1.0e-4)

Are these Material(s) equivalent to within atol?

source
Base.keysMethod
Base.keys(mat::Material)

Return an interator over the elements in the Material.

source
Base.parseMethod
Base.parse(::Type{SubShell}, name::AbstractString)
subshell(name::AbstractString)

Parse an SubShell from a string of the form "K", "L1", "L2", ...

Base.parse(::Type{AtomicSubShell}, str::AbstractString)::AtomicSubShell
atomicsubshell(str::AbstractString)::AtomicSubShell

Parse an AtomicSubShell from a string of the form "Fe K" or "U M5".

source
Base.parseMethod
transition(str::AbstractString)::Transition

Constructs a Transition structure from a string representation of the form "K-L3" or "L3-M5". Asserts if the transition is not a known transition.

source
Base.parseMethod
Base.parse(
::Type{Material},
expr::AbstractString;
name::Union{AbstractString,Missing}=missing,
properties::Dict{Symbol,Any}=Dict{Symbol,Any}(),
atomicweights::Dict{Element,V} = Dict{Element,Float64}(),
density::Union{Missing, AbstractFloat}=missing,
description::Union{Missing, AbstractString}=missing,
pedigree::Union{Missing, AbstractString}=missing,
conductivity::Union{Missing, Symbol}=missing, # :Conductor, :Semiconductor, :Insulator
)::Material

Parse a Material from a string.

source
Base.randFunction
Base.rand(::Type{Material}, zs::AbstractUnitRange{Int}=1:20)::Material

Generate a randomize material.

source
Base.randMethod
Base.rand(::Type{<:ScreenedRutherfordType}, elm::Element, E::Float64)::Float64

Draw an angle distributed according to the angular dependence of the differential screened Rutherford cross-section.

source
Base.randMethod
Base.rand(ty::Type{<:ScreenedRutherfordType}, mat::Material, E::Float64)::NTuple{3, Float64}

Returns a randomly selected elastic scattering event description. The result is ( λ, θ, ϕ ) where λ is a randomized mean free path for the first scattering event. θ is a randomized scattering angle on (0.0, π) and ϕ is a randomized azimuthal angle on [0, 2π).

The algorithm considers scattering by any element in the material and picks the shortest randomized path. This implementation depends on two facts: 1) We are looking for the first scattering event so we consider all the elements and pick the one with the shortest path. 2) The process is memoryless.

source
Base.rangeFunction
range(::Type{Kanaya1972}, mat::Material, e0::Float64, inclDensity = true)

Calculates the Kanaya-Okayama electron range. Kanaya K, Okayama S (1972) Penetration and energy-loss theory of electrons in solid targets. J Appl Phys 5:43

source
Base.rangeFunction
range(::Type{BetheEnergyLoss}, mat::Material, e0::Float64, inclDensity = true)

Calculates the electron range using numeric quadrature of a BetheEnergyLoss algorithm.

source
Base.similarMethod
Base.similar(mat::Material{UncertainValue, <:AbstractFloat}, n::Integer)::Vector{Material{UncertainValue,Float64}}

Generate n Materials similar to mat using the uncertainties in mat as your guide of dispersion. The mass-fractions of mat must be defined as UncertainValues.

source
Base.stripMethod
strip(krs::AbstractVector{KRatio}, els::Element...)::Vector{KRatio}

Creates a new Vector{KRatio} containing all the KRatio objects in krs except those associated with the specified elements.

source
Base.sumMethod
Base.sum(
data::Dict{Material, <:AbstractFloat};
name::Union{AbstractString,Missing} = missing,
properties::Dict{Symbol,Any} = Dict{Symbol,Any}(),
density::Union{Missing,AbstractFloat} = missing,
description::Union{Missing,AbstractString} = missing,
pedigree::Union{Missing,AbstractString} = missing,
conductivity::Union{Missing,Symbol} = missing, # :Conductor, :Semiconductor, :Insulator

)::Material

Sum together proportions of various Material structs. The dictionary defines the material and the mass fraction of that material.

source
Base.sumMethod
Base.sum(
mat1::Material,
mat2::Material;
name::Union{AbstractString,Missing} = missing,
properties::Dict{Symbol,Any} = Dict{Symbol,Any}(),
density::Union{Missing,AbstractFloat} = missing,
description::Union{Missing,AbstractString} = missing,
pedigree::Union{Missing,AbstractString} = missing,
conductivity::Union{Missing,Symbol} = missing, # :Conductor, :Semiconductor, :Insulator
)::Material

Construct a Material that represents the mass-fraction sum of mat1 and mat2. This function is often used along with Base.:(k::AbstractFloat, mat::Material)::Material to construct mixtures of compounds. Ultimately, expressions like mat"0.5Al2O3+0.5MgO"or equivalently0.5mat"Al2O3"+0.5*mat"MgO"are computed usingsum(...).

source
Gadfly.plotFunction
Gadfly.plot(sss::AbstractVector{SubShell}, mode=:EdgeEnergy|:FluorescenceYield; palette=NeXLPalette)

Plot the edge energies/fluorescence yields associated with the specified vector of SubShell objects.

source
Gadfly.plotMethod
Gadfly.plot(transitions::AbstractVector{Transition}; mode=:Energy|:Weight, palette=NeXLPalette)

Plot either the :Energies or :Weights associated with the specified transitions over the range of supported elements.

source
Gadfly.plotMethod
compareMACs(elm::Element; palette=NeXLPalette)

Plot a comparison of the FFAST and Heinrich MAC tabulations for the specified Element or Material.

source
Gadfly.plotMethod
plot(alg::Type{<:NeXLAlgorithm}, elm::Union{Element,Material}; palette = NeXLPalette, xmax=20.0e3)

Plot a MAC tabulations for the specified Element or Material.

source
LinearAlgebra.normalizeMethod
LinearAlgebra.normalize(krs::AbstractVector{<:KRatios}; norm::Float32=1.0f)::Vector{KRatios}
LinearAlgebra.normalize(krs::AbstractVector{KRatio}; norm::Float32=1.0f)::Vector{KRatio}

Computes the pixel-by-pixel normalized k-ratio for each point in the KRatios data array. norm specifies normalization constants other than 1.0.

source
NeXLCore.JMethod
J(ty::Type{<:NeXLMeanIonizationPotential}, mat::Material)

Computes the mean ionization potential for a material based on the formula in PaP1992 (Green Book)

source
NeXLCore.Log3BandMethod

Tranforms numbers on the range [1.0e-3, 1.0] into David Bright's Log3-band palette using a log base-10 transform. NaNs are plotted in yellow.

source
NeXLCore.aMethod
a(elm::Element, mat::Material)

Get the atomic weight for the specified Element in the specified Material.

source
NeXLCore.aMethod
a(mat::Material)

Computes the mean atomic weight for a material. (Naive algorithm.)

source
NeXLCore.asnormalizedFunction
asnormalized(mat::Material, n=1.0)::Material

Convert the Material to a normalized Material form. Negative mass fractions are set to zero before normalization.

source
NeXLCore.asoxideMethod
asoxide(elm::Element, valences = NeXLCore.defaultValences)

Compute the oxidized form of the specified element using the valences provided in val. By default, val = NeXLCore.defaultValences, a typical set of valences.

source
NeXLCore.asoxideMethod
asoxide(elms::Pair{Element, <:AbstractFloat}...; valences = NeXLCore.defaultValences, atomicweights::Dict{Element,<:AbstractFloat} = Dict{Element,Float64}())
asoxide(elms::Dict{Element, <:AbstractFloat}...; valences = NeXLCore.defaultValences, atomicweights::Dict{Element,<:AbstractFloat} = Dict{Element,Float64}())

Providing the mass-fraction of the consituent elements in elms, compute the corresponding amounts of the oxide forms of the elements. This can be used to answer the question: If I measure this amount of these elements, what mass fraction of the oxide-forms of each element does this correspond to? The example below demonstrates that Albite is 68.74% SiO₂ by mass. By default, val = NeXLCore.valences, a typical set of valences. See also obystoichiometry(...)

Example:

julia> mat"NaAlSi3O8"
NaAlSi3O8[Al=0.1029,Na=0.0877,Si=0.3213,O=0.4881]
julia> asoxide(n"Al"=>0.1029, n"Na"=>0.0877, n"Si"=>0.3213)
Dict{Material, Float64} with 3 entries:
SiO₂[O=0.5326,Si=0.4674]  => 0.687366
Al₂O₃[Al=0.5293,O=0.4707] => 0.194424
Na₂O[Na=0.7419,O=0.2581]  => 0.118216
julia> sum(asoxide(n"Al"=>0.1029, n"Na"=>0.0877, n"Si"=>0.3213), name="Albite")
Albite[Al=0.1029,Na=0.0877,O=0.4881,Si=0.3213]
julia> asoxide(filter(kv->kv[1]!=n"O", massfraction(mat"NaAlSi3O8")))
Dict{Material, Float64} with 3 entries:
SiO₂[O=0.5326,Si=0.4674]  => 0.687401
Al₂O₃[Al=0.5293,O=0.4707] => 0.194418
Na₂O[Na=0.7419,O=0.2581]  => 0.118181
source
NeXLCore.atomicfractionMethod
atomicfraction(
name::String,
atomfracs::Union{Dict{Element,Float64},Pair{Element,Float64}...};
properties::properties::Dict{Symbol, Any},
atomicweights::Dict{Element,Float64},
density::Union{Missing, AbstractFloat}=missing,
description::Union{Missing, AbstractString}=missing,
pedigree::Union{Missing, AbstractString}=missing,
conductivity::Union{Missing, Symbol}=missing, # :Conductor, :Semiconductor, :Insulator

) # density, description, pedigree, conductivity

Build a Material from atomic fractions (or stoichiometries).

source
NeXLCore.atomicsubshellsFunction
 atomicsubshells(elm::Element, maxE=1.0e6)::Vector{AtomicSubShell}

Returns a Vector containing all AtomicSubShell structs associated with the specified element with less than the specified energy (in eV).

Example:

julia> atomicsubshells(n"Fe",1.0e3)
8-element Array{AtomicSubShell,1}:
Fe M3
Fe L3
Fe M5
Fe L1
Fe L2
Fe M1
Fe M4
Fe M2
source
NeXLCore.atoms_per_cm³Method
atoms_per_cm³(mat::Material, elm::Element) =

Number of atoms per cm³ of the specified Element in the specified Material. The Material must define the :Density property.

atoms_per_cm³(mat::Material)

Total number of atoms per cm³ for all elements in mat.

source
NeXLCore.atoms_per_gMethod
atoms_per_g(elm::Element)
atoms_per_g(mat::Material, elm::Element)

Compute the number of atoms of elm in 1 gram of mat.

source
NeXLCore.brightestMethod
brightest(elm::Element, shell)

Return the brightest transition among the shell of transitions for the specified element. (group="K"|"Ka"|"Kb"|"L" etc)

source
NeXLCore.brightestMethod
brightest(krs::Union{KRatios, KRatio})

Returns a new KRatios (referencing same basic data as krs) but with a single CharXRay in the lines field.

source
NeXLCore.capacityMethod
capacity(ss::SubShell)

Electron capacity for the specified sub-shell. This is the total number of electrons that the sub-shell can hold, not the actual number a specific ground-state element may have in that sub-shell.

source
NeXLCore.charactericXRayAvailableFunction
characteristicXRayAvailable(z::Int, inner::Int, outer::Int, alg::Type{<:NeXLAlgorithm} = CullenEADL)::Float64

Is the weight associated with this transition greater than zero?

source
NeXLCore.characteristicMethod
characteristic(elm::Element, iter::Tuple{Vararg{Transition}}, filterfunc::Function)
characteristic(elm::Element, iter::AbstractVector{Transition}, filterfunc::Function)
characteristic(elm::Element, iter::AbstractVector{Transition}, minweight = 0.0, maxE = 1.0e6)
characteristic(elm::Element, iter::Tuple{Vararg{Transition}}, minweight = 0.0, maxE = 1.0e6)
characteristic(ass::AtomicSubShell)

The collection of available CharXRay for the specified Element or AtomicSubShell. filterfunc(...) * maxE is compared to the edge energy. * minWeight is compared to the weight

Example:

characteristic(n"Fe",ltransitions,0.01)
characteristic(n"Fe",ltransitions,cxr->energy(cxr)>700.0)
characteristic(n"Fe L3")
source
NeXLCore.childmost_regionMethod
childmost_region(reg::Region, pos::Position)::Region

Find the inner-most Region within reg containing the point pos.

source
NeXLCore.coated_particleFunction
coated_particle(mat::Material, radius::Float64, coating::Material, thickness::Float64, substrate::Union{Nothing,Material} = nothing)

Construct a coated particle on an optional substrate.

This model is a good example of how more complex models are constructed. Use dump(..) to display the structure. You'll notice that the chamber serves as the root Region. The coating and substrate are in the chamber (children of the chamber Region). The particle is a child of the coating Region because the particle is fully enclosed by the coating. An electron inside of the coating will enter the particle and leave the coating as soon as it enters the volume representing the particle. The electron only appears to be within the child-most region at any point in space. So a typical trajectory might start in the chamber, enter the coating, traverse the thickness of the coating and then enter the particle. It may eventually leave the particle and reenter the coating, exit the coating and reenter the chamber and finally come to rest in the substrate.

source
NeXLCore.colorizeFunction
colorize(krs::AbstractVector{<:KRatios}, red::Element, green::Element, blue::Element, normalize=:All[|:Each])
colorize(krs::AbstractVector{<:KRatios}, elms::AbstractVector{Element}, normalize=:All)

Create RGB colorized images from up to three Elements. The elements are normalized relative to all KRatios in krs. The resulting images are scaled by the factor scale to allow visualization of trace elements.

source
NeXLCore.colorizeMethod
colorize(reg::Region)::Dict{Material, Color}

Generate a Dict{Material, Color} for all the Materials in the specified Region. Designed for distinctive but not necessarily attractive colors.

source
NeXLCore.compareMACsMethod
compareMACs(elm::Element; palette=NeXLPalette)

Plot a comparison of the FFAST and Heinrich MAC tabulations for the specified Element.

source
NeXLCore.comptonAngularMethod

comptonAngular(θ, E)

The angular distribution function of Compton scattered X-rays of incident energy E scattered to an angle θ.

Based on the Klein-Nishina formula for Compton scattering. It has been normalized so that the integral over dΩ = 2π⋅sin(θ) dθ equals one.

source
NeXLCore.comptonEnergyMethod

comptonEnergy(θ, E)

The energy of the scattered X-ray resulting from a Compton event with an incident X-ray energy of E eV at a scatter angle of θ radians.

source
NeXLCore.comptonShiftMethod

comptonShift(θ, E)

The fractional energy of the scattered X-ray resulting from a Compton event with an incident X-ray energy of E eV at a scatter angle of θ radians.

source
NeXLCore.compute_tiltMethod
compute_tilt(v1::Vector, v2::Vector, v3::Vector)

Compute the tilt and angle of tilt of the sample where v1, v2 and v3 are three points forming a triangle with each focused on the surface of the sample. Assumes a right-handed coordinate system which may/may not match your stage.

source
NeXLCore.dEdsFunction
dEds(::Type{<:BetheEnergyLoss}, e::Float64, elm::Element, ρ::Float64; mip::Type{<:NeXLMeanIonizationPotential}=Berger1982)
dEds(::Type{<:BetheEnergyLoss}, e::Float64, mat::Material, inclDensity=true; mip::Type{<:NeXLMeanIonizationPotential}=Berger1982)

Calculate the loss per unit path length for an electron in the specified element and density. The results in energy loss in eV/Å. Implemented by Type{Bethe} and Type{JoyLuo}.

source
NeXLCore.deleteMethod
delete(mat::Material, elm::Element)::Material
delete(mat::Material, elm::AbstractVector{Element})::Material

Constructs a new Material from mat with elm removed.

source
NeXLCore.edgeenergyMethod
edgeenergy(z::Int, ss::Int, alg::Type{<:NeXLAlgorithm} = FFASTDB)::Float64
edgeenergy(cxr::CharXRay, ::Type{<:NeXLAlgorithm}=FFASTDB)

Return the minimum energy (in eV) necessary to ionize the specified sub-shell in the specified atom or the ionized shell for the specified characteristic X-ray.

source
NeXLCore.elasticfractionMethod
elasticfraction(elm::Element, mat::Material, e0::Float64)::Float64

Computes the fraction of the total scattering cross-section associated with elm in mat at beam energy e0.

@incollection{armstrong1991quantitative, title={Quantitative elemental analysis of individual microparticles with electron beam instruments}, author={Armstrong, John T}, booktitle={Electron probe quantitation}, pages={261–315}, year={1991}, publisher={Springer} }

source
NeXLCore.electronfractionMethod
electronfraction(elm::Element, mat::Material)::Float64

The electron fraction as defined in:

@article{donovan2003compositional, title={Compositional averaging of backscatter intensities in compounds}, author={Donovan, John J and Pingitore, Nicholas E and Westphal, Andrew}, journal={Microscopy and Microanalysis}, volume={9}, number={3}, pages={202–215}, year={2003}, publisher={Cambridge University Press} }

source
NeXLCore.elementMethod
element(str::AbstractString)

Parses a string to determine if the string represents an Element by atomic number, symbol or name.

source
NeXLCore.energyFunction
 energy(ass::AtomicSubShell, ty::Type{<:NeXLAlgorithm}=FFASTDB)
energy(elm::Element, ss::SubShell, ty::Type{<:NeXLAlgorithm}=FFASTDB)

The edge energy in eV for the specified AtomicSubShell

Example:

julia> energy(n"Fe L3")
708.0999999999999
julia> energy(n"Fe", n"L3")
708.0999999999999

energy(elm::Element, tr::Transition)::Float64
energy(cxr::CharXRay)

The characteristic X-ray energy for the specified element / transition or characteristic X-ray.

source
NeXLCore.energyMethod
energy(z::Int, inner::Int, outer::Int)::Float64

Return energy (in eV) of the transition by specified inner and outer sub-shell index.

source
NeXLCore.existsMethod
exists(inner::SubShell, outer::SubShell)::Bool

Does a transition exist in our database for this pair of shells?

source
NeXLCore.fluorescenceyieldFunction

Represents the fractional number of X-rays emitted following the ionization of the sub-shell ionized via the characteristic X-ray z inner-outer. Due to cascades, inner does not necessarily equal ionized. The ionized subshell may transition to a valency in inner via a combination of Auger, fluorescence or Koster-Kronig transitions. The various different forms make assumptions about the relationship between ionized and inner, and about outer.

fluorescenceyield(ass::AtomicSubShell, alg::Type{<:NeXLAlgorithm}=CullenEADL)::Float64

The fraction of relaxations from the specified shell that relax via any radiative transition. (inner==ionized)

fluorescenceyield(cxr::CharXRay, alg::Type{<:NeXLAlgorithm}=CullenEADL)

The fraction of ionizations of inner(cxr) that relax via the one path cxr. ionized==inner && outer(cxr)

fluorescenceyield(ash::AtomicSubShell, cxr::CharXRay, alg::Type{<:NeXLAlgorithm} = CullenEADL)::Float64

The fractional number of cxr X-rays emitted (on average) for each ionization of ash. This makes no assumptions about inner, outer and ionized

source
NeXLCore.fluorescenceyieldMethod
fluorescenceyield(ass::AtomicSubShell, ::Type{Burhop1965})

An approximate expression for the K-shell fluorescence yield due to E.H.S Burhop, J. Phys. Radium, 16, 625 (1965). Seems reasonable.

source
NeXLCore.gunMethod
gun(::Type{T}, energy::Float64, width::Float64=1.0e-7, initial::Position=Position(0.0,0.0,-10.0), direction=Position(0.0,0.0,1.0)::T where {T <: Particle}

A helper to construct the initial Particle in a randomized Gaussian distribution.

source
NeXLCore.hasMethod
has(elm::Element, s::SubShell) =

Is the specified sub-shell occupied by one or more electrons in a ground-state atom of the specified element?

source
NeXLCore.hasMethod
has(elm::Element, tr::Transition)::Bool

Is the specified Transition available for the specified element?

Example:

@assert has(n"Fe L3-M5)
@assert !has(n"Fe N7-O9)
source
NeXLCore.image2stageMethod
image2stage(::Type{DefaultStageMapping}, stage_coord::Dict{Symbol,Any}, img_coord::Dict{Symbol,Any}, theta::Float64)

Given the stage coordinate at the center of the image stage_coord, the pixel coordinate of interest (in the same units as stage_coord) and the image rotation theta, compute the stage coordinate that would bring the pixel into the center of the image.

source
NeXLCore.ionizationcrosssectionFunction
ionizationcrosssection(ass::AtomicSubShell, energy::AbstractFloat, ty::Type{<:NeXLAlgorithm}=Bote2009)
ionizationcrosssection(z::Int, ss::Int, energy::AbstractFloat)

Computes the absolute ionization crosssection (in cm²) for the specified AtomicSubShell and electon energy (in eV) using the default algorithm.

Example:

julia> (/)(map(e->NeXLCore.ionizationcrosssection(n"Fe K",e),[10.0e3,20.0e3])...)
0.5672910174711278
source
NeXLCore.ionizationcrosssectionMethod
ionizationcrosssection(z::Int, shell::Int, energy::AbstractFloat, ::Type{Bote2009})

Compute the absolute ionization crosssection (in cm²) for the specified element, shell and electon energy (in eV).

source
NeXLCore.isstandardMethod
isstandard(kr::KRatio)::Boolean

Does this k-ratio have all the necessary basic properties required for use as a standard (:TakeOffAngle, and :BeamEnergy for both stdProps and unkProps and :Composition for unkProps.)

source
NeXLCore.jumpratioMethod
jumpratio(ashell::AtomicSubShell, ::Type{Poehn1985})

An implement of jump ratios attributed to

• Poehn, Wernisch, Hanke (1985) X-ray Spectrom 14(3):120, 1985

Compares reasonably over available range.

source
NeXLCore.jumpratioMethod
jumpratio(z::Int, ss::Int, ::Type{FFASTDB}) =

Returns the jump ratio for the specified shell by index K=>1, L1=>2, L2=>3, ..., M5=>9.

source
NeXLCore.klinewidthsMethod
klinewidths(elm::Element)

Linewidth of the K shell according to Bambynek'1974 errata to Bambynek 1972. Shown to be reliable for Z>36 or so.

source
NeXLCore.labeledMethod
labeled(mat::Material)

Transform the mass fraction representation of a material into a Dict{MassFractionLabel,AbstractFloat}

source
NeXLCore.loadlegendMethod

Loads a legend image from the package source directory. Some legends include "LinearScale.png", "LogScale.png", "Log3BandBright.png", "Log3BancColorblind.png".

source
NeXLCore.loadsmithsoniandataMethod
loadsmithsoniandata(; clean=false)

Load compositional data associated with the Smithsonian Microbeam Standards data set as a DataFrame. Setting clean=true will replace "<0.XXX" with 0.0, replace "missing" with 0.0 and parse string values as Float64. The data source is https://naturalhistory.si.edu/research/mineral-sciences/collections-overview/reference-materials/smithsonian-microbeam-standards

source
NeXLCore.macFunction
mac(mat::Material, xray::Union{Float64,CharXRay}, alg::Type{<:NeXLAlgorithm}=FFASTDB)::Float64

Compute the material MAC using the standard mass fraction weighted formula.

source
NeXLCore.macMethod

mac(zz::Int, ev::Float64, ::Type{DTSA})::Float64

Calculate the elemental MAC using Heinrich's IXCOM 11 formula as implemented by Myklebust in DTSA.

source
NeXLCore.macMethod
mac(elm::Element, energy::Float64, alg::Type{<:NeXLAlgorithm} = FFASTDB)::Float64
mac(elm::Element, cxr::CharXRay, alg::Type{<:NeXLAlgorithm} = FFASTDB)::Float64

The mass absorption coefficient for an X-ray of the specified energy (eV) or characteristic X-ray line in the specified element. In cm²/g.

source
NeXLCore.macUMethod
macU(elm::Element, energy::Float64, alg::Type{<:NeXLAlgorithm} = FFASTDB)
macU(elm::Element, cxr::Float64, alg::Type{<:NeXLAlgorithm} = FFASTDB)::UncertainValue
macU(elm::Element, cxr::CharXRay, alg::Type{<:NeXLAlgorithm} = FFASTDB)::UncertainValue

The mass absorption coefficient (with uncertainty estimate) for an X-ray of the specified energy (eV) or characteristix X-ray line in the specified element.

source
NeXLCore.matchesMethod
matches(kr::Union{KRatio, KRatios}, std::Standard)::Bool

Is std a match for kr? (Same element, same standard, same lines, same :BeamEnergy & :TakeOffAngle )

stdProps[:Composition] items match if 1) are Materials with almost the same mass-fractions; 2) they are equivalent AbstractString values. The later is for

source
NeXLCore.materialMethod
 material(str::String, density::Float64)

Similar to mat"..." except requires you to specify a density.

source
NeXLCore.materialMethod
material(
name::AbstractString,
massfrac::Pair{Element,<:AbstractFloat}...;
properties::Dict{Symbol,Any}=Dict{Symbol,Any)(),
atomicweights::Dict{Element, <:AbstractFloat}=Dict{Element,Float64}(),
density::Union{Missing, AbstractFloat}=missing,
description::Union{Missing, AbstractString}=missing,
pedigree::Union{Missing, AbstractString}=missing,
conductivity::Union{Missing, Symbol}=missing, # :Conductor, :Semiconductor, :Insulator
)
material(
name::AbstractString,
massfrac::Dict{Element,<:AbstractFloat};
properties::Dict{Symbol,Any}=Dict{Symbol,Any)(),
atomicweights::Dict{Element, <:AbstractFloat}=Dict{Element,Float64}(),
density::Union{Missing, AbstractFloat}=missing,
description::Union{Missing, AbstractString}=missing,
pedigree::Union{Missing, AbstractString}=missing,
conductivity::Union{Missing, Symbol}=missing, # :Conductor, :Semiconductor, :Insulator
)

Constuct a material from mass fraction pairs.

source
NeXLCore.materiallabelsMethod
materiallabels(ty::Type{<:MaterialLabel}, material::String, uvs::Union{LabeledValues,UncertainValues})

Useful for extracting the MaterialLabel[s] associated with a single material.

source
NeXLCore.meanfluorescenceyieldMethod
meanfluorescenceyield(elm::Element, sh::Shell)
meanfluorescenceyield(elm::Element, sh::Shell, ::Type{Bambynek1972})

Mean fluorescence yields from Bambynek in Reviews of Modern Physics 44(4), 1972

source
NeXLCore.mf2compMethod
mf2comp(material::String, mfs::UncertainValues)::UncertainValues
mf2comp(mat::Material)::UncertainValues

Converts a material composition expressed in the mfs UncertainValues struct into a handful of common representations including normalized mass fraction, atomic fraction, mean Z and mean atomic number. The second form converts a Material into UncertainValues form.

source
NeXLCore.minpropertiesMethod
minrequired(::Type{XXX})

Returns the minimum required properties. Other classes implement this to check whether a Spectrum or Dict has all the necessary properties for the specified algorithm or data structure.

source
NeXLCore.mixtureMethod
mixture(mat::String, mix::Pair{UncertainValues,UncertainValue}...)::UncertainValues
mixture(mat::String, mix::Pair{Material, UncertainValue}...)::UncertainValues

Converts a mixture of materials into a material. In the first case, the input materials are in UncertainValues representation. In the second case, the Material instances are converted to the UncertainValues representation. In each case, the first item in the Pair represents a material and the second the mass fraction of that material in the mixture.

source
NeXLCore.nameFunction
name(cxrs::AbstractVector{CharXRay}, byfamily=false)

An abbeviated name for a collection of CharXRay.

source
NeXLCore.normalizedmassfractionMethod
normalizedmassfraction(mat::Material)::Dict{Element, AbstractFloat}

Return the normalized mass fraction as a Dict{Element, AbstractFloat}. Negative values are set to zero.

source
NeXLCore.obystoichiometryMethod
obystoichiometry(elms::Pair{Element, <:AbstractFloat}..., valences = NeXLCore.defaultValences)
obystoichiometry(elms::Dict{Element, <:AbstractFloat}; valences = NeXLCore.defaultValences)

Compute O-by-stoichiometry from the provided mass fractions of elements.

Example:

obystoichiometry(n"Mg"=>0.1099, n"Al"=>0.0443, n"Si"=>0.1941, n"Ca"=>0.1034, n"Fe"=>0.0756)
0.39582340257233467
source
NeXLCore.parsexMethod
parsex(str::AbstractString)::Union{Element, SubShell, AtomicSubShell, Transition, CharXRay}

Implements compile time parsing of strings to produce Element, SubShell, AtomicSubShell, Transition or CharXRay objects. The only oddity is that to get SubShell("K") you must enter n"K1" to differentiate the sub-shell from potassium. parsex(...) provides the implementation for n"...".

Examples:

• n"Fe" => Element
• n"L3" => SubShell
• n"K" => Element
• n"K1" => SubShell ("K" would be the element potassium)
• n"Fe K" => AtomicSubShell ("K" not ambiguous here...)
• n"Fe L3" => AtomicSubShell
• n"L3-M5" => Transition
• n"Fe L3-M5" => CharXRay.
source
NeXLCore.particleFunction
particle(mat::Material, radius::Float64, substrate::Union{Nothing,Material} = nothing)

Construct a spherical particle at the origin with an optional bulk substrate.

source
NeXLCore.pureMethod
pure(elm::Element)

Construct a Material to represent a pure element.

Example:

> pure(n"Fe")
source
NeXLCore.relativeionizationcrosssectionMethod
relativeionizationcrosssection(z::Int, ss::Int, ev::AbstractFloat)
relativeionizationcrosssection(ass::AtomicSubShell, ev::AbstractFloat, ::Type{Pouchou1991})

An approximate expression based of Pouchou and Pouchoir's 1991 (Green Book) expression for the ionization crosssection plus an additional factor for sub-shell capacity.

Example:

> (/)(map(e->NeXLCore.relativeionizationcrosssection(n"Fe K",e),[10.0e3,20.0e3])...)
0.5982578301818324
source
NeXLCore.renameMethod
rename(mat::Material, newname::AbstractString)

Creates a replica of mat but with a new name.

source
NeXLCore.shellMethod
shell(ass::AtomicSubShell)

Example:

julia> shell(n"Fe L3")
Shell(L)
source
NeXLCore.shellMethod
shell(sh::SubShell)

Returns the appropriate Shell object.

Example:

julia> shell(n"M5")
Shell[M]
source
NeXLCore.shellMethod
shell(tr::Transition)

Return the shell (Shell(1), Shell(2),...) associated with the transition's inner shell.

Example:

@assert shell(n"K-L3")==Shell(1)
@assert shell(n"M5-N7")==Shell(3)
source
NeXLCore.splitbyshellMethod
splitbyshell(cxrs)

Splits a collection of CharXRay into a dictionary where the key is the inner AtomicSubShell and the values are a vector of CharXRay for that inner shell.

source
NeXLCore.stage2imageMethod
stage2image(::Type{DefaultStageMapping}, stage_coord::Dict{Symbol,Any}, centered_coord::Dict{Symbol,Any}, theta::Float64)

stage2image(...) is the inverse function of image2stage(...). Given the stage coordinate of the center of the image stage_coord and the stage coordinate that would center the pixel of interest centered_coord, compute the pixel coordinate corresponding to the centered_coordinate when the stage is at stage_coord.

source
NeXLCore.standardizeMethod
standardize(kr::KRatio, std::KRatio)::KRatio
standardize(kr::KRatios, std::KRatio)::KRatios
standardize(kratios::Union{AbstractVector{KRatio},AbstractVector{<:KRatios}}, stds::AbstractVector{KRatio})

If the std::KRatio is a suitable match for kr then kr is restandardized using std. Otherwise, the original KRatio or KRatios is returned.

source
NeXLCore.subshellMethod
subshell(name::AbstractString)::SubShell

Returns a SubShell structure from a string of the form "K", "L1", ...., "O11"

source
NeXLCore.subshellindicesMethod
subshellindices(z::Int, alg::Type{<:NeXLAlgorithm} = FFASTDB)

Return the shells occupied in a neutral, ground state atom of the specified atomic number.

source
NeXLCore.take_stepMethod
take_step(p::T, reg::Region, 𝜆::Float64, 𝜃::Float64, 𝜑::Float64)::Tuple{T, Region, Bool} where { T<: Particle}

Returns a Tuple containing a new Particle and the child-most Region in which the new Particle is found based on a scatter event consisting a translation of up to 𝜆 mean-free path along a new direction given relative to the current direction of p via the scatter angles 𝜃 and 𝜑.

Returns the updated Particle reflecting the last trajectory step and the Region for the next step.

source
NeXLCore.thin_filmMethod
thin_film(prs::Pair{Material, Float64}...; substrate::Union{Nothing,Material} = nothing)

Construct sample consisting of one or more thin films on an optional bulk substrate.

source
NeXLCore.trajectoryMethod

trajectory(p::T, reg::Region, scf::Function=transport; minE::Float64=50.0) where {T <: Particle} trajectory(eval::Function, p::T, reg::Region, scf::Function, terminate::Function) where { T <: Particle }

Run a single particle trajectory from p to minE or until the particle exits reg.

• eval(part::T, region::Region) a function evaluated at each scattering point
• p defines the initial position, direction and energy of the particle (often created with gun(T, ...))
• reg The outer-most region for the trajectory (usually created with chamber())
• scf A function from (<:Particle, Material) -> ( λ, θ, ϕ, ΔE ) that implements the transport dynamics
• minE Stopping criterion
• terminate a function taking T and Region that returns false except on the last step (like terminate = (pc,r)->pc.energy < 50.0)
source
NeXLCore.transitionMethod
transition(inner::SubShell, outer::SubShell)::Transition

Return a Transition structure from an inner and outer shell. This function tests to ensure that the Transition is a known transition.

source
NeXLCore.transmissionFunction
transmission(flm::Film, xrayE::AbstractFloat, θ::AbstractFloat, alg::Type{<:NeXLAlgorithm}=FFASTDB) =

Compute the transmission fraction of an X-ray at the specified angle through a Film.

source
NeXLCore.transmissionMethod
transmission(flm::Film, cxr::CharXRay, θ::AbstractFloat) =

Compute the transmission fraction of an X-ray at the specified angle through a Film.

source
NeXLCore.transportFunction
transport(pc::Electron, mat::Material, ecx=Liljequist1989, bethe=JoyLuo)::NTuple{4, Float64}

The default function defining elastic scattering and energy loss for an Electron.

Returns ( λ, θ, ϕ, ΔE) where λ is the mean path length, θ is the elastic scatter angle, ϕ is the azimuthal elastic scatter angle and ΔE is the energy loss for transport over the distance λ.

source
NeXLCore.weightMethod
weight(::Type{<:WeightNormalization}, cxr::CharXRay)

where WeightNormalization is one of the following:

• NormalizeByShell normalizes the sum of all the weights associated with a shell to unity.
• NormalizeBySubShell normalizes the sum of all the weights associated with each sub-shell to unity.
• NormalizeToUnity normalizes intensities such that the most intense line in each shell to 1.0.

Computes a rough estimate of the relative intensity of cxr relative to the other characteristic X-rays in its shell, sub-shell etc. The different WeightNormalization modes reflect different ways that the weight(...) function is used.

The difference between fluorescenceyield(...) and weight(...) is that

• fluorescenceyield assumes that a sub-shell in the atom is already ionized
• weight also considers the relative likelihood of ionization of each sub-shell assuming an overvoltage of 4.0.
source
NeXLCore.zMethod
z(mat::Material)

Computes the mean atomic number for a material. (Naive algorithm.)

source
NeXLCore.zbarMethod
zbar(mat::Material)::Float64

The mean atomic number as calculated using

@article{donovan2003compositional, title={Compositional averaging of backscatter intensities in compounds}, author={Donovan, John J and Pingitore, Nicholas E and Westphal, Andrew}, journal={Microscopy and Microanalysis}, volume={9}, number={3}, pages={202–215}, year={2003}, publisher={Cambridge University Press} }

or, equivalently,

@article{saldick1954backscattering, title={Backscattering from Targets of Low Atomic Number Bombarded with 1—2 Mev Electrons}, author={Saldick, Jerome and Allen, Augustine O}, journal={The Journal of Chemical Physics}, volume={22}, number={10}, pages={1777–1777}, year={1954}, publisher={American Institute of Physics} }

source
NeXLCore.δσδΩMethod
δσδΩ(::Type{ScreenedRutherford}, θ::Float64, elm::Element, E::Float64)::Float64

The differential screened Rutherford cross-section per atom.

source
NeXLCore.ηMethod
η(elm::Element, e0::Real)

The default backscatter coefficient algorith which is August1989η.

source
NeXLCore.ηMethod
η([ty::Type{<:BackscatterCoefficient},] mat::Material, e0::Float64)::Float64 =

Calculate the backscatter coefficient for a material using Armstrong's 1991 algorithm for materials.

@incollection{armstrong1991quantitative, title={Quantitative elemental analysis of individual microparticles with electron beam instruments}, author={Armstrong, John T}, booktitle={Electron probe quantitation}, pages={261–315}, year={1991}, publisher={Springer} }

source
NeXLCore.λMethod
λ(ty::Type{<:ElasticScatteringCrossSection}, θ::Float64, elm::Element, E::Float64)::Float64

The mean free path. The mean distance between elastic scattering events.

source
NeXLCore.λₜᵣMethod
λₜᵣ(ty::Type{<:ElasticScatteringCrossSection}, θ::Float64, elm::Element, E::Float64)::Float64
λₜᵣ(ty::Type{<:ScreenedRutherfordType}, mat::Material, elm::Element, E::Float64)

The transport mean free path. The mean distance in the initial direction of propagation between elastic scattering events.

• N is the number of atoms per cm³
• E is the electron kinetic energy in eV
source
NeXLCore.σₜMethod
σₜ(::Type{ScreenedRutherford}, elm::Element, E::Float64)
σₜ(::Type{Liljequest1989}, elm::Element, E::Float64)
σₜ(::Type{Browning1991}, elm::Element, E::Float64)
σₜ(::Type{Browning1994}, elm::Element, E::Float64)

Total cross section per atom in cm².

source
NeXLCore.σₜᵣMethod
σₜᵣ(::Type{ScreenedRutherford}, elm::Element, E::Float64)

The transport cross-section in cm². The transport cross-section gives the correct transport mean free path - the mean free path in the direction of initial propagation after an infinite number of collisions.

source
NeXLUncertainties.asaFunction
NeXLUncertainties.asa(::Type{DataFrame}, mats::AbstractArray{Material}, mode=:MassFraction)

Tabulate the composition of a list of materials in a DataFrame. One column for each element in any of the materials.

mode = :MassFraction | :NormalizedMassFraction | :AtomicFraction.
source
NeXLUncertainties.asaMethod
NeXLUncertainties.asa(::Type{DataFrame}, mat::Material)

Tabulate the composition of this Material as a DataFrame. Columns for material name, element abbreviation, atomic number, atomic weight, mass fraction, normalized mass fraction, and atomic fraction. Rows for each element in mat.

source
NeXLUncertainties.asaMethod
NeXLUncertainties.asa(::Type{LaTeXString}, mat::Material; parsename=true, order = :massfraction | :z)

Converts a Material into a LaTeXString. parsename controls whether the material name is assumed to be a parsable chemical formula (according to \ce{...}).

source
Statistics.meanMethod
Statistics.mean(mats::AbstractArray{<:Material})

If the mass fractions for all the elements in all mats have non-zero uncertainties then the variance weighted mean is calculated and the result will have associated uncertainties. Otherwise, the straight floating-point mean is calculated and the result won't have uncertainties. This is because even a single value with zero uncertainty will poison the variance weighted mean (produce a NaN).

source
NeXLCore.@n_strMacro
n"Fe"

Implements compile time parsing of strings to produce Element, SubShell, AtomicSubShell, Transition or CharXRay objects. The only oddity is that to get SubShell("K") you must enter n"K1" to differentiate the sub-shell from potassium. Examples:

n"Fe" == elements[26]
n"K" == elements[19]
n"K1" == subshell("K")
n"L3" == subshell("L3")
n"Fe L3" == AtomicSubShell(elements[26],subshell("L3"))
n"L3-M5" == Transition(SubShell("L3"),"SubShell("M5"))
n"Fe L3-M5" == CharXRay(elements[26],Transition(SubShell("L3"),"SubShell("M5"))
source