NeXLCore Types, Functions and Methods

NeXLCore.Log3BandBrightConstant

Dave Bright's palette suited to use with log base-10 transformed data on the range [0.0, 1.0]. The 256ᵗʰ entry is yellow for an error condition.

NeXLCore.Log3BandColorblindConstant

A colorblind friendly palette suited to use with log base-10 transformed data on the range [0.0, 1.0].

NeXLCore.alltransitionsConstant
alltransitions

A complete list of all the transitions present in one or more elements.

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.)

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".

NeXLCore.transitionsbyshellConstant
transitionsbyshell

A Dict{Char,Tuple{Transition}} mapping shell name into a list of transitions. Keys are Shell objects.

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.

NeXLCore.AtomicFractionType

Naive atomic fraction material Z model

For more details see Mean Z algorithm in J.J. Donovan, N.E. Pingitore, Microsc. Microanal. 2002 ; 8 , 429 (also see Microsc. Microanal. 27 (Suppl 1), 2021))

NeXLCore.AtomicSubShellType
AtomicSubShell

Represents a specific ground-state occupied sub-shell in a specific element.

NeXLCore.BackscatterCoefficientType
η(::Type{<:BackscatterCoefficient}, elm::Element, e0::Real)

Abstract type to represent backscatter coefficient algorithms.

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."

NeXLCore.BetheType

The Bethe algorithm of kinetic energy loss by electrons.

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} }

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} }

NeXLCore.Browning1991Type

Browning's scattering cross section

Appl. Phys. Lett. 58, 2845 (1991); https://doi.org/10.1063/1.104754

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} }

NeXLCore.CharXRayType
CharXRay

Represents a specific known characteristic X-ray in a specific element.

NeXLCore.DefaultStageMappingType

The DefaultStageMapping assumes a matching Cartesian coordinate system for both the stage and image. It only assumes :X, :Y stage motion.

NeXLCore.Donovan2002Type

Donovan's recommended material Z model

For more details see Mean Z algorithm in J.J. Donovan, N.E. Pingitore, Microsc. Microanal. 2002 ; 8 , 429 (also see Microsc. Microanal. 27 (Suppl 1), 2021))

NeXLCore.ElasticFractionType

Elastic fraction material Z model

For more details see Mean Z algorithm in J.J. Donovan, N.E. Pingitore, Microsc. Microanal. 2002 ; 8 , 429 (also see Microsc. Microanal. 27 (Suppl 1), 2021))

NeXLCore.ElectronFractionType

Electronic fraction material Z model

For more details see Mean Z algorithm in J.J. Donovan, N.E. Pingitore, Microsc. Microanal. 2002 ; 8 , 429 (also see Microsc. Microanal. 27 (Suppl 1), 2021))

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.

NeXLCore.ElementByStoichiometryType
ElementByStoichiometry

Computes the mass-fraction of an element which is related by stoichiometric rules (valence-rules) to the other elements in the material.

NeXLCore.FilmType

A structure defining a thin film or layer of a Material.

f = Film(pure(n"C"), 2.0e-7) # 2 nm of nominal Calculated material(f) => pure C thickness(f) => 2.0e-7 massthickness(f) => 3.642e-7 g/cm²

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} }

NeXLCore.JoyLuoType

The Joy-Luo algorithm of Bethe kinetic energy loss by electrons. SCANNING Vol. 11, 176-180 (1989)

NeXLCore.KRatioType
KRatio(
    xray::CharXRay,
    unkProps::Dict{Symbol,<:Any},
    stdProps::Dict{Symbol,<:Any},
    standard::Material,
    kratio::AbstractFloat,
)

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
:TakeOffAngle in radians
: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.

Methods:

> element(kr)
> xrays(kr)
> standard(kr)
> elms(KRatioBase[...])
> NeXLUncertainties.value(kr::KRatio)
> NeXLUncertainties.σ(kr::KRatio)
> nonnegk(kr::KRatio)
> Statistics.mean(krs::AbstractVector{KRatio})::UncertainValue
> Base.getindex(krs::AbstractVector{KRatio}, cxr::CharXRay)
> strip(krs::AbstractVector{KRatio}, els::Element...)::Vector{KRatio}
> asa(::Type{DataFrame}, krs::AbstractVector{KRatio})::DataFrame
NeXLCore.KRatioBaseType

