shadow4.physical_models.mlayer package
Submodules
shadow4.physical_models.mlayer.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 shadow4.physical_models.mlayer.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