dabax package

Submodules

dabax.common_tools module

Common calculation tools for X-ray crystallography (structure factors, Bragg metric, atomic data).

dabax.common_tools.atomic_names()[source]

Return a list of element names indexed by atomic number (index 0 = Vacuum).

dabax.common_tools.atomic_number(symbol)[source]

Return the atomic number for a given element symbol.

Parameters:

symbol (str) – Element symbol (e.g. "Si").

Returns:

Atomic number.

Return type:

int

dabax.common_tools.atomic_symbols()[source]

Return a list of element symbols indexed by atomic number (index 0 = Vacuum).

dabax.common_tools.bragg_metrictensor(a, b, c, a1, a2, a3, RETURN_REAL_SPACE=0, RETURN_VOLUME=0, HKL=None)[source]

Returns the metric tensor in the reciprocal space

Parameters:
  • a – unit cell a

  • b – unit cell b

  • c – unit cell c

  • a1 – unit cell alpha

  • a2 – unit cell beta

  • a3 – unit cell gamma

  • RETURN_REAL_SPACE – set to 1 for returning metric tensor in real space

  • RETURN_VOLUME – set to 1 to return the unit cell volume in Angstroms^3

  • HKL – if !=None, returns the d-spacing for the corresponding [H,K,L] reflection

Returns:

the returned value depends on the keywords used. If RETURN_REAL_SPACE=0,RETURN_VOLUME=0, and HKL=None then retuns the metric tensor in reciprocal space.

dabax.common_tools.calculate_f0_from_f0coeff(f0coeff, ratio)[source]

Evaluate f0 from its parametric coefficients.

Parameters:
  • f0coeff (array-like) – Coefficient array [a1..an, c, b1..bn] (length 2n+1).

  • ratio (float or numpy.ndarray) – sin(theta)/lambda in Å⁻¹.

Returns:

f0 value(s).

Return type:

float or numpy.ndarray

dabax.common_tools.f0_interpolate_coefficients(charge, charge_list, coefficient_list, verbose=False)[source]

Interpolate f0 coefficients between available ionic charges.

Parameters:
  • charge (float) – Target ionic charge.

  • charge_list (list of float) – Available charge values in the data.

  • coefficient_list (list of array-like) – f0 coefficients corresponding to each entry in charge_list.

  • verbose (bool, optional) – Print interpolation details.

Returns:

Interpolated coefficient array.

Return type:

numpy.ndarray

dabax.common_tools.f0_xop(Z)[source]

Returns the f0 value as stired in the f0_xop DABAX file:

Parametrization of f0 (the non-dispersive part of the atomic scttering factor) vs sin(theta/lambda). This file contains a Waasmaier&Kirfel-like parametrization for the f0 data evaluated by Kissel using modified relativistic form factor [1]. For the fitting, model and the data error as in [2] are used. The parametrization was calculating by fitting the original data in the RTAB database [1] (also in the DABAX file f0_mf_Kissel.dat) using the MPFIT IDL procedure of Markwardt (http://cow.physics.wisc.edu/~craigm/idl/idl.html) usind the function [2]:

f0[k] = c + [SUM a_i*EXP(-b_i*(k^2)) ]

i=1,5

where k = sin(theta) / lambda and c, a_i and b_i are the coefficients tabulated in this file (in columns: a1 a2 a3 a4 a5 c b1 b2 b3 b4 b5

References [1] L. Kissel, Radiation physics and chemistry 59 (2000) 185-200

[2] D. Waasmaier & A. Kirfel (Acta Cryst. (1995). A51, 416-413)

Remarks: 1) This file contains data for only neutral atoms. For ionic states

other DABAX files (like f0_WaasKirf.dat) could be used.

  1. The coefficients in this file are prepared for xop2.1 and are unpublished.

  2. We created this file for being used as a default for XOP2.1. The reasons were two: i) It is more practical to use a parametrization rather than to use

    the direct data in file f0_mf.dat because of spped and storage reasons.

    1. The previous defaulty file for XOP 2.0 was f0_WaasKirf.dat, which

    contained a published parametrization [2], but the original data is from the International Tables for X-ray Crystallography, vol C, (1995) Edited by AJC Wilson, Kluwer Academic Press, table 6.1.1.3 which contains data from multiple origins (and references). We prefer to use evaluated data in the same conditions for all elements to keep some consistency in their origin. Additionally, Kissel data for f1f2 and CrossSec are also used in XOP.

