xoppylib package
Subpackages
- xoppylib.crystals package
- xoppylib.decorators package
- Submodules
- xoppylib.decorators.dabax_decorated module
- xoppylib.decorators.xoppy_decorator module
- xoppylib.decorators.xraylib_decorated module
XraylibDecoratedXraylibDecorated.AtomicLevelWidth()XraylibDecorated.AtomicWeight()XraylibDecorated.Atomic_Factors()XraylibDecorated.AugerRate()XraylibDecorated.AugerYield()XraylibDecorated.Bragg_angle()XraylibDecorated.CS_Compt()XraylibDecorated.CS_Compt_CP()XraylibDecorated.CS_Energy()XraylibDecorated.CS_Energy_CP()XraylibDecorated.CS_FluorLine()XraylibDecorated.CS_FluorLine_Kissel()XraylibDecorated.CS_FluorLine_Kissel_Cascade()XraylibDecorated.CS_FluorLine_Kissel_Nonradiative_Cascade()XraylibDecorated.CS_FluorLine_Kissel_Radiative_Cascade()XraylibDecorated.CS_FluorLine_Kissel_no_Cascade()XraylibDecorated.CS_KN()XraylibDecorated.CS_Photo()XraylibDecorated.CS_Photo_CP()XraylibDecorated.CS_Photo_Partial()XraylibDecorated.CS_Photo_Total()XraylibDecorated.CS_Photo_Total_CP()XraylibDecorated.CS_Rayl()XraylibDecorated.CS_Rayl_CP()XraylibDecorated.CS_Total()XraylibDecorated.CS_Total_CP()XraylibDecorated.CS_Total_Kissel()XraylibDecorated.CS_Total_Kissel_CP()XraylibDecorated.CSb_Compt()XraylibDecorated.CSb_Compt_CP()XraylibDecorated.CSb_FluorLine()XraylibDecorated.CSb_FluorLine_Kissel()XraylibDecorated.CSb_FluorLine_Kissel_Cascade()XraylibDecorated.CSb_FluorLine_Kissel_Nonradiative_Cascade()XraylibDecorated.CSb_FluorLine_Kissel_Radiative_Cascade()XraylibDecorated.CSb_FluorLine_Kissel_no_Cascade()XraylibDecorated.CSb_Photo()XraylibDecorated.CSb_Photo_CP()XraylibDecorated.CSb_Photo_Partial()XraylibDecorated.CSb_Photo_Total()XraylibDecorated.CSb_Photo_Total_CP()XraylibDecorated.CSb_Rayl()XraylibDecorated.CSb_Rayl_CP()XraylibDecorated.CSb_Total()XraylibDecorated.CSb_Total_CP()XraylibDecorated.CSb_Total_Kissel()XraylibDecorated.CSb_Total_Kissel_CP()XraylibDecorated.CompoundParser()XraylibDecorated.ComptonEnergy()XraylibDecorated.ComptonProfile()XraylibDecorated.ComptonProfile_Partial()XraylibDecorated.CosKronTransProb()XraylibDecorated.Crystal_F_H_StructureFactor()XraylibDecorated.Crystal_F_H_StructureFactor_Partial()XraylibDecorated.Crystal_Free()XraylibDecorated.Crystal_GetCrystal()XraylibDecorated.Crystal_GetCrystalsList()XraylibDecorated.Crystal_MakeCopy()XraylibDecorated.Crystal_UnitCellVolume()XraylibDecorated.Crystal_dSpacing()XraylibDecorated.DCSP_Compt()XraylibDecorated.DCSP_Compt_CP()XraylibDecorated.DCSP_KN()XraylibDecorated.DCSP_Rayl()XraylibDecorated.DCSP_Rayl_CP()XraylibDecorated.DCSP_Thoms()XraylibDecorated.DCSPb_Compt()XraylibDecorated.DCSPb_Compt_CP()XraylibDecorated.DCSPb_Rayl()XraylibDecorated.DCSPb_Rayl_CP()XraylibDecorated.DCS_Compt()XraylibDecorated.DCS_Compt_CP()XraylibDecorated.DCS_KN()XraylibDecorated.DCS_Rayl()XraylibDecorated.DCS_Rayl_CP()XraylibDecorated.DCS_Thoms()XraylibDecorated.DCSb_Compt()XraylibDecorated.DCSb_Compt_CP()XraylibDecorated.DCSb_Rayl()XraylibDecorated.DCSb_Rayl_CP()XraylibDecorated.EdgeEnergy()XraylibDecorated.ElectronConfig()XraylibDecorated.ElementDensity()XraylibDecorated.FF_Rayl()XraylibDecorated.Fi()XraylibDecorated.Fii()XraylibDecorated.FluorYield()XraylibDecorated.GetCompoundDataNISTByIndex()XraylibDecorated.GetCompoundDataNISTByName()XraylibDecorated.GetCompoundDataNISTList()XraylibDecorated.GetErrorMessages()XraylibDecorated.GetExitStatus()XraylibDecorated.GetRadioNuclideDataByIndex()XraylibDecorated.GetRadioNuclideDataByName()XraylibDecorated.GetRadioNuclideDataList()XraylibDecorated.JumpFactor()XraylibDecorated.LineEnergy()XraylibDecorated.MomentTransf()XraylibDecorated.Q_scattering_amplitude()XraylibDecorated.RadRate()XraylibDecorated.Refractive_Index()XraylibDecorated.Refractive_Index_Im()XraylibDecorated.Refractive_Index_Re()XraylibDecorated.SF_Compt()XraylibDecorated.SetErrorMessages()XraylibDecorated.SetExitStatus()XraylibDecorated.SetHardExit()XraylibDecorated.XRayInit()
- Module contents
- xoppylib.power package
- xoppylib.scattering_functions package
- Submodules
- xoppylib.scattering_functions.cross_calc module
- xoppylib.scattering_functions.f0_calc module
- xoppylib.scattering_functions.f1f2_calc module
- xoppylib.scattering_functions.fresnel module
- xoppylib.scattering_functions.xoppy_calc_crosssec module
- xoppylib.scattering_functions.xoppy_calc_f0 module
- xoppylib.scattering_functions.xoppy_calc_f1f2 module
- Module contents
- xoppylib.sources package
- Submodules
- xoppylib.sources.calc2d_kim module
- xoppylib.sources.parse_urgent module
- xoppylib.sources.srundplug module
- xoppylib.sources.urgentpy_power_density_from_harmonics module
- xoppylib.sources.urgentpy_spectrum module
- xoppylib.sources.xoppy_bm_wiggler module
- xoppylib.sources.xoppy_calc_black_body module
- xoppylib.sources.xoppy_calc_tcpy module
- xoppylib.sources.xoppy_calc_wspy module
- xoppylib.sources.xoppy_undulators module
- Module contents
- xoppylib.srcalc package
- Submodules
- xoppylib.srcalc.beam module
BeamBeam.column_names()Beam.difference()Beam.duplicate()Beam.genSource()Beam.get_column()Beam.get_columns()Beam.get_intensity()Beam.get_number_of_rays()Beam.get_photon_energy_eV()Beam.get_photon_wavelength()Beam.get_rays()Beam.get_standard_deviation()Beam.histo2()Beam.identical()Beam.info()Beam.initialize_as_pencil()Beam.initialize_from_array()Beam.intensity()Beam.load()Beam.retrace()Beam.rotate()Beam.set_column()Beam.set_photon_energy_eV()Beam.set_photon_wavelength()Beam.traceOE()Beam.translation()Beam.write()
- xoppylib.srcalc.conic module
ConicConic.apply_specular_reflection_on_beam()Conic.calculate_intercept()Conic.choose_solution()Conic.duplicate()Conic.get_coefficients()Conic.get_normal()Conic.height()Conic.info()Conic.initialize_as_ellipsoid_from_focal_distances()Conic.initialize_as_hyperboloid_from_focal_distances()Conic.initialize_as_paraboloid_from_focal_distances()Conic.initialize_as_plane()Conic.initialize_as_sphere_from_curvature_radius()Conic.initialize_as_sphere_from_focal_distances()Conic.initialize_from_coefficients()Conic.rotation_surface_conic()Conic.rotation_surface_conic_x()Conic.rotation_surface_conic_y()Conic.rotation_surface_conic_z()Conic.set_coefficients()Conic.set_cylindrical()Conic.set_ellipsoid_from_focal_distances()Conic.set_hyperboloid_from_focal_distances()Conic.set_paraboloid_from_focal_distances()Conic.set_sphere_from_curvature_radius()Conic.set_sphere_from_focal_distances()Conic.switch_convexity()Conic.translation_surface_conic()Conic.translation_surface_conic_x()Conic.translation_surface_conic_y()Conic.translation_surface_conic_z()Conic.vector_reflection()Conic.z_vs_xy()
- xoppylib.srcalc.srcalc module
- xoppylib.srcalc.toroid module
ToroidToroid.apply_specular_reflection_on_beam()Toroid.calculate_intercept()Toroid.duplicate()Toroid.get_coefficients()Toroid.get_normal()Toroid.get_tangential_and_sagittal_radii()Toroid.get_toroid_radii()Toroid.info()Toroid.initialize_from_coefficients()Toroid.set_coefficients()Toroid.set_cylindrical()Toroid.set_from_focal_distances()Toroid.set_tangential_and_sagittal_radii()Toroid.set_toroid_radii()Toroid.switch_convexity()Toroid.vector_reflection()
- Module contents
Submodules
xoppylib.fit_gaussian2d module
2D Gaussian fitting utilities using scipy.optimize.
xoppylib.mlayer module
python version of the multilayer code in shadow.
The stack is as follows: Vacuum+[Odd,Even]xn+Substrate
>>> # vacuum ")
>>> # |------------------------------| >>> # | odd (n) | |
>>> # |------------------------------| | BILAYER # n
>>> # | even (n) | |
>>> # |------------------------------| /
>>> # | . |
>>> # | . |
>>> # | . |
>>> # |------------------------------| >>> # | odd (1) | |
>>> # |------------------------------| | BILAYER # 1
>>> # | even (1) | |
>>> # |------------------------------| /
>>> # | |
>>> # |///////// substrate //////////|
>>> # | |
>>> # gamma = thickness_even / (thickness_even + thickness_odd)
- class xoppylib.mlayer.MLayer[source]
Bases:
objectConstructor.
Several ways of using MLayer: * ml = MLayer.pre_mlayer(<keywords>) * ml = MLayer(); ml.read_preprocessor_file(‘mymlayer.dat’) * ml = MLayer.initialize_from_bilayer_stack(<keywords>)
- classmethod initialize_from_bilayer_stack(material_S='Si', density_S=None, roughness_S=0.0, material_E='B4C', density_E=None, roughness_E=0.0, material_O='Ru', density_O=None, roughness_O=0.0, bilayer_pairs=70, bilayer_thickness=33.1, bilayer_gamma=0.483, GRADE_SURFACE=0, AA0=1.0, AA1=0.0, AA2=0.0, AA3=0.0, ell_p=10.0, ell_q=3.0, ell_theta_grazing_deg=0.1, ell_length=0.1, ell_photon_energy=10000.0, GRADE_DEPTH=0, LIST_N_THICK_GAMMA_ROUGHE_ROUGHO_FROM_TOP_TO_BOTTOM=None, use_xraylib_or_dabax=0, dabax=None)[source]
Creates an instance of MLayer with the main parameters of a multilater. In this case, the calculations are done without using the preprocessor data, and the optical constants are supplied by xraylib at run time.
- Parameters:
material_S (str, optional) – The symbol of the SUBSTRATE material.
density_S (float, optional) – The density in g/cm3 for the SUBSTRATE layers.
roughness_S (float, optional) – The roughness in A for the SUBSTRATE layers.
material_E (str, optional) – The symbol of the EVEN layer material.
density_E (float, optional) – The density in g/cm3 for the EVEN layers.
roughness_E (float, optional) – The roughness in A for the EVEN layers.
material_O (str, optional) – The symbol of the ODD layer material.
density_O (float, optional) – The density in g/cm3 for the ODD layers.
roughness_O (float, optional) – The roughness in A for the ODD layers.
bilayer_pairs (int, optional) – The number of bilayers.
bilayer_thickness (float, optional) – The thickness in A of the bilayers.
bilayer_gamma (float, optional) – The gamma factor of the bilayer thickness(even) / (thichness(odd) + thichness(even)).
GRADE_SURFACE (int, optional) –
- Flag for multilayer graded over the surface:
0: No.
1: Not used (for compatibility with SHADOW3).
2: Not used (for compatibility with SHADOW3).
3: t graded over the surface (input quadratic fit to t gradient in meters).
- 4: t graded over the surface for an elliptical multilayer (quadratic coefficients are calculated from
the ellipse design parameters).
AA0 (float, optional) – Coefficient (constant); used when GRADED_SURFACE=2
AA1 (float, optional) – Coefficient (linear) in m^-1; used when GRADED_SURFACE=2
AA2 (float, optional) – Coefficient (quadratic) in m^-2; used when GRADED_SURFACE=2
AA3 (float, optional) – Coefficient (cubic) in m^-3; used when GRADED_SURFACE=2
ell_p (float, optional) – The ellipse design parameters p in m; used when GRADED_SURFACE=3.
ell_q (float, optional) – The ellipse design parameters q in m; used when GRADED_SURFACE=3.
ell_theta_grazing_deg (float, optional) – The ellipse design grazing angle in deg; used when GRADED_SURFACE=3.
ell_length (float, optional) – The ellipse length in m; used when GRADED_SURFACE=3.
ell_photon_energy (float, optional) – The photon energy in eV at the center of the ellipse; used when GRADED_SURFACE=3.
use_xraylib_or_dabax (int, optional) – 0=use xraylib, 1=use dabax for the optical constabrs.
dabax (None or instance of DabaxXraylib,) – The pointer to the dabax library (used for use_xraylib_or_dabax = 1).
- Return type:
instance of MLayer
- classmethod initialize_from_bilayer_stack_in_compressed_format(structure='[Pd/B4C]x150+Si', density_O=None, roughness_O=0.0, density_E=None, roughness_E=0.0, density_S=None, roughness_S=0.0, bilayer_thickness=33.1, bilayer_gamma=0.483, GRADE_SURFACE=0, AA0=1.0, AA1=0.0, AA2=0.0, AA3=0.0, ell_p=10.0, ell_q=3.0, ell_theta_grazing_deg=0.1, ell_length=0.1, ell_photon_energy=10000.0, GRADE_DEPTH=0, LIST_N_THICK_GAMMA_ROUGHE_ROUGHO_FROM_TOP_TO_BOTTOM=None, use_xraylib_or_dabax=0, dabax=None)[source]
Creates an instance of MLayer with the main parameters of a multilater. In this case, the calculations are done without using the preprocessor data, and the optical constants are supplied by xraylib at run time.
- Parameters:
material_S (str, optional) – The symbol of the SUBSTRATE material.
density_S (float, optional) – The density in g/cm3 for the SUBSTRATE layers.
roughness_S (float, optional) – The roughness in A for the SUBSTRATE layers.
material_E (str, optional) – The symbol of the EVEN layer material.
density_E (float, optional) – The density in g/cm3 for the EVEN layers.
roughness_E (float, optional) – The roughness in A for the EVEN layers.
material_O (str, optional) – The symbol of the ODD layer material.
density_O (float, optional) – The density in g/cm3 for the ODD layers.
roughness_O (float, optional) – The roughness in A for the ODD layers.
bilayer_pairs (int, optional) – The number of bilayers.
bilayer_thickness (float, optional) – The thickness in A of the bilayers.
bilayer_gamma (float, optional) – The gamma factor of the bilayer thickness(even) / (thichness(odd) + thichness(even)).
GRADE_SURFACE (int, optional) –
- Flag for multilayer graded over the surface:
0: No.
1: Not used (for compatibility with SHADOW3).
2: Not used (for compatibility with SHADOW3).
3: t graded over the surface (input quadratic fit to t gradient in meters).
- 4: t graded over the surface for an elliptical multilayer (quadratic coefficients are calculated from
the ellipse design parameters).
AA0 (float, optional) – Coefficient (constant); used when GRADED_SURFACE=2
AA1 (float, optional) – Coefficient (linear) in m^-1; used when GRADED_SURFACE=2
AA2 (float, optional) – Coefficient (quadratic) in m^-2; used when GRADED_SURFACE=2
AA3 (float, optional) – Coefficient (cubic) in m^-3; used when GRADED_SURFACE=2
ell_p (float, optional) – The ellipse design parameters p in m; used when GRADED_SURFACE=3.
ell_q (float, optional) – The ellipse design parameters q in m; used when GRADED_SURFACE=3.
ell_theta_grazing_deg (float, optional) – The ellipse design grazing angle in deg; used when GRADED_SURFACE=3.
ell_length (float, optional) – The ellipse length in m; used when GRADED_SURFACE=3.
ell_photon_energy (float, optional) – The photon energy in eV at the center of the ellipse; used when GRADED_SURFACE=3.
use_xraylib_or_dabax (int, optional) – 0=use xraylib, 1=use dabax for the optical constabrs.
dabax (None or instance of DabaxXraylib,) – The pointer to the dabax library (used for use_xraylib_or_dabax = 1).
- Return type:
instance of MLayer
- is_laterally_graded()[source]
Returns True if the multilayes is laterally-graded.
- Return type:
bool
- classmethod pre_mlayer(FILE='pre_mlayer.dat', E_MIN=5000.0, E_MAX=20000.0, S_DENSITY=2.33, S_MATERIAL='Si', E_DENSITY=2.4, E_MATERIAL='B4C', O_DENSITY=9.4, O_MATERIAL='Ru', N_PAIRS=70, THICKNESS=33.1, GAMMA=0.483, ROUGHNESS_EVEN=3.3, ROUGHNESS_ODD=3.1, GRADE_SURFACE=0, AA0=1.0, AA1=0.0, AA2=0.0, AA3=0.0, ell_p=10.0, ell_q=3.0, ell_theta_grazing_deg=0.1, ell_length=0.1, ell_photon_energy=10000.0, GRADE_DEPTH=0, LIST_N_THICK_GAMMA_ROUGHE_ROUGHO_FROM_TOP_TO_BOTTOM=None, use_xraylib_or_dabax=0, dabax=None)[source]
Creates an instance of MLayer with parameters initialized from the keyword parameters and the pre_mlayer preprocessor file. It uses xraylib for accessing the optical constants.
- Parameters:
FILE (str, optional) – File name to be created (preprocessor pre_mlayer file).
E_MIN (float, optional) – The minimum photon energy in eV (for creating the tabulated refraction index).
E_MAX (float, optional) – The maximum photon energy in eV (for creating the tabulated refraction index).
S_DENSITY (float, optional) – Density (in g/cm3) for the SUBSTRATE material.
S_MATERIAL (float, optional) – Material formula for the SUBSTRATE material.
E_DENSITY (float, optional) – Density (in g/cm3) for the EVEN material.
E_MATERIAL (float, optional) – Material formula for the EVEN material.
O_DENSITY (float, optional) – Density (in g/cm3) for the ODD material.
O_MATERIAL (float, optional) – Material formula for the ODD material.
N_PAIRS (int, optional) – The number of bilayers of the multilayer. Not used if GRADE_DEPTH=1.
THICKNESS (float, optional) – The thickness of a bilayer in Angstroms. Not used if GRADE_DEPTH=1.
GAMMA (float, optional) – The gamma factor thickness(even) / (thickness(odd) + thickness(even)) for the multilayer. Not used if GRADE_DEPTH=1.
ROUGHNESS_EVEN (float, optional) – The rounghness of the EVEN layers in A. Not used if GRADE_DEPTH=1.
ROUGHNESS_ODD (float, optional) – The rounghness of the ODD layers in A. Not used if GRADE_DEPTH=1.
GRADE_SURFACE (int, optional) –
- Flag for multilayer graded over the surface:
0: No.
1: Not used (for compatibility with SHADOW3).
2: Not used (for compatibility with SHADOW3).
3: t graded over the surface (input quadratic fit to t gradient in meters).
- 4: t graded over the surface for an elliptical multilayer (quadratic coefficients are calculated from
the ellipse design parameters).
AA0 (float, optional) – Coefficient (constant); used when GRADED_SURFACE=2
AA1 (float, optional) – Coefficient (linear) in m^-1; used when GRADED_SURFACE=2
AA2 (float, optional) – Coefficient (quadratic) in m^-2; used when GRADED_SURFACE=2
AA3 (float, optional) – Coefficient (cubic) in m^-3; used when GRADED_SURFACE=2
ell_p (float, optional) – The ellipse design parameters p in m; used when GRADED_SURFACE=3.
ell_q (float, optional) – The ellipse design parameters q in m; used when GRADED_SURFACE=3.
ell_theta_grazing_deg (float, optional) – The ellipse design grazing angle in deg; used when GRADED_SURFACE=3.
ell_length (float, optional) – The ellipse length in m; used when GRADED_SURFACE=3.
ell_photon_energy (float, optional) – The photon energy in eV at the center of the ellipse; used when GRADED_SURFACE=3.
GRADE_DEPTH (int, optional) – Flag to indicate if the multilayes has a graded thickness (1) or not (0).
LIST_N_THICK_GAMMA_ROUGHE_ROUGHO_FROM_TOP_TO_BOTTOM (None or str) – A str with a list definition of multilayers blocks in the form: [block1, block2, …] with each block defined as [Nbilayers, BilayerThickness, BilayerGamma, roughnessEven, roughnessOdd].
use_xraylib_or_dabax (int, optional) – 0=use xraylib, 1=use dabax for the optical constabrs.
dabax (None or instance of DabaxXraylib,) – The pointer to the dabax library (used for use_xraylib_or_dabax = 1).
- Returns:
It contains a dictionary in MLayer.pre_mlayer_dict with the data in the following keys:
np : number of photon energy points,
energy : numpy array with photon energy,
delta_s : numpy array with refraction index (delta) for substrate,
beta_s : numpy array with refraction index (beta) for substrate,
delta_e : numpy array with refraction index (delta) for even sublayer,
beta_e : numpy array with refraction index (beta) for even sublayer,
delta_o : numpy array with refraction index (delta) for odd sublayer,
beta_o : numpy array with refraction index (beta) for odd sublayer,
npair : number of bilayer paits,
thick : numpy array with bilayer thicknesses,
gamma1 : numpy array with bilayer gamma,
mlroughness1 : numpy array with roughness for even sublayer,
mlroughness2 : numpy array with roughness for odd sublayer,
igrade : GRADE_SURFACE flag,
a0, a1, a2, a3 : polynomial coefficients for laterally graded multilayers (GRADE_SURFACE=3),
- ell_p, ell_q, ell_theta_grazing_deg, ell_length, ell_photon_energyellipse settings for laterally
graded multilayers (GRADE_SURFACE=4).
- Return type:
instance of MLayer
Notes
This method requires xraylib to access to the optical constants.
- read_preprocessor_file(filename)[source]
Reads a preprocessor (pre_mlayer) file. It has the same file format as in shadow3.
- Parameters:
filename (str) – The name of the filename.
- reflectivity(grazing_angle_deg, photon_energy_ev, Y=0.0)[source]
Computes the reflectivity (in amplitude) as a function of the incident angle and photon energy.
- Parameters:
grazing_angle_deg (numpy array) – The array with the incident gracing angle in deg.
photon_energy_ev (numpy array) – The array with the photon energy in eV.
Y (numpy array) – The array of coordinates along the Y direction (tangential). This is used only in the case of laterally graded multilayers.
- Returns:
(R_S_array, R_P_array, phase_S, phase_P) arrays with reflectivities (in amplitude) and phases.
- Return type:
tuple
- scan(h5file='', energyN=51, energy1=5000.0, energy2=20000.0, thetaN=1, theta1=0.75, theta2=0.75, verbose=0)[source]
this method computes the multilayer reflectivity vs photon energy and/or angle. The reflectivity values are for amplitude.
- Parameters:
energyN (int, optional) – Number of points in photon energy.
energy1 (float, optional) – The minimum photon energy in eV.
energy2 (float, optional) – The maximum photon energy in eV.
thetaN (int, optional) – Number of points in incident grazing angle.
theta1 (float, optional) – The minimum value of the incident grazing angle in deg.
theta2 (float, optional) – The minimum value of the incident grazing angle in deg.
h5file (str, optional) – Name of the h5 file to dump calculated data. Set to “” to avoid creating file.
verbose (int, optional) – if verbose=1, and thetaN=angleN=1 a text with results is printed .
- Returns:
(R_S_array, R_P_array, energy_array, theta_array) numpy arrays for the sigma reflectivity (energyN, thetaN), pi reflectivity (energyN, thetaN), photon energy (energyN) and incident grazing angle (thetaN).
- Return type:
tuple
- scan_arrays(energy_array, theta_array_deg)[source]
this method computes the multilayer reflectivity vs photon energy and/or angle. The reflectivity values are for amplitude.
- Parameters:
energy_array (array) – Array with energy in eV.
theta_array_deg (array) – Array with grazing angles in deg.
- Returns:
(R_S_array, R_P_array).
- Return type:
tuple
- scan_energy(energy_array, theta_deg)[source]
Compute multilayer reflectivity for an energy array of arbitrary shape at a single fixed grazing angle.
Unlike
scan/scan_arrays, the output arrays have exactly the same shape asenergy_array, so callers that work with 2-D or 3-D energy grids (e.g. angle-dependent resonant energies from undulator harmonics) can use the result directly without reshaping.- Parameters:
energy_array (array_like) – Photon energies in eV. Any shape is accepted.
theta_deg (float) – Grazing angle in degrees (single value).
- Returns:
R_S (numpy.ndarray) – S-polarisation reflectivity amplitude, same shape as energy_array.
R_P (numpy.ndarray) – P-polarisation reflectivity amplitude, same shape as energy_array.
xoppylib.xoppy_run_binaries module
Utilities for running XOPPY external Fortran/C binaries (URGENT, US, SRW wrappers).
- xoppylib.xoppy_run_binaries.xoppy_calc_inpro(CRYSTAL_MATERIAL=0, MODE=0, ENERGY=8000.0, MILLER_INDEX_H=1, MILLER_INDEX_K=1, MILLER_INDEX_L=1, ASYMMETRY_ANGLE=0.0, THICKNESS=500.0, TEMPERATURE=300.0, NPOINTS=100, SCALE=0, XFROM=-50.0, XTO=50.0)[source]
- xoppylib.xoppy_run_binaries.xoppy_calc_powder_fml(FILE='/home/docs/checkouts/readthedocs.org/user_builds/xoppylib/checkouts/latest/xoppylib/data/cif/icsd_31142_sepiolite_BraunerPreisinger.cif', TITLE='powder pattern using crysFML', LAMBDA=1.54056, JOB=0, U=0.0002, V=-0.0002, W=0.012, X=0.0019, LS=1900.0, THMIN=1.0, STEP=0.05, THMAX=135.0)[source]
- xoppylib.xoppy_run_binaries.xoppy_calc_ws(ENERGY=7.0, CUR=100.0, PERIOD=8.5, N=28.0, KX=0.0, KY=8.739999771118164, EMIN=1000.0, EMAX=100000.0, NEE=2000, D=30.0, XPC=0.0, YPC=0.0, XPS=2.0, YPS=2.0, NXP=10, NYP=10)[source]
- xoppylib.xoppy_run_binaries.xoppy_calc_xcom(NAME='Pyrex Glass', SUBSTANCE=3, DESCRIPTION='SiO2:B2O3:Na2O:Al2O3:K2O', FRACTION='0.807:0.129:0.038:0.022:0.004', GRID=1, GRIDINPUT=0, GRIDDATA='0.0804:0.2790:0.6616:1.3685:2.7541', ELEMENTOUTPUT=0)[source]
- xoppylib.xoppy_run_binaries.xoppy_calc_xtc(ENERGY=7.0, CURRENT=100.0, ENERGY_SPREAD=0.00096, SIGX=0.274, SIGY=0.011, SIGX1=0.0113, SIGY1=0.0036, PERIOD=3.23, NP=70, EMIN=2950.0, EMAX=13500.0, N=40, HARMONIC_FROM=1, HARMONIC_TO=15, HARMONIC_STEP=2, HELICAL=0, METHOD=1, NEKS=100)[source]
- xoppylib.xoppy_run_binaries.xoppy_calc_xtcap(ENERGY=6.0, CURRENT=200.0, ENERGY_SPREAD=0.00138, SIGX=0.0148, SIGY=0.0037, SIGX1=0.0029, SIGY1=0.0015, PERIOD=2.8, NP=84, EMIN=3217.0, EMAX=11975.0, N=50, DISTANCE=30.0, XPS=1.0, YPS=1.0, XPC=0.0, YPC=0.0, HARMONIC_FROM=1, HARMONIC_TO=7, HARMONIC_STEP=2, HRED=0, HELICAL=0, NEKS=100, METHOD=0, BSL=0)[source]
- xoppylib.xoppy_run_binaries.xoppy_calc_yaup(TITLE='YAUP EXAMPLE (ESRF BL-8)', PERIOD=4.0, NPER=42, NPTS=40, EMIN=3000.0, EMAX=30000.0, NENERGY=100, ENERGY=6.04, CUR=0.1, SIGX=0.426, SIGY=0.085, SIGX1=0.017, SIGY1=0.0085, D=30.0, XPC=0.0, YPC=0.0, XPS=2.0, YPS=2.0, NXP=69, NYP=69, MODE=4, NSIG=2, TRAJECTORY='new+keep', XSYM='yes', HANNING=0, BFILE='undul.bf', TFILE='undul.traj', BFIELD_FLAG=1, BFIELD_ASCIIFILE='', PERIOD_BFIELD=4.0, NPER_BFIELD=42, NPTS_BFIELD=40, IMAGNET=0, ITYPE=0, K=1.38, GAP=2.0, GAPTAP=10.0, FILE='undul.bf', I2TYPE=0, A1=0.5, A2=1.0)[source]
xoppylib.xoppy_util module
General utility functions for XOPPY: file locations, plotting helpers, and data I/O.
- class xoppylib.xoppy_util.XoppyPhysics[source]
Bases:
object- A2EV = 12398.419843320025
- K2EV = 50677.30716156396
- codata_c = 299792458.0
- codata_ec = 1.602176634e-19
- codata_h = 6.62607015e-34
xoppylib.xoppy_xraylib_util module
XOPPY utility functions wrapping dabax/xraylib for material constants, densities, and scattering factors.
- xoppylib.xoppy_xraylib_util.Refractive_Index_Im_Extended_NIST(descriptor, energy_in_keV, density, material_constants_library=None)[source]
- xoppylib.xoppy_xraylib_util.Refractive_Index_Re_Extended_NIST(descriptor, energy_in_keV, density, material_constants_library=None)[source]
- xoppylib.xoppy_xraylib_util.density_element(DESCRIPTOR, verbose=False, material_constants_library=None)[source]
- xoppylib.xoppy_xraylib_util.density_nist(DESCRIPTOR, verbose=False, material_constants_library=None)[source]
- xoppylib.xoppy_xraylib_util.descriptor_kind_index(descriptor, material_constants_library=None)[source]
- xoppylib.xoppy_xraylib_util.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
available at: http://www-phys.llnl.gov/Research/scattering/RTAB.html
[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.
The coefficients in this file are prepared for xop2.1 and are unpublished.
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.
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 – the atomic number
- Returns:
the 11 coefficients for buiding f0
- xoppylib.xoppy_xraylib_util.parse_formula(formula, material_constants_library=None)[source]
- Parameters:
formula – a formule (e.g. H2O)
- Returns:
a dictionary with tags: “Symbols”,”Elements”,”n”,”atomicWeight”,”massFractions”,”molecularWeight”
- xoppylib.xoppy_xraylib_util.write_spec_file(file_out, data, titles, scan_title='')[source]
Writes a spec-formatted file :param file_out: Name of output file :param data: the numpy.array with data (ncolumns, npoints) :param titles: a list with labels of the columns :param scan_title: a scan title :return: