Package jhd.MuMass

Class XrayCalculator

java.lang.Object
jhd.MuMass.XrayCalculator

public class XrayCalculator extends Object
A class for calculating the x-ray attenuation coefficients using NIST XCOM attenuation data.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    returns an array of absorption edge names "K", "L1", "L2", "L3", "M1", "M2", "M3", "M4", "M5", "N1", "N2"
    double
    getAtomAbsEdge(String theAtom, String theEdge)
    returns the absorption edge energy MeV
    int
    getAtomAbsEdgeIndex(double edgeVal, double[] mevArray)
    returns the index (position) of the edge in the MeV array
    double
    getAtomAbsEdgeValue(String theAtom, String theEdgeName)
    returns the edge energy of the atom
    double[]
    returns an array of the atom's absorption edge energies
    double
    returns the density of the atom in its common form at stp.
    double
    returns the atomic weight in grams/mol
    double[]
    returns array of tabulated energies for the Atom
    double
    getAtomMuMass(String theAtom, double theMeV, String muMassType)
    returns the interpolated muMass at the requested MeV
    double[]
    getAtomMuMassArray(String theAtom, String muMassType)
    returns the array of tabulated cm2/gram cross sections for the Atom
    returns the full name of the atom
    returns an array of atom names in atomic number order
    int
    returns the atomic number of the Atom
    returns an array of atom symbols, e.g.
    getFormulaAtoms(String theFormula)
    returns an array atom symbols in the formula, null if formula is not valid
    double[]
    returns an ascending order array of tabulated energies for the atoms in the formula
    double[]
    getFormulaMevArray(String formula, double minMeV, double maxMeV)
    returns an ascending order array of tabulated energies for the atoms in the formula
    double
    getFormulaMuMass(String theFormula, double theMeV, String muMassType)
    Returns the mass attenuation coefficient for atoms and formulas
    double[]
    getFormulaMuMassArray(String formula, String muMassType)
    returns a list of attenuation coefficients for the formula at each tabulated atom's tabulated energy
    double[]
    getFormulaMuMassArray(String formula, String muMassType, double[] mevArray)
    returns The list of attenuation coefficients for the formula at each energy
    double
    Returns the formula weight of the formula
    double[]
    getMev(String theAtom, double minMeV, double maxMeV)
    returns the array of tabulated energies for the Atom between the bounds
    double[]
    getMeVfromMuLin(String formula, double linearCoeff, double gmPerCC, String muMassType)
    Returns the photon energy(s) that will produce the observed linear attenuation coefficient for the formula
    double[]
    getMeVfromMuLinRatio(String formula1, double linearCoeff1, double density1, String formula2, double linearCoeff2, double density2, String muMassType)
    Returns the photon energy(s) that will produce the observed linear attenuation coefficient ratio of two formulas
    double[]
    getMuMassArray(String theAtom, String muMassType, double minMeV, double maxMeV)
    return the array of tabulated cm2/gram cross sections for the Atom between the bounds
    Returns list of recognized cross section types
    returns the version of MassAttenuation
    double
    muLinToMolPerM3(double linearCoeff, double massCoeff, double formulaGmPerCC)
    Converts observed linear attenuation coefficient to concentration.
    double
    spectrumKramers(double tubeVoltageKV, double tubeCurrentMa, String targetAtomSymbol, double meV)
    Estimates the output of a conventional x-ray source (reflection target) using the Kramers equation.
    boolean
    returns true if the atom is valid
    boolean
    validateFormula(String theFormula)
    returns true if the formula is valid

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • XrayCalculator

      public XrayCalculator()
  • Method Details

    • getAbsEdgeNames

      public String[] getAbsEdgeNames()
      returns an array of absorption edge names "K", "L1", "L2", "L3", "M1", "M2", "M3", "M4", "M5", "N1", "N2"
      Returns:
      an array of absorption edge names
    • getAtomAbsEdge

      public double getAtomAbsEdge(String theAtom, String theEdge)
      returns the absorption edge energy MeV
      Parameters:
      theAtom - The Symbol e.g "CA" for Calcium
      theEdge - "K", "L1", "L2", "L3", "M1", "M2", "M3","M4","M5", "N1", "N2"
      Returns:
      the absorption edge energy MeV
    • getAtomAbsEdgeIndex

      public int getAtomAbsEdgeIndex(double edgeVal, double[] mevArray)
      returns the index (position) of the edge in the MeV array
      Parameters:
      edgeVal - the energy of the absorption edge
      mevArray - the energy array, must be in ascending order
      Returns:
      the index (position) of the edge, or the position where the edge would be inserted, or 0 if the edge is not found,
    • getAtomAbsEdgeValue

      public double getAtomAbsEdgeValue(String theAtom, String theEdgeName)
      returns the edge energy of the atom
      Parameters:
      theAtom - The Symbol e.g "CA" for Calcium
      theEdgeName - "K", "L1", "L2", "L3", "M1", "M2", "M3","M4","M5", "N1", "N2"
      Returns:
      the energy of the atom's selected absorption
    • getAtomAbsEdgeValues

      public double[] getAtomAbsEdgeValues(String theAtom)
      returns an array of the atom's absorption edge energies
      Parameters:
      theAtom - The Symbol e.g "CA" for Calcium
      Returns:
      an array of the atom's absorption edges
    • getAtomGmPerCC

      public double getAtomGmPerCC(String theAtom)
      returns the density of the atom in its common form at stp.
      Parameters:
      theAtom - The Symbol e.g "CA" for Calcium
      Returns:
      the density of the atom in its common form at stp.
    • getAtomGmPerMol

      public double getAtomGmPerMol(String theAtom)
      returns the atomic weight in grams/mol
      Parameters:
      theAtom - The Symbol e.g "CA" for Calcium
      Returns:
      the atomic weight in grams/mol
    • getAtomMuMass

      public double getAtomMuMass(String theAtom, double theMeV, String muMassType)
      returns the interpolated muMass at the requested MeV
      Parameters:
      theAtom - The Symbol e.g "CA" for Calcium
      theMeV - find muMass as this energy
      muMassType - i.e. "TotAttn", "Raleigh", "Compton", "PhotoElectric", "PairProdN", "PairProdE"
      Returns:
      the interpolated muMass at the requested MeV
    • getAtomMuMassArray

      public double[] getAtomMuMassArray(String theAtom, String muMassType)
      returns the array of tabulated cm2/gram cross sections for the Atom
      Parameters:
      theAtom - The Symbol e.g "CA" for Calcium
      muMassType - "TotAttn", "Raleigh", "Compton", "PhotoElectric", "PairProdN", "PairProdE"
      Returns:
      the array of tabulated cm2/gram cross sections for the Atom
    • getAtomName

      public String getAtomName(String theAtom)
      returns the full name of the atom
      Parameters:
      theAtom - The Symbol e.g "CA" for Calcium
      Returns:
      the full name of the atom
    • getAtomNames

      public String[] getAtomNames()
      returns an array of atom names in atomic number order
      Returns:
      an array of atom names in atomic number order
    • getAtomNumber

      public int getAtomNumber(String theAtom)
      returns the atomic number of the Atom
      Parameters:
      theAtom - The Symbol e.g "CA" for Calcium
      Returns:
      the atomic number
    • getAtomSymbols

      public String[] getAtomSymbols()
      returns an array of atom symbols, e.g. CA for Calcium, in atomic number order
      Returns:
      an array of atom symbols, e.g. CA for Calcium, in atomic number order
    • getFormulaAtoms

      public String[] getFormulaAtoms(String theFormula)
      returns an array atom symbols in the formula, null if formula is not valid
      Parameters:
      theFormula - An atom:count string representation of a chemical formula e.g. Ca:1:C:1:O:3 for CaCO3
      Returns:
      an array atom symbols in the formula, null if formula is not valid
    • getFormulaMevArray

      public double[] getFormulaMevArray(String formula)
      returns an ascending order array of tabulated energies for the atoms in the formula
      Parameters:
      formula - An atom:count string representation of a chemical formula e.g. Ca:1:C:1:O:3 for CaCO3
      Returns:
      an ascending order array of tabulated energies for the atoms in the formula
    • getFormulaMevArray

      public double[] getFormulaMevArray(String formula, double minMeV, double maxMeV)
      returns an ascending order array of tabulated energies for the atoms in the formula
      Parameters:
      formula - An atom:count string representation of a chemical formula e.g. Ca:1:C:1:O:3 for CaCO3
      Returns:
      an ascending order array of tabulated energies for the atoms in the formula
    • getFormulaMuMass

      public double getFormulaMuMass(String theFormula, double theMeV, String muMassType)
      Returns the mass attenuation coefficient for atoms and formulas
      Parameters:
      theFormula - The formula consists of an atom symbol or a list of atom symbols and their count all separated by ":", e.g. CaCO3 is represented by the string "Ca:1:C:1:O:3"
      theMeV - The photon energy in MeV between 1KeV to 100GeV
      muMassType - "TotAttn", "Raleigh", "Compton", "PhotoElectric", "PairProdN", "PairProdE"
      Returns:
      The cross-section in cm2/gm at the photon energy, -1 if incorrect formula
    • getFormulaMuMassArray

      public double[] getFormulaMuMassArray(String formula, String muMassType)
      returns a list of attenuation coefficients for the formula at each tabulated atom's tabulated energy
      Parameters:
      formula - An atom:count string representation of a chemical formula e.g. Ca:1:C:1:O:3 for CaCO3
      muMassType - "TotAttn", "Raleigh", "Compton", "PhotoElectric", "PairProdN", "PairProdE"
      Returns:
      The list of attenuation coefficients for the formula at each tabulated atom's tabulated energy
    • getFormulaMuMassArray

      public double[] getFormulaMuMassArray(String formula, String muMassType, double[] mevArray)
      returns The list of attenuation coefficients for the formula at each energy
      Parameters:
      formula - An atom:count string representation of a chemical formula e.g. Ca:1:C:1:O:3 for CaCO3
      muMassType - "TotAttn", "Raleigh", "Compton", "PhotoElectric", "PairProdN", "PairProdE"
      mevArray - an array of energies to compute the formula muMass
      Returns:
      The list of attenuation coefficients for the formula at each energy
    • getFormulaWeight

      public double getFormulaWeight(String theFormula)
      Returns the formula weight of the formula
      Parameters:
      theFormula - An atom:count string representation of a chemical formula e.g. Ca:1:C:1:O:3 for CaCO3
      Returns:
      the formula weight in gm/mol, -1 if incorrect formula
    • getAtomMevArray

      public double[] getAtomMevArray(String theAtom)
      returns array of tabulated energies for the Atom
      Parameters:
      theAtom - The Symbol e.g "CA" for Calcium
      Returns:
      array of tabulated energies for the Atom
    • getMev

      public double[] getMev(String theAtom, double minMeV, double maxMeV)
      returns the array of tabulated energies for the Atom between the bounds
      Parameters:
      theAtom - The Symbol e.g "CA" for Calcium
      minMeV - the lower energy bound
      maxMeV - the upper energy bound
      Returns:
      the array of tabulated energies for the Atom between the bounds
    • getMeVfromMuLin

      public double[] getMeVfromMuLin(String formula, double linearCoeff, double gmPerCC, String muMassType)
      Returns the photon energy(s) that will produce the observed linear attenuation coefficient for the formula
      Parameters:
      formula - The formula consists of an atom symbol or a list of atom symbols and their count all separated by ":", e.g. CaCO3 is represented by the string "Ca:1:C:1:O:3"
      linearCoeff - The experimentally observed linear attenuation coefficient in cm-1
      gmPerCC - The experimentally observed density in gm/cm3
      muMassType - "TotAttn", "Raleigh", "Compton", "PhotoElectric", "PairProdN", "PairProdE"
      Returns:
      An array of photon energies that satisfy the observed linear coefficient, null if no solutions.
    • getMeVfromMuLinRatio

      public double[] getMeVfromMuLinRatio(String formula1, double linearCoeff1, double density1, String formula2, double linearCoeff2, double density2, String muMassType)
      Returns the photon energy(s) that will produce the observed linear attenuation coefficient ratio of two formulas
      Parameters:
      formula1 - The formula for the first component e.g. "AU" for gold or "Ca:1:C:1:O:3" for Calcite CaCO3
      linearCoeff1 - The experimentally observed linear attenuation coefficient for the first component in cm-1
      density1 - The experimentally observed density for the first component in gm/cm3
      formula2 - same as formula1
      linearCoeff2 - same as linearCoeff1
      density2 - same as density1
      muMassType - "TotAttn", "Raleigh", "Compton", "PhotoElectric", "PairProdN", "PairProdE"
      Returns:
      An array of photon energies that satisfy the observed linear coefficient ratio, null if no solutions. Use with caution!! best results when comparing high average Z component to low average Z
    • getMuMassArray

      public double[] getMuMassArray(String theAtom, String muMassType, double minMeV, double maxMeV)
      return the array of tabulated cm2/gram cross sections for the Atom between the bounds
      Parameters:
      theAtom - The Symbol e.g "CA" for Calcium
      muMassType - "TotAttn", "Raleigh", "Compton", "PhotoElectric", "PairProdN", "PairProdE"
      minMeV - the lower energy bound
      maxMeV - the upper energy bound
      Returns:
      the array of tabulated cm2/gram cross sections for the Atom between the bounds
    • getMuMassTypes

      public String[] getMuMassTypes()
      Returns list of recognized cross section types
      Returns:
      A string array of muMass Types, i.e. "TotAttn", "Raleigh", "Compton", "PhotoElectric", "PairProdN", "PairProdE"
    • getVersion

      public String getVersion()
      returns the version of MassAttenuation
      Returns:
      the version of MassAttenuation
    • muLinToMolPerM3

      public double muLinToMolPerM3(double linearCoeff, double massCoeff, double formulaGmPerCC)
      Converts observed linear attenuation coefficient to concentration.
      Parameters:
      linearCoeff - The experimentally observed linear attenuation coefficient of a known material at a "known" photon energy
      massCoeff - The calculated mass attenuation coefficient of the known material at the "known" energy
      formulaGmPerCC - The density of the pure material
      Returns:
      The concentration in mol/m3
    • spectrumKramers

      public double spectrumKramers(double tubeVoltageKV, double tubeCurrentMa, String targetAtomSymbol, double meV)
      Estimates the output of a conventional x-ray source (reflection target) using the Kramers equation.
      Parameters:
      tubeVoltageKV - The excitation potential, AKA x-ray tube voltage KV
      tubeCurrentMa - The x-ray source beam current
      targetAtomSymbol - The x-ray source target material, usually W Tungsten
      meV - The energy at which the tube output is to be estimated
      Returns:
      The estimated photon intensity.
    • validateAtomSymbol

      public boolean validateAtomSymbol(String theSymbol)
      returns true if the atom is valid
      Parameters:
      theSymbol - An atom symbol e.g. "CA" for Calcium
      Returns:
      true if the atom is valid
    • validateFormula

      public boolean validateFormula(String theFormula)
      returns true if the formula is valid
      Parameters:
      theFormula - An atom:count string representation of a chemical formula e.g. Ca:1:C:1:O:3 for CaCO3
      Returns:
      true if the formula is valid