The members in common between KRatio and KRatios

> element(kr)
> xrays(kr)
> standard(kr)
> elms(KRatioBase[...])
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.

Methods:

> Base.getindex(krs::KRatios, idx::Int...)
> Base.getindex(krs::KRatios, ci::CartesianIndex)
> Base.size(krs::KRatios, [idx::Int])
> Base.CartesianIndices(krs::KRatios)
> normalizek(krs::AbstractVector{<:KRatios}; norm::Float32=1.0f)::Vector{KRatios}
> normalizek(krs::AbstractVector{KRatio}; norm::Float32=1.0f)::Vector{KRatio}
> brightest(krs::Union{KRatios, KRatio})
> colorize(krs::AbstractVector{<:KRatios}, red::Element, green::Element, blue::Element, normalize=:All[|:Each])
> colorize(krs::AbstractVector{<:KRatios}, elms::AbstractVector{Element}, normalize=:All)
> Base.getindex(krs::AbstractVector{<:KRatios}, elm::Element) # Gray scale image
> Base.getindex(krs::AbstractVector{<:KRatios}, red::Element, green::Element)  # Red-green image
> Base.getindex(krs::AbstractVector{<:KRatios}, red::Element, green::Element, blue::Element) # RGB image
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} }

NeXLCore.Lifshin1974Type

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

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)

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.} }

NeXLCore.MFtoNMFType
MFtoNMF

Mass fraction to normalized mass fraction measurement model.

NeXLCore.MatStatsType
MatStats

Computes the mean atomic number (MeanZ) and mean atomic weight (MeanAz).

NeXLCore.MaterialType

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

By default, Material assumes nominal terrestrial atomic weights. However, it is possible to assign custom atomic weights on a per element-basis for non-terrestrial materials.

The mass fraction and atomic weight are immutable but the Properties can be modified.

Material(
    name::AbstractString,
    massfrac::AbstractDict{Element,U},
    atomicweights::AbstractDict{Element,V} = Dict{Element,Float64}(),
    properties::AbstractDict{Symbol,Any} = Dict{Symbol,Any}(),
) where { U <: AbstractFloat, V <: AbstractFloat }

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
:OtherUserProperties # Other properties can be defined as needed
NeXLCore.MaterialMethod
Material(d::Dict)

Construct a Material from a Dict created by NeXLUncertainties.asa(Dict, mat::Material)

NeXLCore.MaterialFractionLabelType
MaterialFraction

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

NeXLCore.MaterialLabelType
MaterialLabel

The abstract type associated with Labels with material and element members.

NeXLCore.MaterialsType
Materials(
    name::AbstractString,
    els::AbstractArray{Element},
    ::Type{U},
    dims::Tuple;
    atomicweights::AbstractDict{Element,V} = Dict{Element,Float64}(),
    properties::AbstractDict{Symbol,Any} = Dict{Symbol,Any}(),
) where {U<:AbstractFloat, V<:AbstractFloat}

A type to represent the composition of multiple points as a complement to KRatios and HyperSpectrum. The data is stored in a much more memory efficient manner than Array{Material} would but can be accessed either by coordinate like mats[1,2] returning a Material or by element like mats[n"Fe"] returning an Array of mass fraction values.

NeXLCore.NeXLBremsstrahlungType

An abstract structure that implements

NeXLCore.bremsstrahlung(::Type{<:NeXLBremsstrahlung}, e::AbstractFloat, e0::AbstractFloat, elm::Element; kwargs...)
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
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
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
NeXLCore.NormalizeRawType

NormalizeRaw returns the raw transition probabilities - The probability of seeing the specified X-ray given one ionization of the specified shell.

NeXLCore.NormalizeToUnityType

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

Example: weight(NormalizeToUnity, n"Fe L3-M5")==1.0 max(cxr=>weight(NormalizeBySubShell, cxr), characteristic(n"Fe", ltransitions))==1.0

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.

NeXLCore.PositionType

Position : A point in 3-D. Ultimately, derived from StaticArray.

NeXLCore.Pouchou1991ηType

The model for Pouchou's 1991 model ("Green Book") of the BackscatterCoefficient.

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.

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} }

