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.GrayScale
— ConstantAn RGB gray-scale palette with entry 256 being yellow.
NeXLCore.Log3BandBright
— ConstantDave 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.Log3BandColorblind
— ConstantA colorblind friendly palette suited to use with log base-10 transformed data on the range [0.0, 1.0].
NeXLCore.allsubshells
— Constantallsubshells
A tuple containing all K, L, M, N and O sub-shells
NeXLCore.alltransitions
— Constantalltransitions
A complete list of all the transitions present in one or more elements.
NeXLCore.atomic_weight
— Constantatomic_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.a₀
— Constanta₀ : Bohr radius (in cm)
NeXLCore.kalpha
— Constantkalpha
A list of K-L? transitions.
NeXLCore.kbeta
— Constantkbeta
A list of K-M? transitions.
NeXLCore.kother
— Constantkother
A list of K-!L? transitions.
NeXLCore.ksubshells
— Constantksubshells
All K sub-shells ( K )
NeXLCore.ktransitions
— Constantktransitions
A complete list of all the K-shell transitions.
NeXLCore.lsubshells
— Constantlsubshells
All L sub-shells ( L1, L2, L3 )
NeXLCore.ltransitions
— Constantltransitions
A complete list of all the L-shell transitions.
NeXLCore.msubshells
— Constantmsubshells
All M sub-shells ( M1, M2,.., M5 )
NeXLCore.mtransitions
— Constantmtransitions
A complete list of all the M-shell transitions.
NeXLCore.mₑ
— Constantmₑ : Electron rest mass (in eV)
NeXLCore.nsubshells
— Constantnsubshells
All N sub-shells ( N1, N2,.., N7 ) ]
NeXLCore.ntransitions
— Constantntransitions
A complete list of all the N-shell transitions.
NeXLCore.osubshells
— Constantosubshells
All O sub-shells ( O1, O2,.., O9 )
NeXLCore.otransitions
— Constantotransitions
A complete list of all the O-shell transitions.
NeXLCore.transitionsbygroup
— Constanttransitionsbygroup
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.transitionsbyshell
— Constanttransitionsbyshell
A Dict{Char,Tuple{Transition}} mapping shell name into a list of transitions. Keys are Shell objects.
NeXLCore.AFtoNMF
— TypeAFtoNMF
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.AtomicSubShell
— TypeAtomicSubShell
Represents a specific ground-state occupied sub-shell in a specific element.
NeXLCore.BackscatterCoefficient
— Typeη(::Type{<:BackscatterCoefficient}, elm::Element, e0::Real)
Abstract type to represent backscatter coefficient algorithms.
NeXLCore.Berger1982
— Type@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.Bethe
— TypeThe Bethe algorithm of kinetic energy loss by electrons.
NeXLCore.BetheEnergyLoss
— TypeAn abstract type to describe kinetic energy loss by electrons.
NeXLCore.Bloch1933
— Type@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.Brizuela1990
— Type@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.Browning1991
— TypeBrowning's scattering cross section
Appl. Phys. Lett. 58, 2845 (1991); https://doi.org/10.1063/1.104754
NeXLCore.Browning1994
— TypeBrowning's scattering cross section according to a draft 1994 article
NeXLCore.Castellano2004a
— Type@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.CharXRay
— TypeCharXRay
Represents a specific known characteristic X-ray in a specific element.
NeXLCore.CustomMAC
— TypeImplements 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
.
NeXLCore.DefaultStageMapping
— TypeThe DefaultStageMapping
assumes a matching Cartesian coordinate system for both the stage and image. It only assumes :X
, :Y
stage motion.
NeXLCore.ElasticScatteringCrossSection
— TypeAlgorithms implementing the elastic scattering cross-section
σₜ(::Type{ScreenedRutherford}, elm::Element, E::Float64)
NeXLCore.ElementByDifference
— TypeElementByDifference
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.ElementByStoichiometry
— TypeElementByStoichiometry
Computes the mass-fraction of an element which is related by stoichiometric rules (valence-rules) to the other elements in the material.
NeXLCore.FFASTDB
— TypeFFAST represents an implementation of mass-absorption coefficients and associated edge and other elemental data. It is a thin wrapper around the FFAST library.
NeXLCore.Film
— TypeA structure defining a thin film or layer of a Material.
NeXLCore.Jensen1937
— Type@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.JoyLuo
— TypeThe Joy-Luo algorithm of Bethe kinetic energy loss by electrons. SCANNING Vol. 11, 176-180 (1989)
NeXLCore.KRatio
— TypeKRatio
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 Symbol
s 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.
NeXLCore.KRatioBase
— TypeThe members in common between KRatio and KRatios
NeXLCore.KRatios
— TypeKRatios
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.
NeXLCore.Kramers1923
— Type@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.Lifshin1974
— Type@InProceedings{ lifshin1974, author={Lifshin, E.}, journal="Proceedings Ninth National Conference on Electron Probe Analysis, Ottowa, CA", year={1974}, volume={174}, number={3}, }
NeXLCore.Liljequist1989
— TypeLiljequist'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.MFtoNMF
— TypeMFtoNMF
Mass fraction to normalized mass fraction measurement model.
NeXLCore.MatStats
— TypeMatStats
Computes the mean atomic number (MeanZ) and mean atomic weight (MeanAz).
NeXLCore.Material
— TypeMaterial
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
NeXLCore.MaterialFractionLabel
— TypeMaterialFraction
This label represents the amount of a material constituent
in material
in a material defined as the mixture of other materials.
NeXLCore.MaterialLabel
— TypeMaterialLabel
The abstract type associated with Label
s with material
and element
members.
NeXLCore.NeXLBremsstrahlung
— TypeAn abstract structure that implements
NeXLCore.bremsstrahlung(::Type{<:NeXLBremsstrahlung}, e::AbstractFloat, e0::AbstractFloat, elm::Element; kwargs...)
NeXLCore.NeXLMeanIonizationPotential
— TypeAlgorithms 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.NormalizeByShell
— TypeNormalizeByShell
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.NormalizeBySubShell
— TypeNormalizeBySubShell
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.NormalizeToUnity
— TypeNormalizeToUnity
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
NeXLCore.Particle
— TypeParticle 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.Position
— TypePosition
: A point in 3-D. Ultimately, derived from StaticArray.
NeXLCore.RectangularShape
— TypeThe 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.Reed1975
— Type@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.Region
— TypeRegion
A Region
combines a geometric primative and a Material
(with :Density
property) and may fully contain zero or more child Region
s.
NeXLCore.ScreenedRutherfordType
— TypeBasic screened Rutherford algorithm where V(r) = (-Ze²/r)exp(-r/R) where R=a₀Z⁻¹/³ is solved using the first Born approximation.
NeXLCore.Shell
— TypeShell
Represents the K, L, M, N etc atomic shell
NeXLCore.Small1987
— Type@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.Smith1975
— Type@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.Springer1967
— Type@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.Sternheimer1964
— TypeCited 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.SubShell
— TypeSubShell
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.Tomlin1963
— Type@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.Transition
— TypeTransition
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
NeXLCore.Trincavelli1997
— Type@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.Wilson1941
— Type@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.Zeller1973
— Type@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.convert
— MethodBase.convert(::Type{Material}, str::AbstractString)
Convert a DTSA-II style string into a material.
Base.findfirst
— MethodBase.findfirst(krs::AbstractVector{<:KRatioBase}, cxr::CharXRay)
Find the first KRatio or KRatios in which the .xrays field contains the cxr::CharXRay.
Base.haskey
— Methodhaskey(mat::Material, elm::Element)
haskey(mat::Material, z::Int)
Does this material contain this element?
Base.haskey
— Methodhaskey(mat::Material, sym::Symbol)
Does this material have this property defined?
Base.isapprox
— MethodBase.isapprox(mat1::Material, mat2::Material; atol = 1.0e-4)
Are these Material(s) equivalent to within atol
?
Base.keys
— MethodBase.keys(mat::Material)
Return an interator over the elements in the Material.
Base.parse
— MethodBase.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.parse
— Methodtransition(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.parse
— MethodBase.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.
Base.rand
— FunctionBase.rand(::Type{Material}, zs::AbstractUnitRange{Int}=1:20)::Material
Generate a randomize material.
Base.rand
— MethodBase.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.rand
— MethodBase.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.range
— Functionrange(::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.range
— Functionrange(::Type{BetheEnergyLoss}, mat::Material, e0::Float64, inclDensity = true)
Calculates the electron range using numeric quadrature of a BetheEnergyLoss algorithm.
Base.similar
— MethodBase.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 UncertainValue
s.
Base.strip
— Methodstrip(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.sum
— MethodBase.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.sum
— MethodBase.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 equivalently
0.5mat"Al2O3"+0.5*mat"MgO"are computed using
sum(...)`.
Gadfly.plot
— FunctionGadfly.plot(sss::AbstractVector{SubShell}, mode=:EdgeEnergy|:FluorescenceYield; palette=NeXLPalette)
Plot the edge energies/fluorescence yields associated with the specified vector of SubShell objects.
Gadfly.plot
— MethodGadfly.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.
Gadfly.plot
— MethodcompareMACs(elm::Element; palette=NeXLPalette)
Plot a comparison of the FFAST and Heinrich MAC tabulations for the specified Element or Material.
Gadfly.plot
— Methodplot(alg::Type{<:NeXLAlgorithm}, elm::Union{Element,Material}; palette = NeXLPalette, xmax=20.0e3)
Plot a MAC tabulations for the specified Element or Material.
LinearAlgebra.normalize
— MethodLinearAlgebra.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.
NeXLCore.J
— MethodJ(ty::Type{<:NeXLMeanIonizationPotential}, mat::Material)
Computes the mean ionization potential for a material based on the formula in PaP1992 (Green Book)
NeXLCore.LinearScale
— MethodTranforms numbers on the range [0.0, 1.0] onto a linear gray scale palette. NaNs are plotted in yellow.
NeXLCore.Log3Band
— MethodTranforms 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.Log3BandC
— MethodTranforms 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.LogScale
— MethodTranforms numbers on the range [1.0e-3, 1.0] onto a Log base-10 gray scale palette. NaNs are plotted in yellow.
NeXLCore.Rₐ
— MethodRₐ(elm::Element)
Classic formula for the atomic screening radius in cm
NeXLCore.a
— Methoda(elm::Element, mat::Material)
Get the atomic weight for the specified Element in the specified Material.
NeXLCore.a
— Methoda(elm::Element)
Return the mean atomic weight of the Element in amu
NeXLCore.a
— Methoda(mat::Material)
Computes the mean atomic weight for a material. (Naive algorithm.)
NeXLCore.allmaterials
— Methodallmaterials(reg::Region)
Generates a list of all the unique materials in a sample Region.
NeXLCore.analyticaltotal
— Methodanalyticaltotal(mat::Material)
Return the sum of the positive mass fractions.
NeXLCore.asnormalized
— Functionasnormalized(mat::Material, n=1.0)::Material
Convert the Material to a normalized Material form. Negative mass fractions are set to zero before normalization.
NeXLCore.asoxide
— Methodasoxide(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.asoxide
— Methodasoxide(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.atomicfraction
— Methodatomicfraction(mat::Material)::Dict{Element,AbstractFloat}
Return the composition in atomic fraction representation.
NeXLCore.atomicfraction
— Methodatomicfraction(
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.atomicsubshell
— Methodatomicsubshell(str::AbstractString)::AtomicSubShell
Parse an AtomicSubShell from a string of the form "Fe K" or "U M5".
NeXLCore.atomicsubshell
— Methodatomicsubshell(elm::Element, ss::SubShell)::AtomicSubShell
Construct an AtomicSubShell from from an Element and a SubShell.
NeXLCore.atomicsubshells
— Function 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³
— Methodatoms_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_g
— Methodatoms_per_g(elm::Element)
atoms_per_g(mat::Material, elm::Element)
Compute the number of atoms of elm
in 1 gram of mat
.
NeXLCore.brightest
— Methodbrightest(elm::Element, shell)
Return the brightest transition among the shell of transitions for the specified element. (group="K"|"Ka"|"Kb"|"L" etc)
NeXLCore.brightest
— Methodbrightest(krs::Union{KRatios, KRatio})
Returns a new KRatios (referencing same basic data as krs) but with a single CharXRay in the lines
field.
NeXLCore.bulk
— Methodbulk(mat::Material)
Construct a bulk homogeneous sample at the origin.
NeXLCore.capacity
— Methodcapacity(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.chamber
— Functionchamber(dim=100.0)
Construct a high vacuum chamber to act as the outer-most Region.
NeXLCore.charactericXRayAvailable
— FunctioncharacteristicXRayAvailable(z::Int, inner::Int, outer::Int, alg::Type{<:NeXLAlgorithm} = CullenEADL)::Float64
Is the weight associated with this transition greater than zero?
NeXLCore.characteristic
— Functioncharacteristic(elm::Element, iter::Tuple{Vararg{Transition}}, minweight=0.0, maxE=1.0e6)
NeXLCore.characteristic
— Methodcharacteristic(str::AbstractString)::CharXRay
Create a CharXRay structure from a string like "Fe K-L3" or "U L3-M5".
NeXLCore.characteristic
— Methodcharacteristic(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")
NeXLCore.childmost_region
— Methodchildmost_region(reg::Region, pos::Position)::Region
Find the inner-most Region
within reg
containing the point pos
.
NeXLCore.coated_particle
— Functioncoated_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.colorize
— Functioncolorize(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 Element
s. 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.colorize
— Methodcolorize(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.compare
— Methodcompare(unk::Material, known::Material)::DataFrame
Compare two compositions in a DataFrame.
NeXLCore.compareMACs
— MethodcompareMACs(elm::Element; palette=NeXLPalette)
Plot a comparison of the FFAST and Heinrich MAC tabulations for the specified Element.
NeXLCore.compositionlibrary
— Methodcompositionlibrary()::Dict{String, Material}
Load the internal compositon library.
NeXLCore.comptonAngular
— MethodcomptonAngular(θ, 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.comptonDifferential
— MethodcomptonDifferential(θ, E)
Differential crosssection dσ/dΩ = dσ/(sin(θ) dθ dϕ) for Compton scattering in cm².
NeXLCore.comptonEnergy
— MethodcomptonEnergy(θ, 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.comptonShift
— MethodcomptonShift(θ, 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_tilt
— Methodcompute_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.configuration
— Methodconfiguration(elm::Element)
The configuration of the shell occupancy in a specific ground-state element.
NeXLCore.dEds
— FunctiondEds(::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.delete
— Methoddelete(mat::Material, elm::Element)::Material
delete(mat::Material, elm::AbstractVector{Element})::Material
Constructs a new Material from mat
with elm
removed.
NeXLCore.density
— Methoddensity(elm::Element)
Return the nominal density for the element in g/cm³.
NeXLCore.density
— Methoddensity(mat::Material)
Return the density in g/cm³ (Might be 'missing')
NeXLCore.description
— Methoddescription(mat::Materail)
The :Description property.
NeXLCore.eachelement
— Functioneachelement()
Return the range of atomic numbers for which there is a complete set of energy, weight, MAC, ... data
NeXLCore.edgeenergy
— Methodedgeenergy(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.
NeXLCore.elasticfraction
— Methodelasticfraction(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.electronfraction
— Methodelectronfraction(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.element
— Methodelement(str::AbstractString)
Parses a string to determine if the string represents an Element by atomic number, symbol or name.
NeXLCore.element
— Method element(ass::AtomicSubShell)
The Element associated with the specified sub-shell.
NeXLCore.element
— Methodelement(cxr::CharXRay)
Return the element for this CharXRay.
NeXLCore.element
— Methodelement(z::Int)::PeriodicTable.Element
Covert an atomic number into a PeriodicTable.Element
NeXLCore.elms
— Methodelms(mat::Material)
The elements with mass fraction ≠ 0.0 in mat
.
NeXLCore.elms
— Methodelms(krs::Vector{KRatio})::Set{Element}
Return a set containing the elements present in krs.
NeXLCore.energy
— Function 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.
NeXLCore.energy
— Methodenergy(z::Int, inner::Int, outer::Int)::Float64
Return energy (in eV) of the transition by specified inner and outer sub-shell index.
NeXLCore.exists
— Methodexists(inner::SubShell, outer::SubShell)::Bool
Does a transition exist in our database for this pair of shells?
NeXLCore.fluorescenceyield
— FunctionRepresents 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
NeXLCore.fluorescenceyield
— Methodfluorescenceyield(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.fluorescenceyield
— MethodKahoul 2012 expression for the K-shell fluorescence yield
NeXLCore.fluorescenceyield
— Methodfluorescenceyield(ass::AtomicSubShell, ::Type{Sogut2002})
An alternative for M-line yields. Not alway reasonable.
NeXLCore.gun
— Methodgun(::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.has
— Methodhas(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.has
— Methodhas(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.hasminrequired
— Methodhasminrequired(ty::Type, item::Union{Spectrum,Dict{Symbol,Any}})
Does this spectrum have the minimal set of required properties?
NeXLCore.image2stage
— Methodimage2stage(::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.inner
— Methodinner(cxr::CharXRay)
Return the inner AtomicSubShell associated with the specified CharXRay.
NeXLCore.ionizationcrosssection
— Functionionizationcrosssection(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
NeXLCore.ionizationcrosssection
— Methodionizationcrosssection(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).
NeXLCore.ispure
— Methodispure(mat::Material)
Does mat
represent a single element.
NeXLCore.isstandard
— Methodisstandard(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.j
— Method j(ss::SubShell)
Total angular momentum quantum number
NeXLCore.jumpratio
— Methodjumpratio(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.jumpratio
— Methodjumpratio(z::Int, ss::Int, ::Type{FFASTDB}) =
Returns the jump ratio for the specified shell by index K=>1, L1=>2, L2=>3, ..., M5=>9.
NeXLCore.jumpratio
— Methodjumpratio(z::Int, ss::Int) =
Compute the jump ratio.
NeXLCore.klinewidths
— Methodklinewidths(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ₑ
— Methodkₑ(E::Float64)
Electron wavenumber (inverse wavelength) in rad⋅cm⁻¹.
NeXLCore.l
— Methodl(ss::SubShell)
Orbital angular momentum quantum number
NeXLCore.labeled
— Methodlabeled(mat::Material)
Transform the mass fraction representation of a material into a Dict{MassFractionLabel,AbstractFloat}
NeXLCore.loadlegend
— MethodLoads a legend image from the package source directory. Some legends include "LinearScale.png", "LogScale.png", "Log3BandBright.png", "Log3BancColorblind.png".
NeXLCore.loadsmithsoniandata
— Methodloadsmithsoniandata(; 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.mac
— Functionmac(mat::Material, xray::Union{Float64,CharXRay}, alg::Type{<:NeXLAlgorithm}=FFASTDB)::Float64
Compute the material MAC using the standard mass fraction weighted formula.
NeXLCore.mac
— Methodmac(zz::Int, ev::Float64, ::Type{DTSA})::Float64
Calculate the elemental MAC using Heinrich's IXCOM 11 formula as implemented by Myklebust in DTSA.
NeXLCore.mac
— Methodmac(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.
NeXLCore.macU
— MethodmacU(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.
NeXLCore.massfraction
— Methodmassfraction(mat::Material)::Dict{Element, AbstractFloat}
The mass fraction as a Dict{Element, AbstractFloat}
NeXLCore.massthickness
— Methodmassthickness(flm::Film)
The mass-thickness of the film in g/cm².
NeXLCore.matches
— Methodmatches(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.material
— Method material(str::String, density::Float64)
Similar to mat"..."
except requires you to specify a density.
NeXLCore.material
— Methodmaterial(
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.
NeXLCore.materiallabels
— Methodmateriallabels(ty::Type{<:MaterialLabel}, material::String, uvs::Union{LabeledValues,UncertainValues})
Useful for extracting the MaterialLabel[s] associated with a single material.
NeXLCore.meanfluorescenceyield
— Methodmeanfluorescenceyield(elm::Element, sh::Shell)
meanfluorescenceyield(elm::Element, sh::Shell, ::Type{Bambynek1972})
Mean fluorescence yields from Bambynek in Reviews of Modern Physics 44(4), 1972
NeXLCore.mf2comp
— Methodmf2comp(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.minproperties
— Methodminrequired(::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.mixture
— Methodmixture(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.name
— Functionname(cxrs::AbstractVector{CharXRay}, byfamily=false)
An abbeviated name for a collection of CharXRay.
NeXLCore.name
— Methodname(elm::Element)
Return the name like "Hydrogen", "Helium",... for the Element.
NeXLCore.name
— Methodname(mat::Material)
Return a human friendly short name for the Material.
NeXLCore.normalizedmassfraction
— Methodnormalizedmassfraction(mat::Material)::Dict{Element, AbstractFloat}
Return the normalized mass fraction as a Dict{Element, AbstractFloat}. Negative values are set to zero.
NeXLCore.obystoichiometry
— Methodobystoichiometry(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.outer
— Methodouter(cxr::CharXRay)
Return the outer AtomicSubShell associated with the specified CharXRay.
NeXLCore.parsedsmithsoniandata
— Methodparsedsmithsoniandata()::Dict{String, Material}
Converts the data from loadsmithsoniandata() into Material representation.
NeXLCore.parsex
— Methodparsex(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.particle
— Functionparticle(mat::Material, radius::Float64, substrate::Union{Nothing,Material} = nothing)
Construct a spherical particle at the origin with an optional bulk substrate.
NeXLCore.pathlength
— Methodpathlength(el::Particle)
Length of the line segment represented by el
.
NeXLCore.pedigree
— Methodpedigree(mat::Material)
The :Pedigree property.
NeXLCore.pure
— Methodpure(elm::Element)
Construct a Material to represent a pure element.
Example:
> pure(n"Fe")
NeXLCore.random_point_inside
— Methodrandom_point_inside(shape)
Generate a randomized point that is guaranteed to be in the interior of the shape.
NeXLCore.relativeionizationcrosssection
— Methodrelativeionizationcrosssection(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
NeXLCore.rename
— Methodrename(mat::Material, newname::AbstractString)
Creates a replica of mat
but with a new name.
NeXLCore.requiredbutmissing
— Methodrequiredbutmissing(ty::Type, item::Union{Spectrum,Dict{Symbol,Any}})
List any required but missing properties.
NeXLCore.sample
— Methodsample(ch::Region)
Extracts the sample portion from within the chamber.
NeXLCore.shell
— Methodshell(ass::AtomicSubShell)
Example:
julia> shell(n"Fe L3")
Shell(L)
NeXLCore.shell
— Methodshell(cxr::CharXRay)
Return the shell, Shell(1), Shell(2), ... associated with the inner shell.
NeXLCore.shell
— Methodshell(sh::SubShell)
Returns the appropriate Shell object.
Example:
julia> shell(n"M5")
Shell[M]
NeXLCore.shell
— Methodshell(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.splitbyshell
— Methodsplitbyshell(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.stage2image
— Methodstage2image(::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.standardize
— Methodstandardize(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.subshell
— Methodsubshell(name::AbstractString)::SubShell
Returns a SubShell structure from a string of the form "K", "L1", ...., "O11"
NeXLCore.subshellindices
— Methodsubshellindices(z::Int, alg::Type{<:NeXLAlgorithm} = FFASTDB)
Return the shells occupied in a neutral, ground state atom of the specified atomic number.
NeXLCore.symbol
— Methodsymbol(elm::Element)
Return the symbol like "H", "He", "Li", .... for the Element.
NeXLCore.take_step
— Methodtake_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_film
— Methodthin_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.trajectory
— Methodtrajectory(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 pointp
defines the initial position, direction and energy of the particle (often created withgun(T, ...)
)reg
The outer-most region for the trajectory (usually created withchamber()
)scf
A function from (<:Particle, Material) -> ( λ, θ, ϕ, ΔE ) that implements the transport dynamicsminE
Stopping criterionterminate
a function takingT
andRegion
that returns false except on the last step (liketerminate = (pc,r)->pc.energy < 50.0
)
NeXLCore.transition
— Methodtransition(cxr::CharXRay)
Return the Transition structure associated with the specified CharXRay.
NeXLCore.transition
— Methodtransition(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.transmission
— Functiontransmission(flm::Film, xrayE::AbstractFloat, θ::AbstractFloat, alg::Type{<:NeXLAlgorithm}=FFASTDB) =
Compute the transmission fraction of an X-ray at the specified angle through a Film.
NeXLCore.transmission
— Methodtransmission(flm::Film, cxr::CharXRay, θ::AbstractFloat) =
Compute the transmission fraction of an X-ray at the specified angle through a Film.
NeXLCore.transport
— Functiontransport(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.wavenumber
— Methodwavenumber(cxr::CharXRay)
X-ray wavenumber in cm¯¹.
NeXLCore.weight
— Methodweight(::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.z
— Methodz(elm::Element)
Return the atomic number of the Element.
NeXLCore.z
— Methodz(mat::Material)
Computes the mean atomic number for a material. (Naive algorithm.)
NeXLCore.zbar
— Methodzbar(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η(elm::Element, e0::Real)
The default backscatter coefficient algorith which 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. (non-relativistic)
- 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.asa
— FunctionNeXLUncertainties.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.asa
— MethodNeXLUncertainties.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.asa
— MethodNeXLUncertainties.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.mean
— MethodStatistics.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_str
— Macron"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"))