Sample
- class nexus.Sample(layers, geometry='f', angle=0.0, length=10, roughness='a', effective_thickness=0.3, drive_detuning=[], function_time=None, divergence=0.0, id='')
Bases:
NxObject
Constructor for
Sample
.- Parameters:
layers (list) – List of Layer in order of beam propagation.
geomerty (string) –
Scattering geometry of the sample.
f - forward scattering
r - reflection in grazing incidence scattering
t - transmission in grazing incidence scattering
angle (float or
Var
) – Angle of incidence for grazing geometry (degree).length (float) – length of the sample along beam direction. Only used for grazing geometry.
roughness (string) –
Roughness model in grazing geometry.
n - no roughness
a - analytical model
e - effective density model
effective_thickness (float) – Layer thickness in the effective density model (nm).
drive_detuning (list or ndarray) – Detuning values for a sample on a Moessbauer drive.
function_time (
FunctionTime
) – AFunctionTime
implementation of the user to describe sample motion. Must return the phase factor \(\phi(t) = k x(t)\), where \(k\) is the photon wave vector along beam direction and \(x(t)\) the sample motion along the beam propagation direction.divergence (float or
Var
) – Divergence of the incidence angle given as the FWHM of the divergence (deg).id (string) – User identifier.
- layers
List of Layer in order of beam propagation.
- Type:
list
- geometry
Scattering geometry of the sample.
f - forward scattering
r - reflection in grazing incidence scattering
t - transmission in grazing incidence scattering
- Type:
string
- length
length of the sample along beam direction. Only used for grazing geometry.
- Type:
float
- roughness
Roughness model in grazing geometry.
n - no roughness
a - analytical model
e - effective density model
- Type:
string
- effective_thickness
Layer thickness in the effective density model (nm).
- Type:
float
- drive_detuning
Detuning values for a sample on a Moessbauer drive.
- Type:
list or ndarray
- function_time
A
FunctionTime
implementation of the user to describe sample motion. Must return the phase factor \(\phi(t) = k x(t)\), where \(k\) is the photon wave vector along beam direction and \(x(t)\) the sample motion along the beam propagation direction.- Type:
- divergence
Divergence of the incidence angle given as the FWHM of the divergence (deg).
- Type:
float or
Var
- id
User identifier.
- Type:
string
- effective_coordinates
Layer coordinates in the effective density model.
- Type:
list
- effective_layers
List of
EffectiveLayer
objects.- Type:
list
- EffectiveLayerSystem(eff_layer_thickness, nuclear)
Create an effective density model from the sample. Electronic scattering factors and matrices are always calculated.
- Parameters:
eff_layer_thickness (float) – Layer thickness in the effective density model.
nuclear (bool) – Calculate the matrices for nuclear scattering in addition to the electronic ones.
- ElectronicAmplitude(energy)
Calculates the relative electronic amplitude behind the sample. It is given by the product of the complex transmission or layer matrices of the sample layers. The geometry is determined from the
geometry
.- Parameters:
energy (float) – X-ray energy (eV)
- Returns:
Electronic amplitude.
- Return type:
complex
- ElectronicAmplitudeMatrix(energy)
Calculates the relative electronic amplitude matrix behind the sample. It is given by the product of the complex transmission or layer matrices of the sample layers. The geometry is determined from the
geometry
.- Parameters:
energy (float) – X-ray energy (eV)
- Returns:
Electronic amplitude.
- Return type:
complex
- ElectronicFieldAmplitude(energy, num_points=101, angle=0.0)
Calculates the electronic X-ray field amplitude in the sample.
- Parameters:
energy (float) – X-ray energy (eV).
num_points (int) – Number of points of the output.
angle (float) – Incidence angle in grazing incidence geometry.
- Returns:
Electronic field amplitude in the sample.
- Return type:
complex
- ElectronicFieldIntensity(energy, num_points=101, angle=0.0)
Calculates the electronic X-ray field intensity in the sample.
- Parameters:
energy (float) – X-ray energy (eV).
num_points (int) – Number of points of the output.
- Returns:
Electronic field intensity.
- Return type:
float
- ElectronicForwardAmplitude(energy)
Calculates the electronic amplitude behind the sample in forward geometry .
- Parameters:
energy (float) – X-ray energy (eV).
- Returns:
Forward amplitude.
- Return type:
complex
- ElectronicForwardTransmission(energy)
Calculates the electronic transmission behind the sample in forward geometry .
- Parameters:
energy (float) – X-ray energy (eV).
- Returns:
Forward transmission.
- Return type:
float
- ElectronicGrazingReflectivity(energy, angle, calc_roughness, eff_layer_thickness)
Calculates the reflectivity intensity of the sample in grazing incidence geometry.
- Parameters:
energy (float) – X-ray energy (eV).
angle (float) – Incidence-angle of the sample (degree).
calc_roughness (string) – Assumed roughness model, either n, a, e.
eff_layer_thickness (float) – Thickness of the layers in the effective layer model (e).
- Returns:
Reflectivity.
- Return type:
float
- ElectronicGrazingReflectivityAmplitude(energy, angle, calc_roughness, eff_layer_thickness)
Calculates the complex reflectivity amplitude of the sample in grazing incidence geometry.
- Parameters:
energy (float) – X-ray energy (eV).
angle (float) – Incidence-angle of the sample (degree).
calc_roughness (string) – Assumed roughness model, either n, a, e.
eff_layer_thickness (float) – thickness of the layers in the effective layer model (e).
- Returns:
Complex reflectivity amplitude.
- Return type:
complex
- ElectronicGrazingSampleMatrix(*args)
Overload 1:
Calculates the electronic 2x2 sample matrix in grazing incidence geometry. It is the product of all layer matrices.
- Parameters:
energy (float) – X-ray energy (eV).
angle (float) – Incidence-angle of the sample (degree).
calc_roughness (string) – Assumed roughness model, either n, a, e.
eff_layer_thickness (float) – thickness of the layers in the effective layer model (e).
- Returns:
Complex 2x2 matrix.
- Return type:
ndarray
Overload 2:
Calculates the electronic 2x2 sample matrix up to a certain sample thickness in grazing incidence geometry. It is the product of all layer matrices up to this thickness.
- Parameters:
energy (float) – X-ray energy (eV).
angle (float) – Incidence-angle of the sample (degree).
thickness (float) – Thickness at which the sample matrix should be calculated (nm).
calc_roughness (string) – Assumed roughness model, either n, a, e.
eff_layer_thickness (float) – thickness of the layers in the effective layer model (e).
- Returns:
Complex 2x2 matrix.
- Return type:
ndarray
- ElectronicGrazingTransmission(energy, angle, calc_roughness, eff_layer_thickness)
Calculates the transmission intensity of the sample in grazing incidence geometry.
- Parameters:
energy (float) – X-ray energy (eV).
angle (float) – Incidence-angle of the sample (degree).
calc_roughness (string) – Assumed roughness model, either n, a, e.
eff_layer_thickness (float) – Thickness of the layers in the effective layer model (e).
- Returns:
Transmission.
- Return type:
float
- ElectronicGrazingTransmissionAmplitude(energy, angle, calc_roughness, eff_layer_thickness)
Calculates the complex transmission amplitude of the sample in grazing incidence geometry.
- Parameters:
energy (float) – X-ray energy (eV).
angle (float) – Incidence-angle of the sample (degree).
calc_roughness (string) – Assumed roughness model, either n, a, e.
eff_layer_thickness (float) – thickness of the layers in the effective layer model (e).
- Returns:
Complex reflectivity amplitude.
- Return type:
complex
- ElectronicTransmission(energy)
Calculates the relative electronic transmission behind the sample. It is given by the product of the complex transmission or layer matrices of the sample layers. The geometry is determined from the
geometry
.- Parameters:
energy (float) – X-ray energy (eV)
- Returns:
Electronic transmission.
- Return type:
float
- ForwardEffectiveThickness()
Returns the effective thickness \(t_{eff} = \sigma \sum_i \rho_{i} f^{LM}_i t_i\) of the sample in forward geometry, where \(\sigma\) is the nuclear cross section, \(\rho_{i}\) is the number density of the resonant nuclei in the i-th layer, \(f^{LM}_i\) is the Lamb Moessbauer factor of the i-th layer, \(t_i\) is the thickness of the layer i-th layer.
- Returns:
Effective thickness.
- Return type:
double
- Ids()
List with all layer id of the sample.
- Returns:
Layers ids.
- Return type:
list
- Interfaces()
A list with the positions of the layer interfaces.
- Returns:
Position of the Layer interfaces.
- Return type:
list
- KzSigma(energy, angle_kz)
Calculates the product \(k_z \sigma\) for each layer in the sample. The product should be << 1 for the validity of the W matrix calculation.
- Parameters:
energy (float) – X-ray energy (eV).
angle (float) – Incidence angle (deg).
- Returns:
List of \(k_z \sigma\) values for each layer.
- Return type:
list
- LayerCenters()
A list with the center coordinates of all layers in the sample.
- Returns:
Position of the Layer centers.
- Return type:
list
- LayerPointers()
Returns a list of all layer pointers. Useful in order to check if layers have the same reference.
- Returns:
List of layer pointers
- Return type:
list
- ObjectMatrix(isotope, detuning, calc_transitions)
Calculates the detuning-dependent complex 2x2 object matrix.
- Parameters:
isotope (
MoessbauerIsotope
) – Moessbauer isotope of the experiment.detuning (list or ndarray) – n-dimensional array with detuning values.
calc_transitions (bool) – Set to
True
for calculations of the nuclear transitions in the object.
- Returns:
List of complex 2x2 matrices.
- Return type:
list
- PrintLayerPointers()
Print the pointer of each Layer. Useful in order to check if layers have the same reference.
- Returns:
Prints the layer pointers to the output
- SampleMatrix(*args)
Calculates the sample matrix - the product of all layer matrices in the given sample geometry. Same as the ObjectMatrix.
- Parameters:
isotope (
MoessbauerIsotope
) – Moessbauer isotope.detuning (list or ndarray) – Detuning values of the calculation.
angle (float) – Angle in grazing geometry (degree).
calc_roughness (string) –
Calculation mode for roughness.
n - no roughness a - analytical model e - effective density model
eff_layer_thickness (float) – Layer thickness for the effective density model (nm).
calc_transitions (bool) – Specifies if the nuclear transitions should be updated or not. Set this value to True.
- Returns:
List of complex 2x2 matrices.
- Return type:
list
- TotalThickness()
Calculates the total thickness of the sample.
- Returns:
Total thickness of the sample (nm).
- Return type:
float
- TotalThicknessEffective()
Total thickness of the sample in the effective density model.
- Returns:
Total thickness in the effective density model.
- Return type:
float
- nexus.Air(length, id='')
Creates a
Sample
type of air.- Parameters:
length (float) – length of the air distance in meter.
id (string) – optional string identifier.
- Returns:
Sample object with material air.
- Return type:
- class nexus.SimpleSample(thickness, composition, density, isotope=None, abundance=0.0, lamb_moessbauer=0.0, hyperfine_sites=[], id='')
Bases:
Sample
Creates a
Sample
with only one layer and material. All needed instances are created automatically. The layer and material parameters can be assigned directly via theSimpleSample
attributes.Added in version 1.0.4.
- Parameters:
thickness (float or
Var
) – Thickness of the layer (nm).composition (list) – Composition of the material in the format [[“element symbol” (string), relative atomic fraction (float)] , … ].
density (float or
Var
) – Density (g/cm ^{3}).isotope (
MoessbauerIsotope
) – Moessbauer isotope.abundance (float or
Var
) – Isotope abundance (0 to 1).lamb_moessbauer (float or
Var
) – Lamb Moessbauer factor (0 to 1).hyperfine_sites (list) – List of
Hyperfine
sites assigned to the material.id (string) – user identifier.
- composition
Composition of the material in the format [[“element symbol” (string), relative atomic fraction (float)] , … ].
- Type:
list
- isotope
Moessbauer isotope.
- Type:
- id
user identifier.
- Type:
string
- layer
Layer instance of the
SimpleSample
.- Type:
- material
Material instance of the
SimpleSample
.- Type:
- Returns:
Sample object.
- Return type:
- ClearLayers()
Clear the
layers
list.
- EffectiveLayerSystem(eff_layer_thickness, nuclear)
Create an effective density model from the sample. Electronic scattering factors and matrices are always calculated.
- Parameters:
eff_layer_thickness (float) – Layer thickness in the effective density model.
nuclear (bool) – Calculate the matrices for nuclear scattering in addition to the electronic ones.
- ElectronicAmplitude(energy)
Calculates the relative electronic amplitude behind the sample. It is given by the product of the complex transmission or layer matrices of the sample layers. The geometry is determined from the
geometry
.- Parameters:
energy (float) – X-ray energy (eV)
- Returns:
Electronic amplitude.
- Return type:
complex
- ElectronicAmplitudeMatrix(energy)
Calculates the relative electronic amplitude matrix behind the sample. It is given by the product of the complex transmission or layer matrices of the sample layers. The geometry is determined from the
geometry
.- Parameters:
energy (float) – X-ray energy (eV)
- Returns:
Electronic amplitude.
- Return type:
complex
- ElectronicFieldAmplitude(energy, num_points=101, angle=0.0)
Calculates the electronic X-ray field amplitude in the sample.
- Parameters:
energy (float) – X-ray energy (eV).
num_points (int) – Number of points of the output.
angle (float) – Incidence angle in grazing incidence geometry.
- Returns:
Electronic field amplitude in the sample.
- Return type:
complex
- ElectronicFieldIntensity(energy, num_points=101, angle=0.0)
Calculates the electronic X-ray field intensity in the sample.
- Parameters:
energy (float) – X-ray energy (eV).
num_points (int) – Number of points of the output.
- Returns:
Electronic field intensity.
- Return type:
float
- ElectronicForwardAmplitude(energy)
Calculates the electronic amplitude behind the sample in forward geometry .
- Parameters:
energy (float) – X-ray energy (eV).
- Returns:
Forward amplitude.
- Return type:
complex
- ElectronicForwardTransmission(energy)
Calculates the electronic transmission behind the sample in forward geometry .
- Parameters:
energy (float) – X-ray energy (eV).
- Returns:
Forward transmission.
- Return type:
float
- ElectronicGrazingReflectivity(energy, angle, calc_roughness, eff_layer_thickness)
Calculates the reflectivity intensity of the sample in grazing incidence geometry.
- Parameters:
energy (float) – X-ray energy (eV).
angle (float) – Incidence-angle of the sample (degree).
calc_roughness (string) – Assumed roughness model, either n, a, e.
eff_layer_thickness (float) – Thickness of the layers in the effective layer model (e).
- Returns:
Reflectivity.
- Return type:
float
- ElectronicGrazingReflectivityAmplitude(energy, angle, calc_roughness, eff_layer_thickness)
Calculates the complex reflectivity amplitude of the sample in grazing incidence geometry.
- Parameters:
energy (float) – X-ray energy (eV).
angle (float) – Incidence-angle of the sample (degree).
calc_roughness (string) – Assumed roughness model, either n, a, e.
eff_layer_thickness (float) – thickness of the layers in the effective layer model (e).
- Returns:
Complex reflectivity amplitude.
- Return type:
complex
- ElectronicGrazingSampleMatrix(*args)
Overload 1:
Calculates the electronic 2x2 sample matrix in grazing incidence geometry. It is the product of all layer matrices.
- Parameters:
energy (float) – X-ray energy (eV).
angle (float) – Incidence-angle of the sample (degree).
calc_roughness (string) – Assumed roughness model, either n, a, e.
eff_layer_thickness (float) – thickness of the layers in the effective layer model (e).
- Returns:
Complex 2x2 matrix.
- Return type:
ndarray
Overload 2:
Calculates the electronic 2x2 sample matrix up to a certain sample thickness in grazing incidence geometry. It is the product of all layer matrices up to this thickness.
- Parameters:
energy (float) – X-ray energy (eV).
angle (float) – Incidence-angle of the sample (degree).
thickness (float) – Thickness at which the sample matrix should be calculated (nm).
calc_roughness (string) – Assumed roughness model, either n, a, e.
eff_layer_thickness (float) – thickness of the layers in the effective layer model (e).
- Returns:
Complex 2x2 matrix.
- Return type:
ndarray
- ElectronicGrazingTransmission(energy, angle, calc_roughness, eff_layer_thickness)
Calculates the transmission intensity of the sample in grazing incidence geometry.
- Parameters:
energy (float) – X-ray energy (eV).
angle (float) – Incidence-angle of the sample (degree).
calc_roughness (string) – Assumed roughness model, either n, a, e.
eff_layer_thickness (float) – Thickness of the layers in the effective layer model (e).
- Returns:
Transmission.
- Return type:
float
- ElectronicGrazingTransmissionAmplitude(energy, angle, calc_roughness, eff_layer_thickness)
Calculates the complex transmission amplitude of the sample in grazing incidence geometry.
- Parameters:
energy (float) – X-ray energy (eV).
angle (float) – Incidence-angle of the sample (degree).
calc_roughness (string) – Assumed roughness model, either n, a, e.
eff_layer_thickness (float) – thickness of the layers in the effective layer model (e).
- Returns:
Complex reflectivity amplitude.
- Return type:
complex
- ElectronicTransmission(energy)
Calculates the relative electronic transmission behind the sample. It is given by the product of the complex transmission or layer matrices of the sample layers. The geometry is determined from the
geometry
.- Parameters:
energy (float) – X-ray energy (eV)
- Returns:
Electronic transmission.
- Return type:
float
- ForwardEffectiveThickness()
Returns the effective thickness \(t_{eff} = \sigma \sum_i \rho_{i} f^{LM}_i t_i\) of the sample in forward geometry, where \(\sigma\) is the nuclear cross section, \(\rho_{i}\) is the number density of the resonant nuclei in the i-th layer, \(f^{LM}_i\) is the Lamb Moessbauer factor of the i-th layer, \(t_i\) is the thickness of the layer i-th layer.
- Returns:
Effective thickness.
- Return type:
double
- Ids()
List with all layer id of the sample.
- Returns:
Layers ids.
- Return type:
list
- Interfaces()
A list with the positions of the layer interfaces.
- Returns:
Position of the Layer interfaces.
- Return type:
list
- KzSigma(energy, angle_kz)
Calculates the product \(k_z \sigma\) for each layer in the sample. The product should be << 1 for the validity of the W matrix calculation.
- Parameters:
energy (float) – X-ray energy (eV).
angle (float) – Incidence angle (deg).
- Returns:
List of \(k_z \sigma\) values for each layer.
- Return type:
list
- LayerCenters()
A list with the center coordinates of all layers in the sample.
- Returns:
Position of the Layer centers.
- Return type:
list
- LayerPointers()
Returns a list of all layer pointers. Useful in order to check if layers have the same reference.
- Returns:
List of layer pointers
- Return type:
list
- ObjectMatrix(isotope, detuning, calc_transitions)
Calculates the detuning-dependent complex 2x2 object matrix.
- Parameters:
isotope (
MoessbauerIsotope
) – Moessbauer isotope of the experiment.detuning (list or ndarray) – n-dimensional array with detuning values.
calc_transitions (bool) – Set to
True
for calculations of the nuclear transitions in the object.
- Returns:
List of complex 2x2 matrices.
- Return type:
list
- PrintLayerPointers()
Print the pointer of each Layer. Useful in order to check if layers have the same reference.
- Returns:
Prints the layer pointers to the output
- SampleMatrix(*args)
Calculates the sample matrix - the product of all layer matrices in the given sample geometry. Same as the ObjectMatrix.
- Parameters:
isotope (
MoessbauerIsotope
) – Moessbauer isotope.detuning (list or ndarray) – Detuning values of the calculation.
angle (float) – Angle in grazing geometry (degree).
calc_roughness (string) –
Calculation mode for roughness.
n - no roughness a - analytical model e - effective density model
eff_layer_thickness (float) – Layer thickness for the effective density model (nm).
calc_transitions (bool) – Specifies if the nuclear transitions should be updated or not. Set this value to True.
- Returns:
List of complex 2x2 matrices.
- Return type:
list
- TotalThickness()
Calculates the total thickness of the sample.
- Returns:
Total thickness of the sample (nm).
- Return type:
float
- TotalThicknessEffective()
Total thickness of the sample in the effective density model.
- Returns:
Total thickness in the effective density model.
- Return type:
float