NeXLCore.RegionType
Region

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

NeXLCore.ScreenedRutherfordTypeType

Basic screened Rutherford algorithm where V(r) = (-Ze²/r)exp(-r/R) where R=a₀Z⁻¹/³ is solved using the first Born approximation.

NeXLCore.ShellType
Shell

Represents the K, L, M, N etc atomic shell

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} }

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}, }

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} }

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} }

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"

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.

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"K1",n"L3")
tr2   = Transition(SubShell(1),SubShell(4))
@assert tr1==tr2
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} }

NeXLCore.WeightNormalizationType

The abstract type WeightNormalization is the base type for structs identifying the various different useful ways in which line weight (relaxation) data can be represented.

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} }

NeXLCore.XRayType

An abstract type for X-rays like CharXRay and Continuum

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} }

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

Convert a DTSA-II style string into a material.

Base.delete!Method
Base.delete!(db::SQLite.DB, ::Type{Material}, matname::AbstractString)

Delete the named Material from the database.

Base.findallMethod
Base.findall(db::SQLite.DB, ::Type{Material}, like::AbstractString)::Vector{String}

Returns the names of all Materials in the database which match the like string.

like uses SQL like syntax where % and _ have special meanings. Searches are case-insenstive.

  • '%' matches zero or more characters
  • '_' matches one character

Using the RUFF database:

  • findall(db, Material, "Al%") matches all 37 materials starting with the letters 'a' then 'l' (case-insenstive).
  • findall(db, Material, "Al%ite") matches all materials starting with the letters 'a' then 'l' and ending with 'ite'.
  • findall(db, Material, "Al__rsite") matches "Alforsite" and "Alpersite" while findall(db, Material, "Al%rsite") matches these two plus Alarsite.
Base.findallMethod
Base.findall(db::SQLite.DB, ::Type{Material}, prs::Pair{Element, <:Tuple{<:Real,<:Real}}...)::Vector{<:Material}
Base.findall(db::SQLite.DB, ::Type{Material}, filt::Dict{Element, <:Tuple{<:Real,<:Real}})::Vector{<:Material}
Base.findall(db::SQLite.DB, mat::Material, tol::Float64)::Vector{<:Material}

Returns all the Materials in the database that have mass fractions for the specified elements within a range. The first two versions take a collection of Element, Tuple pairs that specify the range of mass fractions for each element.

Examples:

julia> findall(db, Material, Dict(n"Bi"=>(0.1,0.5), n"Cu"=>(0.2,0.3)))
3-element Vector{Material{UncertainValue, Float64}}:
 Favreauite[Bi=0.1488,Se=0.2249,Cu=0.2715,Pb=0.1475,O=0.2051,H=0.0022]
 Miharaite[Bi=0.2275,Cu=0.2767,S=0.2094,Fe=0.0608,Pb=0.2256]
 Mrázekite[Bi=0.4641,Cu=0.2117,P=0.0688,O=0.2487,H=0.0067]

julia> findall(db, mat"NaAlSi3O8", 0.01)
4-element Vector{Material{UncertainValue, Float64}}:
 Albite[Al=0.1029,Na=0.0877,Si=0.3213,O=0.4881]
 Kumdykolite[Al=0.1029,Na=0.0877,Si=0.3213,O=0.4881]
 Lingunite[Al=0.1029,Na=0.0877,Si=0.3213,O=0.4881]
 Monalbite[Al=0.1029,Na=0.0877,Si=0.3213,O=0.4881]
Base.findfirstMethod
Base.findfirst(krs::AbstractVector{<:KRatioBase}, cxr::CharXRay)

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

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

Does this material contain this element?

Base.haskeyMethod
haskey(mat::Material, sym::Symbol)

Does this material have this property defined?

Base.haskeyMethod
Base.haskey(db::SQLite.DB, ::Type{Material}, matname::AbstractString)::Bool

Is a Material named matname in the database?

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

Are these Material(s) equivalent to within atol?

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

Return an interator over the elements in the Material.

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".

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.

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

Generate a randomize material.

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.

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.

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

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

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

Base.readMethod
Base.read(db::SQLite.DB, ::Type{Material}, pkey::Int)::Material
Base.read(db::SQLite.DB, ::Type{Material}, matname::AbstractString)::Material

