X-ray Calculator Excel

Requires Excel 2013 or better. It was tested running Windows-10. I don't know if it will work on a Mac.

Home

The NIST_XCOM.xlam Add-In and NIST_XCOM.xlsm Workbook provide functions and macros for getting the attenuation properties of atoms and compounds.

LazzyIzzi is not currently associated with NIST but was a guest researcher there many years ago. These Excel files are not a NIST product but most of the data within them were downloaded from the NIST XCOM database and are used with permission. It should be noted that NIST retains copyright on the XCOM data and reserves the right to charge for its use in the future. See the XCOM website for more information.


XLAM or XLSM, which one is better for you? Do not install XLAM if you are using XLSM.


Add-In Functionality

Macros: Functions: Where

Add-In(xlam) Installation:

Special Note: Downloading Excel add-ins and macro enabled workbooks can be dangerous due to the possibility of embedded malware. Newer versions of Excel provide significant protection. Please take appropriate precautions before enabling any downloaded Excel workbook.

Adding NIST_XCOM.xlam macros to the Excel "Home" toolbar
Do NOT do the steps below if you are using NIST_XCOM.XLSM

Download NIST_XCOM.xlam 
Install the NIST_XCOM in the default Add-ins Folder, in Windows it's usually C:\Users\YourUserName\AppData\Roaming\Microsoft\AddIns.
Run the macros from the Developer tab "Macros" ribbon item.

To make the Macros visible in the Home tab Ribbon... The usual intuitive Microsoft 25 step process

  1. To add "Developer" to the main toolbar
    1. Click "File" in the main menu
    2. Click "Options" at the bottom left
    3. Click "Customize Ribbon"
    4. Check the "Developer" box
    5. Click OK
  2. To add NIST_XCOM to the project references
    1. Click the new "Developer" tab in the main menu
    2. Click "Excel To add-ins"
    3. Check the NIST_XCOM Reference
    4. Click OK
  3. To add "BeamHardening" and "GetSpectrum" Macros to main "Home" ribbon
    1. Click "File" in the main menu
    2. Click "Options" at the bottom left
    3. Click "Customize Ribbon"
    4. In the "Customize the Ribbon" menu select "Main Tabs"
    5. Click the twisty next to "Home"
    6. Click the "New Group" button
    7. Click the "Rename" button
    8. Enter "X-ray" in the "Display Name" box
    9. Click OK
    10. Click(select) "X-ray (Custom)" in the "Home" list
    11. In the "Choose commands from" menu, select "Macros"
    12. Select "BeamHardeningMacro"
    13. Click "To add"
    14. Select "GetSpectrumMacro"
    15. Click "To add"
    16. Click OK
  4. Uninstall NIST_XCOM in the project references
    1. Click the "Developer" tab in the main menu
    2. Click "Excel To add-ins"
    3. Uncheck the NIST_XCOM Reference
    4. Click OK
When you open a workbook
  1. Click on the Home tab
  2. Click on either BeamHardeningMacro or GetSpectrumMacro in the Ribbon to load the macros.
  3. Click OK on the security warnings.

Workbook(xlsm) Installation:

The Workbook does not require installation.
X-ray Macros Menu.
The xlsm file has slightly over 100 data sheets. The default behavior is to keep them hidden (most are also locked). The Show/Hide menu items allows you to view the sheets if necessary. If the Workbook should encounter an error, the menu will be unloaded. Use Ctrl+Shift+M to reload the menu.

Using the Functions

To use the functions, Select an output cell(s), Click the FORMULAS tab and then click the Insert Function icon. Fill in the required data and click OK.

Select X-ray Functions.
Select the function you want to use.
Select the input cells. Click OK.
View the results.

Excel Array Functions (older versions of Excel)

GetFormualMevFromMuLin and GetFormualMevFromMuLinRatio functions return arrays. This is noted in their input dialogs. Select at least two contiguous row cells for output before calling the function. Do Not click OK in the function dialog. Use Ctrl-Shift-Enter to execute the function. The first value returned is the number of solutions. The contiguous row cells should be the number of solutions + 1.


Using the Macros

Click the ADD-INS tab(xlam) or use the Menu(xlsm) and click GetSpectrum or BeamHardening.

Get Spectrum

Use the radio buttons to select Atom or Formula

Get Spectrum returns a list of absorption cross-section data for atoms or formulas over a selected energy range.

Get Spectrum for an atom.

The atoms can be listed by Symbol, Number, or Name. I prefer Name.

Get Spectrum for a Formula.

Formulas are entered manually using an Atom1:Count1:Atom2:Count2 formatted Formula

  1. Check the desired cross-sections
  2. Enter the desired energy range Min and Max
  3. Select the number of interpolated points to add to the output. This will create a separate list of N approximately log-spaced points in the selected range.
  4. Check Plot Spectrum if desired
Data and spectrum for the Formula example.

Beam Hardening

Please refer to the ImageJ Scanner_Setup page for a description of how this Macro works.

Beam Hardening Dialog.
  1. Select BeamHardening from the Command Menu.
  2. Edit the Source, Sample, Detector, and Plot Range fields.
  3. Click Update Plot. The effective energy, sample tau, BeamHardening %, and photon efficiency % appear in the plot title.
  4. Twiddle the parameters to optimize the beam hardening and photon efficiency.
  5. OR enter the level of tolerable beam hardening in the Target BH% field and click Optimize to let the Solver maximize Photon Use% while constraining sample tau and beam hardening. Note: Increase the default 1 KeV plot increment to 5 KeV to speed up the solver.
The Spectral distributions for the Settings.
The Optimized Spectral distributions a 12% Target BH.

Home