Attenuation Calculator: polychromatic beams and quasi-monochromatic sources for X-ray CT energy selection
Description
A single-file, browser-based X-ray attenuation calculator for micro-CT, industrial CT, and X-ray imaging design.
Computes monochromatic (2–500 keV) and polychromatic (20–500 kVp) attenuation, optical depth, and transmission for 450+ species, minerals, battery materials, elements, polymers, biological tissues, ceramics, metals, and alloys. Polychromatic mode uses SpekPy v2 (spekcalc) tungsten-anode tube spectra with up to four user-defined filters (Be, Al, Cu, Mo, Sn) and reports effective mu, half-value layer, effective energy, and beam-hardening factor. Custom energy grid for regular-spaced data export. NIST-verified mass attenuation data via xraydb. Runs entirely in the browser, no server or install required.
### Fixed
- **Cobalt was parsed as carbon + oxygen when regenerating sub-10 keV mass-attenuation data.** The formula normaliser in `scripts/extend_species_low_energy.py` contained a typo-correction rule that uppercased a lowercase `o` appearing between a letter and a digit. The rule was intended for malformed oxide formulas (`Fe2o3` → `Fe2O3`) but also matched the second character of the element symbol **Co**, rewriting `Co0.15` to `CO0.15`. Cobalt was therefore replaced by carbon plus oxygen wherever it appeared in a fractional-stoichiometry formula.
- **Affected species (5 of 450):** NMC111, NMC622, NMC811, NMC955 and NCA — the layered-oxide lithium-ion cathodes. All five had their 2–10 keV μ/ρ values computed with carbon standing in for cobalt, and the **Co K-edge at 7.7089 keV was absent from their tables entirely**. Deviations from correct values ranged from ~10% to ~23% (median, per species) and up to 53% in the 7.71–8.33 keV window between the missing Co edge and the Ni edge.
- **Not affected:** all other 445 species; every value at 10 keV and above (those come from the original tabulated data and were never regenerated by this script); all filter tables; all spectral data; the custom-compound builder; and every computational routine. Monochromatic and polychromatic engines are unchanged.
- The same rule would have corrupted Ho, Mo, No and Po in fractional formulas. No species in the current table triggered those cases, but the fix covers all five symbols.
### Changed
- `fix_formula()` in `extend_species_low_energy.py` now skips the uppercase-O substitution when the lowercase `o` completes a genuine two-letter element symbol (Co, Ho, Mo, No, Po). Genuine typos such as `Fe2o3` are still corrected.
- The 2–10 keV tables for the five affected species were regenerated with the corrected parser. Both K-edges now present: Co at 7.7089 keV and Ni at 8.3328 keV, each with edge-adjacent sample points at E ± 1 eV.
### Verified
- All 3,954 sub-10 keV comparisons across every parseable species now agree with xraydb to within 0.010% (mean 0.000%).
- External accuracy unchanged: xraydb agrees with the NIST X-ray mass attenuation tables across 2–500 keV for liquid water, polystyrene and elemental iron — mean absolute deviation 0.02%, maximum 0.05%, at the four-significant-figure resolution limit of the NIST tabulation.
- Corrected NCA edge structure: 1.78× jump at the Co K-edge (15 at.% Co), 3.64× at the Ni K-edge (80 at.% Ni).
- Byte-level diff confirms exactly 5 of 455 species records changed; no other content altered.
- JS syntax-check clean (`node --check`).
### Impact on published results
- Any figure, table or exported dataset using NMC or NCA **below 10 keV** should be regenerated. Results at 10 keV and above are unaffected, as is all polychromatic output at every tube voltage (the spectra carry negligible fluence below 10 keV after filtration).
Files
attenuation-calculator-v2.8.1.zip
Files
(307.5 kB)
| Name | Size | Download all |
|---|---|---|
|
md5:780c0dba39ae89bce9a137dadc53fbc4
|
307.5 kB | Preview Download |
Additional details
Related works
- Cites
- Publication: 10.1002/mp.14945 (DOI)
- Is cited by
- Publication: 10.26434/chemrxiv.15002401/v1 (DOI)
Dates
- Updated
-
2026-08-05Version 2.8.1 released