xoppylib.scattering_functions package

Submodules

xoppylib.scattering_functions.cross_calc module

Absorption cross-section calculations for elements and compounds using dabax or xraylib.

xoppylib.scattering_functions.cross_calc.cross_calc(descriptor, energy, calculate=0, unit=None, density=None, verbose=True, material_constants_library=None)[source]

calculate the atomic cross sections and attenuation coefficients. :param descriptor: string with the element symbol or integer with Z :param energy: array with energies (eV) :param calculate:

0: total cross section 1: photoelectric cross section 2: rayleigh cross serction 3: compton cross section 4: total minus raileigh cross section

:param unit:An flag indicating the unit of the output array

None (default) return all units in multiple columns 0: barn/atom (Cross Section calculation) 1: cm^2 (Cross Section calculation) 2: cm^2/g (Mass Attenuation Coefficient) 3: cm^-1 (Linear Attenuation Coefficient)

Parameters:

density – the material density in g/cm^3

Returns:

if unit=None an array (5, npoints) with energy and unit=0 to 4, else returns one-column array

xoppylib.scattering_functions.cross_calc.cross_calc_mix(descriptor, energy, calculate=0, unit=None, parse_or_nist=0, density=None, verbose=True, material_constants_library=None)[source]

Same as cross_calc, but for a compund formula :param descriptor: a compound descriptor (as in xraylib) :param energy: photon energy array in eV :param calculate:

0: total cross section 1: photoelectric cross section 2: rayleigh cross serction 3: compton cross section 4: total minus raileigh cross section

:param unit:An flag indicating the unit of the output array

None (default) return all units in multiple columns 0: barn/atom (Cross Section calculation) 1: cm^2 (Cross Section calculation) 2: cm^2/g (Mass Attenuation Coefficient) 3: cm^-1 (Linear Attenuation Coefficient)

Parameters:
  • parse_or_nist – useless. Kept for back-compatibility.

  • density – the material density in g/cm^3

Returns:

xoppylib.scattering_functions.cross_calc.cross_calc_nist(descriptor, energy, calculate=0, unit=None, verbose=True, material_constants_library=None)[source]

Same as cross_calc, but for a compund from the NIST compound list :param descriptor: a compound descriptor (as in xraylib) :param energy: photon energy array in eV :param calculate:

0: total cross section 1: photoelectric cross section 2: rayleigh cross serction 3: compton cross section 4: total minus rayleigh cross section

:param unit:An flag indicating the unit of the output array

None (default) return all units in multiple columns 0: barn/atom (Cross Section calculation) 1: cm^2 (Cross Section calculation) 2: cm^2/g (Mass Attenuation Coefficient) 3: cm^-1 (Linear Attenuation Coefficient)

Returns:

xoppylib.scattering_functions.f0_calc module

Atomic form factor f0 calculations (legacy module, use xoppy_calc_f0 instead).

xoppylib.scattering_functions.f0_calc.f0_calc(MAT_FLAG, DESCRIPTOR, GRIDSTART, GRIDEND, GRIDN, FILE_NAME='', charge=0.0, material_constants_library=None)[source]

xoppylib.scattering_functions.f1f2_calc module

Anomalous scattering factor f1/f2 calculations and mirror reflectivity.

xoppylib.scattering_functions.f1f2_calc.f1f2_calc(descriptor, energy, theta=0.003, F=0, density=None, rough=0.0, verbose=True, material_constants_library=None)[source]

calculate the elastic Photon-Atom anonalous f1 and f2 coefficients as a function of energy. It also gives the refractive index components delta and beta (n=1-delta - i beta), the absorption photoelectric coefficient and the reflectivities (s,p and unpolarized). :param descriptor: string with the element symbol or integer with Z :param energy: array with energies (eV) :param theta: array with grazing angles (rad) :param F: calculation flag:

F=0 (default) returns a 2-col array with f1 and f2 F=1 returns f1 F=2 returns f2 F=3 returns delta [n = 1 -delta -i beta] F=4 returns betaf [n = 1 -delta -i beta] F=5 returns Photoelectric linear absorption coefficient F=6 returns Photoelectric mass absorption coefficient F=7 returns Photoelectric Cross Section F=8 returns s-polarized reflectivity F=9 returns p-polarized reflectivity F=10 returns unpolarized reflectivity F=11 returns delta/betaf F=12 returns delta calculated with F1 F=13 returns beta calculated with F2

Parameters:
  • density – the density to be used for some calculations. If None, get it from xraylib

  • rough – the roughness RMS in Angstroms for reflectivity calculations

Returns:

a numpy array with results

xoppylib.scattering_functions.f1f2_calc.f1f2_calc_mix(descriptor, energy, theta=0.003, F=0, density=None, rough=0.0, verbose=True, material_constants_library=None)[source]

Like f1f2_calc but for a chemical formula. S