Column description: a1 a2 a3 a4 a5 c b1 b2 b3 b4 b5

Parameters:

Z (int) – Atomic number.

Returns:

Array of 11 Waasmaier-Kirfel-like coefficients [a1..a5, c, b1..b5].

Return type:

numpy.ndarray

dabax.common_tools.f0_xop_with_fractional_charge(Z, charge=0.0)[source]
dabax.common_tools.f0_xop_with_fractional_charge_data(Z)[source]

Return the tabulated f0 coefficient data for fractional charges for element Z.

Parameters:

Z (int) – Atomic number.

Returns:

Each dict contains Z, charge_list, and coefficient_list.

Return type:

list of dict

dabax.common_tools.lorentz(theta_bragg_deg, return_what=0)[source]

This function returns the Lorentz factor, polarization factor (unpolarized beam), geometric factor, or a combination of them.

Parameters:
  • theta_bragg_deg – Bragg angle in degrees

  • return_what – A flag indicating the returned variable: 0: (default) PolFac*lorentzFac 1: PolFac 2: lorentzFac 3: geomFac

Returns:

a scalar value

dabax.common_tools.parse_formula(formula, verbose=False)[source]

Parse a chemical formula string into lists of atomic numbers and stoichiometric coefficients.

Parameters:
  • formula (str) – Chemical formula string, e.g. "SiO2", "Ca5(PO4)3.1F".

  • verbose (bool, optional) – Print intermediate parsing steps.

Returns:

  • zetas (list of int) – Atomic numbers of each element in the formula.

  • fatomic (list of float) – Stoichiometric coefficients for each element.

dabax.dabax_base module

dabax: python module for processing remote files containing dabax

class dabax.dabax_base.DabaxBase(dabax_repository=None, verbose=False, file_f0='f0_InterTables.dat', file_f1f2='f1f2_Windt.dat', file_CrossSec='CrossSec_EPDL97.dat', file_Crystals='Crystals.dat', file_AtomicWeights='AtomicWeights.dat', file_AtomicConstants='AtomicConstants.dat')[source]

Bases: object

Base class providing access to DABAX data files (local or remote).

Handles downloading, caching, and parsing of SPEC-format DABAX files for f0, f1f2, cross-sections, crystal structures, and atomic data.

atomic_constants(descriptor, filename='AtomicConstants.dat', return_item=0, return_label=None)[source]

Return atomic constants from DABAX.

Parameters:
  • descriptor (str or list of str) – Element symbol or list of symbols (e.g. "Si" or ["Si", "Fe"]).

  • filename (str, optional) – DABAX atomic constants file. Default "AtomicConstants.dat".

  • return_item (int, optional) – Column index to return (0–11). Used when return_label is None.

  • return_label (str, optional) – Name of the quantity to return. Takes priority over return_item. Accepted values: 'AtomicRadius', 'CovalentRadius', 'AtomicMass', 'BoilingPoint', 'MeltingPoint', 'Density', 'AtomicVolume', 'CoherentScatteringLength', 'IncoherentX-section', 'Absorption@1.8A', 'DebyeTemperature', 'ThermalConductivity'.

Returns:

Value(s) of the requested atomic constant.

Return type:

float or list of float

Examples

>>> dx.atomic_constants('Si', return_label='AtomicMass')
28.0855
atomic_weights(descriptor, filename='AtomicWeights.dat')[source]

Return atomic weights from DABAX.

Parameters:
  • descriptor (str or list of str) – Element symbol (e.g. "Ge") or isotope string (e.g. "70Ge"). If a plain symbol is given, the averaged atomic mass is returned. If an isotope prefix is given, the mass of that specific isotope is returned.

  • filename (str, optional) – DABAX atomic weights file. Default "AtomicWeights.dat".

