skillfed

xraydb

calculations with XrayDB: reference data for X-ray interactions with matter

xraydb v4.5.8 73.7K downloads/30d#14,941 on PyPI77
Permissive license MIT Active released

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 xraydb

uv

uv add xraydb

poetry

poetry add xraydb

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: PyPy

Tags

x-ray reference datax-ray absorption calculationsx-ray scattering factorsx-ray physics databaseanomalous scattering datax-ray element propertiesx-ray matter interactions
x-ray-physicsreference-datamaterials-science

More Scientific/Engineering packages