Parameters:
  • descriptor – string with the element symbol or integer with Z

  • energy – array with energies (eV)

  • theta – array with grazing angles (rad)

  • F

    calculation flag:

    F=0 (default) returns a 2-col array with f1 and f2 F=1 returns f1 F=2 returns f2 F=3 returns delta [n = 1 -delta -i beta] F=4 returns betaf [n = 1 -delta -i beta] F=5 returns Photoelectric linear absorption coefficient F=6 returns Photoelectric mass absorption coefficient F=7 returns Photoelectric Cross Section F=8 returns s-polarized reflectivity F=9 returns p-polarized reflectivity F=10 returns unpolarized reflectivity F=11 returns delta/betaf

  • density – the density to be used for some calculations.

  • rough – the roughness RMS in Angstroms for reflectivity calculations

Returns:

a numpy array with results

xoppylib.scattering_functions.f1f2_calc.f1f2_calc_nist(descriptor, energy, theta=0.003, F=0, density=None, rough=0.0, verbose=True, material_constants_library=None)[source]
Like f1f2_calc but for a compound defined in the NIST list

See list here: http://lvserver.ugent.be/xraylib-web/index.php?xrlFunction=GetCompoundDataNISTList&Element=26&ElementOrCompound=FeSO4&Compound=Ca5%28PO4%293&AugerTransa=K&AugerTransb=L2&AugerTransc=M3&LinenameSwitch=IUPAC&Linename1a=K&Linename1b=L3&Linename2=KA1_LINE&NISTcompound=Gadolinium+Oxysulfide&RadioNuclide=55Fe&Shell=K_SHELL&Energy=10.0&Theta=1.5707964&Phi=3.14159&MomentumTransfer=0.57032&CKTrans=FL12_TRANS&Density=1.0&PZ=1.0&submit=Go%21&Language=C

Parameters:
  • descriptor – string with the name of compound as in NIST table

  • energy – array with energies (eV)

  • theta – array with grazing angles (rad)

  • F

    calculation flag:

    F=0 (default) returns a 2-col array with f1 and f2 F=1 returns f1 F=2 returns f2 F=3 returns delta [n = 1 -delta -i beta] F=4 returns betaf [n = 1 -delta -i beta] F=5 returns Photoelectric linear absorption coefficient F=6 returns Photoelectric mass absorption coefficient F=7 returns Photoelectric Cross Section F=8 returns s-polarized reflectivity F=9 returns p-polarized reflectivity F=10 returns unpolarized reflectivity F=11 returns delta/betaf

  • density – the density. If None, take from xraylib

  • rough – the roughness RMS in Angstroms for reflectivity calculations

Returns:

a numpy array with results

xoppylib.scattering_functions.fresnel module

Fresnel reflectivity and interface reflectivity for X-ray mirrors.

xoppylib.scattering_functions.fresnel.interface_reflectivity(alpha, gamma, theta1)[source]

Calculates the reflectivity of an interface using Fresnel formulas.

Code adapted from XOP and SHADOW :param alpha: the array with alpha values (alpha=2 delta, n=1-delta+i beta) :param gamma: the array with gamma (gamma=2 beta) :param theta1: a scalar with the grazing angle in rad :return:

xoppylib.scattering_functions.fresnel.reflectivity_fresnel(refraction_index_delta=1e-05, refraction_index_beta=0.0, grazing_angle_mrad=3.0, roughness_rms_A=0.0, photon_energy_ev=10000.0)[source]

Calculates the reflectivity of an interface using Fresnel formulas.

Code adapted from XOP and SHADOW

Parameters:
  • refraction_index_delta – scalar or array with delta (n=1-delta+i beta)

  • refraction_index_beta – scalar or array with beta (n=1-delta+i beta)

  • grazing_angle_mrad – scalar with grazing angle in mrad

  • roughness_rms_A – scalar with roughness rms in Angstroms

  • photon_energy_ev – scalar or array with photon energies in eV

Returns:

(rs,rp,runp) the s-polarized, p-pol and unpolarized reflectivities

xoppylib.scattering_functions.xoppy_calc_crosssec module

XOPPY cross-section calculator for elements and compounds.

xoppylib.scattering_functions.xoppy_calc_crosssec.xoppy_calc_crosssec(descriptor='Si', density='?', MAT_FLAG=2, CALCULATE=1, GRID=0, GRIDSTART=100.0, GRIDEND=10000.0, GRIDN=200, UNIT=0, DUMP_TO_FILE=0, FILE_NAME='CrossSec.dat', material_constants_library=None)[source]

xoppylib.scattering_functions.xoppy_calc_f0 module

XOPPY atomic form factor f0 calculator.

xoppylib.scattering_functions.xoppy_calc_f0.xoppy_calc_f0(descriptor='Si', MAT_FLAG=0, GRIDSTART=0.0, GRIDEND=8.0, GRIDN=100, DUMP_TO_FILE=0, FILE_NAME='f0.dat', CHARGE=0.0, material_constants_library=None)[source]

xoppylib.scattering_functions.xoppy_calc_f1f2 module

XOPPY anomalous scattering factor f1/f2 calculator.

xoppylib.scattering_functions.xoppy_calc_f1f2.xoppy_calc_f1f2(descriptor='Si', density='?', MAT_FLAG=0, CALCULATE=1, GRID=0, GRIDSTART=5000.0, GRIDEND=25000.0, GRIDN=100, THETAGRID=0, ROUGH=0.0, THETA1=2.0, THETA2=5.0, THETAN=50, DUMP_TO_FILE=0, FILE_NAME='f1f2.dat', material_constants_library=None)[source]

Module contents