Returns:

Atomic weight(s) in atomic mass units.

Return type:

float or list of float

compound_parser(descriptor)[source]

Parse a chemical formula and return composition data.

Parameters:

descriptor (str) – Chemical formula string (e.g. "SiO2", "H2O").

Returns:

Dictionary with keys: nElements, nAtomsAll, Elements (list of Z), massFractions, nAtoms, molarMass.

Return type:

dict

crosssec_extract(entry_name='Si', partial='TotalCrossSection[barn/atom]')[source]

Extract raw cross-section tabulated data from the DABAX file.

Parameters:
  • entry_name (str, optional) – Element symbol. Default "Si".

  • partial (str, optional) – Column label for the desired cross-section type. Default 'TotalCrossSection[barn/atom]'.

Returns:

  • energy (numpy.ndarray) – Photon energies in eV.

  • cs (numpy.ndarray) – Cross-section values.

crosssec_interpolate(entry_name, energy, method=2, partial='TotalCrossSection[barn/atom]')[source]

Interpolate cross-section at given photon energy values.

Parameters:
  • entry_name (str) – Element symbol.

  • energy (float or numpy.ndarray) – Photon energy in eV.

  • method (int, optional) – Interpolation method: 0=lin-lin, 1=lin-log, 2=log-lin (default), 3=log-log.

  • partial (str, optional) – Column label for the cross-section type.

Returns:

Interpolated cross-section value(s).

Return type:

float or numpy.ndarray

element_density(descriptor, filename='AtomicConstants.dat')[source]

Return the density of an element in g/cm³.

Parameters:
  • descriptor (str or list of str) – Element symbol(s).

  • filename (str, optional) – DABAX atomic constants file.

Returns:

Density in g/cm³.

Return type:

float or list of float

f0_with_fractional_charge(Z, charge=0.0)[source]

Return f0 coefficients for element Z at a given (possibly fractional) ionic charge.

Parameters:
  • Z (int) – Atomic number.

  • charge (float, optional) – Ionic charge. Interpolates between tabulated values when non-integer.

Returns:

f0 coefficient array.

Return type:

numpy.ndarray

f1f2_extract(entry_name='Y3+')[source]

Extract raw f1/f2 tabulated data from the DABAX file.

Parameters:

entry_name (str, optional) – Element symbol or ion. Default "Y3+".

Returns:

  • energy_in_eV (numpy.ndarray) – Photon energies in eV.

  • f1 (numpy.ndarray) – Real part of the anomalous scattering factor.

  • f2 (numpy.ndarray) – Imaginary part of the anomalous scattering factor.

f1f2_interpolate(entry_name, energy, method=2)[source]

Interpolate f1/f2 at given photon energy values.

Parameters:
  • entry_name (str) – Element symbol or ion.

  • energy (float or numpy.ndarray) – Photon energy in eV.

  • method (int, optional) – Interpolation method: 0=lin-lin, 1=lin-log, 2=log-lin (default), 3=log-log.

Returns:

  • f1_interpolated (float or numpy.ndarray)

  • f2_interpolated (float or numpy.ndarray)

get_dabax_default_repository()[source]

Return the default remote DABAX repository URL.

get_dabax_file(filename)[source]

Return the local path to a DABAX file, downloading it first if necessary.

Parameters:

filename (str) – DABAX file name (e.g. "f0_InterTables.dat").

Returns:

Absolute local filesystem path to the file.

Return type:

str

get_dabax_repository()[source]

Return the current DABAX repository URL or local path.

get_f0_coeffs_from_dabax_file(entry_name='Y3+')[source]

Return the f0 parametric coefficients for a given element or ion.

Parameters:

entry_name (str, optional) – Element symbol or ion (e.g. "Si", "Y3+"). Default "Y3+".

Returns:

Array of f0 coefficients, or empty list if not found.

Return type:

numpy.ndarray

get_file_AtomicConstants()[source]

Return the current atomic constants data file name.

get_file_AtomicWeights() str[source]

Return the current atomic weights data file name.

get_file_CrossSec()[source]

Return the current cross-section data file name.