Read a Material from the database by index or by name.

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.

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.

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.

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(...)`.

Base.writeMethod
Base.write(db::SQLite.DB, ::Type{Material}, mat::Material)::Int

Add a Material to the SQLite database. Will not overwrite a previously define definition. To replace a definition, first delete!(db, Material, matname). Returns the database key associated with the Material.

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.

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

Plot either the :Energy or :Weight associated with the specified transitions over the range of supported elements.

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

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

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.

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

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

NeXLCore.LinearScaleMethod

Tranforms numbers on the range [0.0, 1.0] onto a linear gray scale palette. NaNs are plotted in yellow.

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.

NeXLCore.Log3BandCMethod

Tranforms numbers on the range [1.0e-3, 1.0] into a colorblind friendly palette using a log base-10 transform. NaNs are plotted in yellow.

NeXLCore.LogScaleMethod

Tranforms numbers on the range [1.0e-3, 1.0] onto a Log base-10 gray scale palette. NaNs are plotted in yellow.

NeXLCore.RₐMethod
Rₐ(elm::Element)

Classic formula for the atomic screening radius in cm

NeXLCore._mp_level3Method

Parses "something⋅#H2O" or "something⋅#OH" or "something.PO4" or "something", replace "X¹⁺", "X²⁺" and "X³⁺" etc with plain old "X"

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

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

NeXLCore.aMethod
a(elm::Element)

Return the mean atomic weight of the Element in amu

NeXLCore.aMethod
a(mat::Material)

Computes the mean atomic weight for a material.

NeXLCore.allmaterialsMethod
allmaterials(reg::Region)

Generates a list of all the unique materials in a sample Region.

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

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

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.

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
NeXLCore.atomicfractionMethod
atomicfraction(mat::Material{U,V})::Dict{Element,U}

Return the composition in atomic fraction representation.

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).

NeXLCore.atomicsubshellMethod
atomicsubshell(str::AbstractString)::AtomicSubShell

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

NeXLCore.atomicsubshellMethod
atomicsubshell(elm::Element, ss::SubShell)::AtomicSubShell

Construct an AtomicSubShell from from an Element and a SubShell.

NeXLCore.atomicsubshellsMethod
 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
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.

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

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

NeXLCore.bremsstrahlungMethod
bremsstrahlung(::Type{<:NeXLBremsstrahlung}, e::AbstractFloat, e0::AbstractFloat, elm::Element)

Calcualtes the Bremsstrahlung (continuum) at an energy e for an incident electron of e0 in the element elm.

The supported models include: Kramers1923, Lifshin1974, Reed1975, Smith1975, Small1987, Trincavelli1997, Castellano2004a, Castellano2004b

Evaluating the models I find that Castellano2004a, Trincavelli1997 work well with the Riveros1993 matrix correction algorithm and the AP33Tabulation window. Smith1975 works surprisigly well with the CitZAF matrix correction model. Other old models based on Si(Li) data tend to not do too well at lower energies. This shouldn't surprise anyone as these models were often based on data from Be window detectors. Castellano2004a and Trincavelli1997 were designed around the Riveros1993 matrix correction model and don't perform well using CitZAF.

My current recommendation is either Castellano2004a or Riveros1993.

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)

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.

NeXLCore.buildMaterialTablesMethod

buildMaterialTables(db::SQLite.DB)

Build the necessary tables in a SQLite database to hold Materials. Safe! Only creates the tables if they don't exist.

NeXLCore.bulkMethod
bulk(mat::Material)

Construct a bulk homogeneous sample at the origin.

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.

NeXLCore.chamberFunction
chamber(dim=100.0)

Construct a high vacuum chamber to act as the outer-most Region.

NeXLCore.charactericXRayAvailableMethod
characteristicXRayAvailable(z::Int, inner::Int, outer::Int)::Float64

Is the weight associated with this transition greater than zero?

NeXLCore.characteristicMethod
characteristic(str::AbstractString)::CharXRay

Create a CharXRay structure from a string like "Fe K-L3" or "U L3-M5".

NeXLCore.childmost_regionMethod
childmost_region(reg::Region, pos::Position)::Region

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

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.

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.

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.

NeXLCore.compareMethod
compare(unk::Material, known::Material)::DataFrame

Compare two compositions in a DataFrame.

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

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

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.

NeXLCore.comptonDifferentialMethod

comptonDifferential(θ, E)

Differential crosssection dσ/dΩ = dσ/(sin(θ) dθ dϕ) for Compton scattering in cm².

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.

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.

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.

NeXLCore.configurationMethod
configuration(elm::Element)

The configuration of the shell occupancy in a specific ground-state element.

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}.

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

Constructs a new Material from mat with elm removed.

NeXLCore.densityMethod
density(elm::Element)

Return the nominal density for the element in g/cm³.

NeXLCore.densityMethod
density(mat::Material)

Return the density in g/cm³ (Might be 'missing')

NeXLCore.eachelementFunction
eachelement()

Return the range of atomic numbers for which there is a complete set of energy, weight, MAC, ... data

NeXLCore.eachsubshellMethod
eachsubshell(elm::Element)

Iterates over each sub-shell that is present in an element.

NeXLCore.edgeenergyMethod
edgeenergy(cxr::CharXRay)

Returns the energy associated with the inner shell of this characteristic X-ray (eV).

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} }

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} }

NeXLCore.elementMethod
element(str::AbstractString)

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

NeXLCore.elementMethod
 element(ass::AtomicSubShell)

The Element associated with the specified sub-shell.

NeXLCore.elementMethod
element(cxr::CharXRay)

Return the element for this CharXRay.

NeXLCore.elementMethod
element(z::Int)::PeriodicTable.Element

Covert an atomic number into a PeriodicTable.Element

NeXLCore.elmsMethod
elms(mat::Material)

The elements with mass fraction ≠ 0.0 in mat.

NeXLCore.elmsMethod
elms(krs::Vector{KRatio})::Set{Element}

Return a set containing the elements present in krs.

NeXLCore.energyMethod
 energy(ass::AtomicSubShell)
 energy(elm::Element, ss::SubShell)

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.

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

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

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.

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

An alternative for M-line yields. Not alway reasonable.

NeXLCore.fluorescenceyieldMethod

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)::Float64

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

fluorescenceyield(cxr::CharXRay)

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

fluorescenceyield(ash::AtomicSubShell, cxr::CharXRay)::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

NeXLCore.fractionaluncertaintyMethod
fractionaluncertainty(::Type{MonatomicGas}, z::Integer, energy)

Determines from the element and energy, the approximate range of fractional uncertainties to associate with the total and photoelectric components of the mass attenuation coefficients for monatomic gas samples. Based on this table.

NeXLCore.fractionaluncertaintyMethod
fractionaluncertainty(::Type{SolidLiquid}, z::Integer, energy)

Determines from the element and energy, the approximate range of fractional uncertainties to associate with the total and photoelectric components of the mass attenuation coefficients for solids and liquids. Based on this table.

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.

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?

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)
NeXLCore.hasminrequiredMethod
hasminrequired(ty::Type, item::Union{Spectrum,Dict{Symbol,Any}})

Does this spectrum have the minimal set of required properties?

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.

NeXLCore.innerMethod
inner(cxr::CharXRay)

Return the inner AtomicSubShell associated with the specified CharXRay.

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

Computes the absolute ionization crosssection (in cm²/e⁻) for the specified AtomicSubShell and electon energy (in eV).

Example:

julia> (/)(map(e->NeXLCore.ionizationcrosssection(n"Fe K",e),[10.0e3,20.0e3])...)
0.5672910174711278
NeXLCore.ispureMethod
ispure(mat::Material)

Does mat represent a single element.

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.)

NeXLCore.jMethod
 j(ss::SubShell)

Total angular momentum quantum number

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.

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.

NeXLCore.kₑMethod
kₑ(E::Float64)

Electron wavenumber (inverse wavelength) in rad⋅cm⁻¹.

NeXLCore.lMethod
l(ss::SubShell)

Orbital angular momentum quantum number

NeXLCore.labeledMethod
labeled(mat::Material)

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

NeXLCore.listcustommacsMethod
listcustommacs(cxr::CharXRay)

Generated a list of available custom MACs for cxr in various elements.

listcustommacs(elms::Set{Element}|AbstractVector{Element}|Element...|Material)

Generate a list of available custom MACS for elements and X-rays both produced and absorbed by these elements.

NeXLCore.loadcustommac!Method
loadcustommac!(elm::Element, cxr::CharXRay, source::AbstractString)

Load the custom mass absorption coefficient associated with the specified CharXRay in the Element from the source. Use listcustommacs(cxr) to explore available MACs.

NeXLCore.loadcustommacs!Method
loadcustommacs!(source::AbstractString, elms::AbstractArray{Element})
loadcustommacs!(source::AbstractString, elm::Element)

Load custom macs from the database associated with the specified source.

Sources include "Henke1974", "Henke1982", "Bastin1989", "Henke1993", "Bastin1997", "Ruste1979", "Kohlhaas1970", "Weisweiler1975", "Bastin1990", "Bastin1988", "Poml2020", "Ruste1975", "Henke1982", "Farthing1990", "Sabbatucci2016"

Use listcustommacs(cxr) to explore available MACs.

NeXLCore.loadlegendMethod

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

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

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

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

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.

NeXLCore.macMethod
mac(elm::Element, energy::Float64)::Float64
mac(elm::Element, cxr::CharXRay)::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.

NeXLCore.macUFunction
macU(elm::Element, energy::Float64)
macU(elm::Element, cxr::CharXRay)::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.

NeXLCore.massfractionMethod
massfraction(mat::Material)::Dict{Element, AbstractFloat}

The mass fraction as a Dict{Element, AbstractFloat}

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

NeXLCore.materialMethod
material(
    name::AbstractString,
    massfrac::Dict{Element,U};
    properties::Union{Missing,Dict{Symbol,Any}} = missing,
    atomicweights::Union{Missing, Dict{Element,Float64}} = missing,
    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.

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

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

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.

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.

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.

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

An abbeviated name for a collection of CharXRay.

NeXLCore.nameMethod
name(elm::Element)

Return the name like "Hydrogen", "Helium",... for the Element.

NeXLCore.nameMethod
name(mat::Material)

Return a human friendly short name for the Material.

NeXLCore.nonnegMethod
nonneg(mat::Material{U,V}, elm::Element)::U where {U<:AbstractFloat,V<:AbstractFloat}
nonneg(mat::Material{UncertainValue,V}, elm::Element)::Float64 where {V<:AbstractFloat}
nonneg(mat::Material)::Material

Returns the mass fraction of elm::Element truncated to be non-negative. Negative values are returned as 0.0. Positive values are returned as is.

NeXLCore.normalizedMethod
normalized(mat::Material{U,V}, elm::Element, n=1.0)

Returns the mass fraction of 'elm::Element' such that the returned value is non-negative and the sum of all values is unity.

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

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

NeXLCore.normalizekMethod
normalizek(krs::AbstractVector{<:KRatios}; norm::Float32=1.0f)::Vector{KRatios}
normalizek(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.

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
NeXLCore.outerMethod
outer(cxr::CharXRay)

Return the outer AtomicSubShell associated with the specified CharXRay.

NeXLCore.parsedsmithsoniandataMethod
parsedsmithsoniandata()::Dict{String, Material}

Converts the data from loadsmithsoniandata() into Material representation.

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.
NeXLCore.particleFunction
particle(mat::Material, radius::Float64, substrate::Union{Nothing,Material} = nothing)

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

NeXLCore.pathlengthMethod
pathlength(el::Particle)

Length of the line segment represented by el.

NeXLCore.pureMethod
 material(str::String, density::Float64)
 nargs...
pure(elm::Element)

Construct a Material to represent a pure element.

Example:

> pure(n"Fe")
NeXLCore.random_point_insideMethod
random_point_inside(shape)

Generate a randomized point that is guaranteed to be in the interior of the shape.

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 occupancy.

Example:

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

Creates a replica of mat but with a new name.

NeXLCore.requiredbutmissingMethod
requiredbutmissing(ty::Type, item::Union{Spectrum,Dict{Symbol,Any}})

List any required but missing properties.

NeXLCore.resetmac!Method
ressetmac!(elm::Element, cxr::CharXRay)

Restore the default mass absorption coefficient for the specified element and characteristic X-ray.

NeXLCore.sampleMethod
sample(ch::Region)

Extracts the sample portion from within the chamber.

NeXLCore.setmac!Method
setmac!(elm::Element, cxr::CharXRay, mac::Float64)

Specify a custom mass absorption coefficient (MAC) for the specified X-ray in the specified element.

NeXLCore.shellMethod
shell(ass::AtomicSubShell)

Example:

julia> shell(n"Fe L3")
Shell(L)
NeXLCore.shellMethod
shell(cxr::CharXRay)

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

NeXLCore.shellMethod
shell(sh::SubShell)

Returns the appropriate Shell object.

Example:

julia> shell(n"M5")
Shell[M]
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)
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.

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.

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.

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

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

NeXLCore.symbolMethod
symbol(elm::Element)

Return the symbol like "H", "He", "Li", .... for the Element.

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.

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.

NeXLCore.trajectoryMethod

trajectory(eval::Function, 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)
NeXLCore.transitionMethod
transition(cxr::CharXRay)

Return the Transition structure associated with the specified CharXRay.

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.

NeXLCore.transmissionFunction
transmission(flm::Film, xrayE::AbstractFloat, θ::AbstractFloat = π/2, alg::Type{<:NeXLAlgorithm} = DefaultAlgorithm)
transmission(flm::Film, cxr::CharXRay, θ::AbstractFloat = π/2, alg::Type{<:NeXLAlgorithm} = DefaultAlgorithm)

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

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 λ.

NeXLCore.vₑMethod

Electron velocity in cm/s for the specified kinetic energy in eV.

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.
NeXLCore.wikidata_mineralsMethod
wikidata_minerals()::Dict{String, Material}

Mineral data based on a WikiData SPARQL query of minerals. Only those minerals which represented distinct (uniquely defined) compositions are included. Replicas were removed.

Also includes :Class, :Formula and :Description properties.

NeXLCore.zMethod
z(elm::Element)

Return the atomic number of the Element.

NeXLCore.zMethod
z(mat::Material) = z(Donovan2002, mat)
z(::Type{NaiveZ|ElectronFraction|AtomicFraction}, mat::Material)
z(::Type{ElasticFraction}, mat::Material, e::AbstractFloat)
z(::Type{Donovan2002}, mat::Material; exponent=0.667)

Compute the mean atomic number for a material.

Algorithms:
  * NaiveZ - Mass fraction averaging
  * AtomFraction - Atom fraction averaging
  * ElectronFraction - Simple electron fraction averaging
  * ElasticFraction - Scattering cross-section averaged
  * Donovan2002 - Yukawa/Donovan modified exponent electron fraction averaging

For more details see Mean Z algorithm in J.J. Donovan, N.E. Pingitore, Microsc. Microanal. 2002 ; 8 , 429 (also see Microsc. Microanal. 27 (Suppl 1), 2021))

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} }

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

The differential screened Rutherford cross-section per atom.

NeXLCore.ηMethod
η(::Type{<:BackscatterCoefficient}, mat::Material, e0::Float64) = #
η(elm::Element, e0::Real)

Models are: Tomlin1963, LoveScott1978η, Pouchou1991η, August1989η, Reimer1998

The default backscatter coefficient algorith is August1989η.

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} }

NeXLCore.λMethod
λ(cxr::CharXRay)

X-ray wavelength in cm.

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

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

NeXLCore.λₑMethod
λₑ(E::Float64)

Wavelength of an electron in cm.

  • E in eV
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
NeXLCore.ξMethod
ξ(::Type{<:ScreenedRutherfordType}, elm::Element, E::Float64)::Float64
  • E in eV
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².

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.

NeXLCore.ϵMethod
ϵ(elm::Element, E::Float64)

Screening factor.

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.
NeXLUncertainties.asaMethod
asa(::Type{DataFrame}, links::Dict{Element,String})

Create a DataFrame which contains a periodic table with links to URLs. This doesn't work so well at the REPL when represented as text but works nicely in HTML.

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.

NeXLUncertainties.asaMethod
NeXLUncertainties.asa(Dict, mat::Material)

Convert a Material into a Dict{String, Any} as is suitable for conversion to JSON.

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{...}).

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).

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"))