xraydb
calculations with XrayDB: reference data for X-ray interactions with matter
What it is and what it does
XrayDB is a Python library that wraps a SQLite database of X-ray reference data—absorption coefficients, scattering factors, fluorescence yields, and other physical properties—compiled from sources including the Elam Tables and refined anomalous scattering data. It lets you query X-ray properties of elements and compounds programmatically, supporting calculations in X-ray spectroscopy, diffraction, and absorption studies.
The package depends on numpy, scipy, sqlalchemy, and platformdirs, making it a lightweight addition to a scientific Python stack. It targets researchers and engineers working in materials science, synchrotron beamline software, and X-ray physics who need reliable reference data without building their own database.
Use it for:
- Calculate mass absorption coefficients for X-ray absorption spectroscopy (XAS) data reduction.
- Look up anomalous scattering factors for X-ray crystallography structure refinement.
- Query fluorescence yields and line energies for X-ray fluorescence (XRF) analysis.
- Build element-property tables for synchrotron beamline control and data processing software.
- Validate X-ray interaction models in simulation and modeling workflows.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
XrayDB provides a Python interface to a SQLite database of X-ray reference data, enabling calculations and lookups of X-ray interactions with matter for physics and materials science applications.
Yes. XrayDB is production-stable, actively maintained, carries no known vulnerabilities, and installs with low friction. If you work with X-ray data or need reliable reference properties for X-ray physics calculations, it is a solid choice. The MIT license and Public Domain data pose no restrictions.
Install
xraydb on PyPI
pip
pip install xraydbuv
uv add xraydbpoetry
poetry add xraydbInstalling xraydb
Before you install
Low friction installation with a pure-Python wheel. Maintenance is active with recent commits and stable production status across modern Python versions (3.9–3.13, including PyPy).
License in practice
MIT license is permissive; you can use, modify, and distribute the package with minimal restrictions. The underlying data is in the Public Domain.
Quickstart
pip install xraydb
import xraydb
db = xraydb.XrayDB()
mu = db.mu_chantler('Fe', 10.0) # mass absorption coefficient for Fe at 10 keV
Verify before relying
- Whether the SQLite database is downloaded automatically on first use or requires manual setup.
- Performance characteristics for large-scale queries or real-time applications.
- Completeness and accuracy of anomalous scattering factors relative to published literature.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — numpy, scipy, sqlalchemy, platformdirs |
| Maintenance | actively maintained — 392 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 73,728/month — #14,941 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: xraydb-4.5.8-py3-none-any.whl
Keywords: X-ray, Physics
Tags
More Scientific/Engineering packages
NumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
pandaspandas provides fast, flexible data structures…
permissive · top 100 on PyPI
scipyscipy provides numerical algorithms for…
permissive · top 100 on PyPI
scikit-learnscikit-learn provides a comprehensive Python…
permissive · top 1,000 on PyPI
dilldill extends Python's pickle module to…
permissive · top 1,000 on PyPI
multiprocessMultiprocess is an enhanced fork of Python's…
permissive · top 1,000 on PyPI
periodictableProvides a periodic table of the elements with…
permissive · top 15,000 on PyPI
mendeleevProvides a Python API to query properties of…
permissive · top 15,000 on PyPI
pyxtalPyXtal generates crystal structures with…
permissive · top 15,000 on PyPI
aiosqliteaiosqlite provides an async interface to SQLite…
permissive · top 1,000 on PyPI
sqlitedictProvides a dict-like interface to SQLite…
permissive · top 5,000 on PyPI
pysqlite3-binaryProvides a self-contained SQLite database…
permissive · top 5,000 on PyPI
symfcSymfc computes force constants from atomic…
unclear · top 15,000 on PyPI
pysqlite3pysqlite3 packages SQLite as a standalone…
permissive · top 15,000 on PyPI
sqlite-anyioProvides an asynchronous client for SQLite that…
permissive · top 15,000 on PyPI
fabioFabIO reads and writes 2D X-ray detector images…
permissive · top 15,000 on PyPI