get_file_Crystals()[source]

Return the current crystal structures data file name.

get_file_f0()[source]

Return the current f0 data file name.

get_file_f1f2()[source]

Return the current f1/f2 data file name.

info()[source]

Return a formatted string summarising the current DABAX configuration.

is_remote()[source]

Return True if the repository is a remote URL.

set_dabax_repository(repo)[source]

Set the DABAX repository URL or local path.

set_file_AtomicConstants(filename)[source]

Set and register the atomic constants data file.

set_file_AtomicWeights(filename)[source]

Set and register the atomic weights data file.

set_file_CrossSec(filename)[source]

Set and register the cross-section data file.

set_file_Crystals(filename)[source]

Set and register the crystal structures data file.

set_file_f0(filename)[source]

Set and register the f0 data file.

set_file_f1f2(filename)[source]

Set and register the f1/f2 data file.

set_verbose(value=True)[source]

Enable or disable verbose output.

verbose()[source]

Return the verbose flag.

class dabax.dabax_base.Functions[source]

Bases: object

Registry of DABAX data-file function types used to select parsing mode.

AtomicConstants = 'AtomicConstants'
AtomicWeights = 'AtomicWeights'
CrossSec = 'CrossSec'
Crystals = 'Crystals'
f0 = 'f0'
f1f2 = 'f1f2'
static get_mode(function)[source]

Return the parsing mode (0=column, 1=entry) for the given function type.

dabax.dabax_base.get_dabax_directory()[source]

Return the platform-specific local directory used to cache DABAX files.

Returns:

Path to the local DABAX cache directory (created if absent).

Return type:

str

dabax.dabax_base.wait_until_downloaded(filepath, timeout=60)[source]

Block until a file appears on disk or a timeout is reached.

Parameters:
  • filepath (str) – Path to the file to wait for.

  • timeout (float, optional) – Maximum wait time in seconds. Default 60.

Returns:

True if the file appeared, False on timeout.

Return type:

bool

dabax.dabax_files module

Utilities for listing and accessing DABAX data files.

dabax.dabax_files.dabax_crosssec_files()[source]

Return the list of available DABAX cross-section data files.

dabax.dabax_files.dabax_f0_files()[source]

Return the list of available DABAX f0 (form factor) data files.

dabax.dabax_files.dabax_f1f2_files()[source]

Return the list of available DABAX f1/f2 (anomalous scattering factor) data files.

dabax.dabax_xraylib module

xraylib-compatible API implementation using DABAX data files.

class dabax.dabax_xraylib.DabaxXraylib(dabax_repository=None, file_f0='f0_InterTables.dat', file_f1f2='f1f2_Windt.dat', file_CrossSec='CrossSec_EPDL97.dat', file_Crystals='Crystals.dat')[source]

Bases: DabaxBase, DabaxXraylibDecorator

Dabax decorated with xraylib interface (warning: not all xraylib functions are implemented)

get_file_NIST()[source]

Return the NIST compound data file name.

dabax.dabax_xraylib_decorator module

Decorator and function registry providing an xraylib-compatible interface backed by DABAX data.

class dabax.dabax_xraylib_decorator.DabaxXraylibDecorator[source]

Bases: object

Mixin providing an xraylib-compatible API backed by DABAX data files.

Not all xraylib functions are implemented. Mix in with DabaxBase (see DabaxXraylib) to obtain a fully usable object.

AtomicNumberToSymbol(Z)[source]

Return the element symbol for a given atomic number.

Parameters:

Z (int) – Atomic number.

Returns:

Element symbol (e.g. "Si" for Z=14).

Return type:

str

AtomicWeight(Z)[source]

Return the atomic weight of an element.

Parameters:

Z (int) – Atomic number.

Returns:

Atomic weight in g/mol.

Return type:

float

Bragg_angle(cryst, E_keV, h, k, l)[source]

Return the Bragg angle for a given crystal reflection and photon energy.

Parameters:
  • cryst (dict) – Crystal dictionary as returned by Crystal_GetCrystal().

  • E_keV (float) – Photon energy in keV.

  • h (int) – Miller indices.

  • k (int) – Miller indices.

  • l (int) – Miller indices.

Returns:

Bragg angle in radians.

Return type:

float

CS_Compt(Z, energy)[source]

Return the Compton (incoherent) scattering mass cross section in cm²/g.

Parameters:
  • Z (int) – Atomic number.

  • energy (float) – Photon energy in keV.

Returns:

Compton scattering mass cross section in cm²/g.

Return type:

float

CS_Compt_CP(descriptor, energy)[source]

Return the Compton scattering mass cross section in cm²/g for a compound.

Parameters:
  • descriptor (str) – Chemical formula or NIST compound name.

  • energy (float) – Photon energy in keV.

Returns:

Compton scattering mass cross section in cm²/g.

Return type:

float

CS_Photo(Z, energy)[source]

Return the photoionization mass cross section in cm²/g.

Parameters:
  • Z (int) – Atomic number.

  • energy (float) – Photon energy in keV.

Returns:

Photoionization mass cross section in cm²/g.

Return type:

float

CS_Photo_CP(descriptor, energy)[source]

Return the photoionization mass cross section in cm²/g for a compound.

Parameters:
  • descriptor (str) – Chemical formula or NIST compound name.

  • energy (float) – Photon energy in keV.

Returns:

Photoionization mass cross section in cm²/g.

Return type:

float

CS_Rayl(Z, energy)[source]

Return the Rayleigh (coherent) scattering mass cross section in cm²/g.

Parameters:
  • Z (int) – Atomic number.

  • energy (float) – Photon energy in keV.

Returns:

Rayleigh scattering mass cross section in cm²/g.

Return type:

float

CS_Rayl_CP(descriptor, energy)[source]

Return the Rayleigh scattering mass cross section in cm²/g for a compound.

Parameters:
  • descriptor (str) – Chemical formula or NIST compound name.

  • energy (float) – Photon energy in keV.

Returns:

Rayleigh scattering mass cross section in cm²/g.

Return type:

float

CS_Total(Z, energy)[source]

Return the total mass attenuation cross section in cm²/g.

Parameters:
  • Z (int) – Atomic number.

  • energy (float) – Photon energy in keV.

Returns:

Total mass attenuation cross section in cm²/g.

Return type:

float

CS_Total_CP(descriptor, energy)[source]

Return the total mass attenuation cross section in cm²/g for a compound.

Parameters:
  • descriptor (str) – Chemical formula (e.g. "SiO2") or NIST compound name.

  • energy (float) – Photon energy in keV.

Returns:

Total mass attenuation cross section in cm²/g.

Return type:

float

CSb_Compt(Z, energy)[source]

Return the Compton (incoherent) scattering cross section in barn/atom.

Parameters:
  • Z (int) – Atomic number.

  • energy (float) – Photon energy in keV.

Returns:

Compton scattering cross section in barn/atom.

Return type:

float

CSb_Compt_CP(descriptor, energy)[source]

Return the Compton scattering cross section in barn/atom for a compound.

Parameters:
  • descriptor (str) – Chemical formula or NIST compound name.

  • energy (float) – Photon energy in keV.

Returns:

Compton scattering cross section in barn/atom.

Return type:

float

CSb_Photo(Z, energy)[source]

Return the photoionization cross section in barn/atom.

Parameters:
  • Z (int) – Atomic number.

  • energy (float) – Photon energy in keV.

Returns:

Photoionization cross section in barn/atom.

Return type:

float

CSb_Photo_CP(descriptor, energy)[source]

Return the photoionization cross section in barn/atom for a compound.

Parameters:
  • descriptor (str) – Chemical formula or NIST compound name.

  • energy (float) – Photon energy in keV.

Returns:

Photoionization cross section in barn/atom.

Return type:

float

CSb_Rayl(Z, energy)[source]

Return the Rayleigh (coherent) scattering cross section in barn/atom.

Parameters:
  • Z (int) – Atomic number.

  • energy (float) – Photon energy in keV.

Returns:

Rayleigh scattering cross section in barn/atom.

Return type:

float

CSb_Rayl_CP(descriptor, energy)[source]

Return the Rayleigh scattering cross section in barn/atom for a compound.

Parameters:
  • descriptor (str) – Chemical formula or NIST compound name.

  • energy (float) – Photon energy in keV.

Returns:

Rayleigh scattering cross section in barn/atom.

Return type:

float

CSb_Total(Z, energy)[source]

Return the total attenuation cross section in barn/atom.

Parameters:
  • Z (int) – Atomic number.

  • energy (float) – Photon energy in keV.

Returns:

Total cross section in barn/atom.

Return type:

float

CSb_Total_CP(descriptor, energy)[source]

Return the total attenuation cross section in barn/atom for a compound.

Parameters:
  • descriptor (str) – Chemical formula or NIST compound name.

  • energy (float) – Photon energy in keV.

Returns:

Total cross section in barn/atom.

Return type:

float

CompoundParser(descriptor)[source]

Parse a chemical formula string into its elemental composition.

Parameters:

descriptor (str) – Chemical formula string (e.g. "H2O", "Ca5(PO4)3F").

Returns:

Dictionary with keys nElements, nAtomsAll, Elements (list of atomic numbers Z), massFractions, nAtoms, molarMass.

Return type:

dict

CompoundParserCheckingNIST(descriptor)[source]

Parse a compound descriptor, trying formula parsing first, then the NIST database.

Parameters:

descriptor (str) – Chemical formula (e.g. "H2O") or NIST compound name (e.g. "Water, Liquid").

Returns:

Composition dictionary as returned by CompoundParser() or GetCompoundDataNISTByName().

Return type:

dict

Crystal_F_0_F_H_F_H_bar_StructureFactor(crystal_id, energy_in_kev, millerH, millerK, millerL, debyeWaller, rel_angle=1.0)[source]

Calculate F_0, F_H, and F_H_bar structure factors in one call.

Parameters:
  • crystal_id (dict) – Crystal dictionary as returned by Crystal_GetCrystal().

  • energy_in_kev (float) – Photon energy in keV.

  • millerH (int) – Miller indices.

  • millerK (int) – Miller indices.

  • millerL (int) – Miller indices.

  • debyeWaller (float) – Debye-Waller factor.

  • rel_angle (float, optional) – Ratio of theta to the Bragg angle. Default 1.0.

Returns:

(F_0, F_H, F_H_bar) structure factors.

Return type:

tuple of complex

Crystal_F_H_StructureFactor(crystal_id, energy_in_kev, millerH, millerK, millerL, debyeWaller, ratio_theta_thetaB=1.0)[source]

Calculate the crystal structure factor F_H for a given reflection.

Parameters:
  • crystal_id (dict) – Crystal dictionary as returned by Crystal_GetCrystal().

  • energy_in_kev (float) – Photon energy in keV.

  • millerH (int) – Miller indices.

  • millerK (int) – Miller indices.

  • millerL (int) – Miller indices.

  • debyeWaller (float) – Debye-Waller factor.

  • ratio_theta_thetaB (float, optional) – Ratio of theta to the Bragg angle. Default 1.0.

Returns:

Structure factor F_H.

Return type:

complex or numpy.ndarray

Crystal_GetCrystal(entry_name='YB66')[source]

Parse a crystal structure from the DABAX file (equivalent to xraylib.Crystal_GetCrystal).

Parameters:

entry_name (str, optional) – Crystal name as stored in the DABAX Crystals file. Default 'YB66'.

Returns:

Crystal dictionary with keys: name, a, b, c, alpha, beta, gamma, volume, n_atom, atom (list of atom dicts each with Zatom, fraction, x, y, z, charge), cpointer.

Return type:

dict

Crystal_GetCrystalsList()[source]

Return the list of crystal names available in the DABAX Crystals file.

Returns:

Crystal names (e.g. ['Si', 'Ge', 'Diamond', ...]).

Return type:

list of str

Crystal_dSpacing(cryst, h, k, l)[source]

Return the d-spacing for Miller indices (h, k, l).

Parameters:
  • cryst (dict) – Crystal dictionary as returned by Crystal_GetCrystal().

  • h (int) – Miller indices.

  • k (int) – Miller indices.

  • l (int) – Miller indices.

Returns:

d-spacing in Å.

Return type:

float

ElementDensity(Z)[source]

Return the density of an element at room temperature.

Parameters:

Z (int) – Atomic number.

Returns:

Density in g/cm³.

Return type:

float

FF_Rayl(Z, q)[source]

Return the atomic form factor for Rayleigh (coherent) scattering.

Parameters:
  • Z (int) – Atomic number.

  • q (float or numpy.ndarray) – Momentum transfer in Å⁻¹ (q = sin(θ)/λ).

Returns:

Atomic form factor f0(q).

Return type:

float or numpy.ndarray

Fi(Z, energy)[source]

Return the real part of the anomalous scattering factor correction Δf′.

Parameters:
  • Z (int) – Atomic number.

  • energy (float) – Photon energy in keV.

Returns:

Δf′ (real anomalous dispersion correction).

Return type:

float

FiAndFii(Z, energy)[source]

Return both anomalous scattering factor corrections (Δf′, Δf″) in one call.

Parameters:
  • Z (int) – Atomic number.

  • energy (float or numpy.ndarray) – Photon energy in keV.

Returns:

(f1, f2) where f1 = Δf′ and f2 = Δf″ (both positive).

Return type:

tuple of float or numpy.ndarray

Fii(Z, energy)[source]

Return the imaginary part of the anomalous scattering factor correction Δf″.

Parameters:
  • Z (int) – Atomic number.

  • energy (float) – Photon energy in keV.

Returns:

Δf″ (imaginary anomalous absorption correction, always positive).

Return type:

float

GetCompoundDataNISTByIndex(index_found)[source]

Return NIST compound composition and density data by catalog index.

Parameters:

index_found (int) – Zero-based index into the NIST compound list.

Returns:

Dictionary with keys: name (str), nElements (int), density (float, g/cm³), Elements (list of Z), massFractions (list of float).

Return type:

dict

GetCompoundDataNISTByName(entry_name)[source]

Return NIST compound composition and density data by compound name.

Parameters:

entry_name (str) – NIST compound name (e.g. 'Water, Liquid').

Returns:

Same structure as GetCompoundDataNISTByIndex().

Return type:

dict

GetCompoundDataNISTList()[source]

Return the list of NIST compound names available in the DABAX file.

Returns:

NIST compound names (e.g. ['Air, Dry', 'Water, Liquid', ...]).

Return type:

list of str

Refractive_Index(descriptor, energy, density)[source]

Return the complex refractive index n = n_re + i·n_im for a material.

Parameters:
  • descriptor (str) – Chemical formula (e.g. "Be", "SiO2") or NIST compound name.

  • energy (float) – Photon energy in keV.

  • density (float) – Material density in g/cm³.

Returns:

Complex refractive index n.

Return type:

complex

Refractive_Index_Im(descriptor, energy, density)[source]

Return the imaginary part of the refractive index for a material.

Parameters:
  • descriptor (str) – Chemical formula or NIST compound name.

  • energy (float) – Photon energy in keV.

  • density (float) – Material density in g/cm³.

Returns:

Imaginary part of the refractive index (related to absorption).

Return type:

float

Refractive_Index_Re(descriptor, energy, density)[source]

Return the real part of the refractive index for a material.

Parameters:
  • descriptor (str) – Chemical formula or NIST compound name.

  • energy (float) – Photon energy in keV.

  • density (float) – Material density in g/cm³.

Returns:

Real part of the refractive index (≤ 1 for X-rays).

Return type:

float

SymbolToAtomicNumber(symbol)[source]

Return the atomic number corresponding to an element symbol.

Parameters:

symbol (str) – Element symbol (e.g. "Si").

Returns:

Atomic number Z.

Return type:

int

class dabax.dabax_xraylib_decorator.Functions[source]

Bases: Functions

Extended function-type registry adding NIST compound data support.

CompoundDataNIST = 'CompoundDataNIST'
static get_mode(function)[source]

Return the parsing mode for the given function type.

Module contents