ForwardSample

class nexus.ForwardSample(layers, drive_detuning=[], function_time=None, id='')

Bases: BasicSample

Constructor for ForwardSample.

Added in version 2.0.0.

Parameters:
  • layers (list) – List of Layer in order of beam propagation.

  • drive_detuning (list or ndarray) – Detuning values for a sample on a Moessbauer drive.

  • function_time (FunctionTime) – 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.

  • id (string) – User identifier.

layers

List of Layer in order of beam propagation.

Type:

list

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:

FunctionTime

id

User identifier.

Type:

string

EffectiveThickness()

Returns the effective thickness \(t_{eff} = \sigma_0 \sum_i \rho_{i} f^{LM}_i t_i\) of the sample in forward geometry, where \(\sigma_0\) is the nuclear cross section for an unsplit resonance, \(\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.

The cross section for an unsplit resonance is

\[\sigma_0 = \frac{2\pi}{(1+\alpha) k_0^2}\frac{2I_e+1}{2I_g+1}.\]

Warning

At the moment only the effective thickness for unsplit resonances is supported. For samples with split lines the effective thickness might be different.

Returns:

Effective thickness.

Return type:

double

ElectronicAmplitude(energy)

Calculates the electronic amplitude behind the sample.

Parameters:

energy (float) – X-ray energy (eV)

Returns:

Electronic amplitude.

Return type:

complex

ElectronicAmplitudeMatrix(energy)

Calculates the relative electronic amplitude matrix behind the sample.

Parameters:

energy (float) – X-ray energy (eV)

Returns:

Electronic amplitude.

Return type:

complex

ElectronicAmplitudeThickness(energy, thickness)

Calculates the electronic X-ray field amplitude in the sample at a given thickness value.

Parameters:
  • energy (float) – X-ray energy (eV).

  • thickness (float) – Thickness value (nm).

Returns:

Electronic field amplitude in the sample at the thickness value.

Return type:

complex

ElectronicFieldAmplitude(energy, num_points)

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.

Returns:

Electronic field amplitude in the sample.

Return type:

complex

ElectronicFieldIntensity(energy, num_points)

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

ElectronicIntensity(energy)

Calculates the electronic X-ray field intensity (transmission factor) behind the sample.

Parameters:

energy (float) – X-ray energy (eV)

Returns:

Electronic intensity (transmission factor).

Return type:

float

ElectronicIntensityThickness(energy, thickness)

Calculates the electronic X-ray field intensity (transmission factor) in the sample at a given thickness value.

Parameters:
  • energy (float) – X-ray energy (eV).

  • thickness (float) – Thickness value (nm).

Returns:

Electronic field intensity in the sample at the thickness value.

Return type:

float

FindUniqueLayers(BasicSample self) → Layers
GetAddress(NxObject self) → std::string
Ids()

List with all layer id of the sample.

Returns:

Layers ids.

Return type:

list

IncreaseDistributionIndex(ForwardSample self, size_t const distribution_points)
Interfaces()

A list with the positions of the layer interfaces.

Returns:

Position of the Layer interfaces.

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

ObjectMatrix(isotope, detuning, calc_transitions)

Calculates the sample matrix - the product of all layer matrices.

Parameters:
  • isotope (MoessbauerIsotope) – Moessbauer isotope.

  • detuning (list or ndarray) – Detuning values of the calculation.

  • 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

PopulateFitHandler(ForwardSample self, OptimizerHandler fit_handler)
PopulateThicknessDistribution(ForwardSample self, size_t const distribution_points) → size_t
ResetDistributionIndex(ForwardSample self)
TotalThickness()

Calculates the total thickness of the sample.

Returns:

Total thickness of the sample (nm).

Return type:

float

Update(ForwardSample self)
property drive_detuning

std::vector<(double,std::allocator<(double)>)>

Type:

drive_detuning

property function_time

p.FunctionTime

Type:

function_time

property id

std::string

Type:

id

property layers

std::vector<(p.Layer,std::allocator<(p.Layer)>)>

Type:

layers

property object_id

NxObjectId

Type:

object_id

property object_matrix

LayerMatrix2

Type:

object_matrix

nexus.Air(length, id='')

Creates a ForwardSample type of air.

Changed in version 2.0.0.

Parameters:
  • length (float) – length of the air distance in meter.

  • id (string) – optional string identifier.

Returns:

Sample object with material air.

Return type:

ForwardSample

class nexus.SimpleSample(thickness, composition, density, isotope=None, abundance=0.0, lamb_moessbauer=0.0, hyperfine_sites=[], id='')

Bases: ForwardSample

Creates a ForwardSample with only one layer and material. All needed instances are created automatically. The layer and material parameters can be assigned directly via the SimpleSample attributes.

Changed in version 2.0.0.

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.

thickness

Thickness of the layer (nm).

Type:

float or Var

composition

Composition of the material in the format [[“element symbol” (string), relative atomic fraction (float)] , … ].

Type:

list

density

Density (g/cm 3).

Type:

float or Var

isotope

Moessbauer isotope.

Type:

MoessbauerIsotope

abundance

Isotope abundance (0 to 1).

Type:

float or Var

lamb_moessbauer

Lamb Moessbauer factor (0 to 1).

Type:

float or Var

hyperfine_sites

List of Hyperfine sites assigned to the material.

Type:

list

id

user identifier.

Type:

string

layer

Layer instance of the SimpleSample.

Type:

Layer

material

Material instance of the SimpleSample.

Type:

Material

Returns:

Sample object.

Return type:

ForwardSample

EffectiveThickness()

Returns the effective thickness \(t_{eff} = \sigma_0 \sum_i \rho_{i} f^{LM}_i t_i\) of the sample in forward geometry, where \(\sigma_0\) is the nuclear cross section for an unsplit resonance, \(\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.

The cross section for an unsplit resonance is

\[\sigma_0 = \frac{2\pi}{(1+\alpha) k_0^2}\frac{2I_e+1}{2I_g+1}.\]

Warning

At the moment only the effective thickness for unsplit resonances is supported. For samples with split lines the effective thickness might be different.

Returns:

Effective thickness.

Return type:

double

ElectronicAmplitude(energy)

Calculates the electronic amplitude behind the sample.

Parameters:

energy (float) – X-ray energy (eV)

Returns:

Electronic amplitude.

Return type:

complex

ElectronicAmplitudeMatrix(energy)

Calculates the relative electronic amplitude matrix behind the sample.

Parameters:

energy (float) – X-ray energy (eV)

Returns:

Electronic amplitude.

Return type:

complex

ElectronicAmplitudeThickness(energy, thickness)

Calculates the electronic X-ray field amplitude in the sample at a given thickness value.

Parameters:
  • energy (float) – X-ray energy (eV).

  • thickness (float) – Thickness value (nm).

Returns:

Electronic field amplitude in the sample at the thickness value.

Return type:

complex

ElectronicFieldAmplitude(energy, num_points)

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.

Returns:

Electronic field amplitude in the sample.

Return type:

complex

ElectronicFieldIntensity(energy, num_points)

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

ElectronicIntensity(energy)

Calculates the electronic X-ray field intensity (transmission factor) behind the sample.

Parameters:

energy (float) – X-ray energy (eV)

Returns:

Electronic intensity (transmission factor).

Return type:

float

ElectronicIntensityThickness(energy, thickness)

Calculates the electronic X-ray field intensity (transmission factor) in the sample at a given thickness value.

Parameters:
  • energy (float) – X-ray energy (eV).

  • thickness (float) – Thickness value (nm).

Returns:

Electronic field intensity in the sample at the thickness value.

Return type:

float

FindUniqueLayers(BasicSample self) → Layers
GetAddress(NxObject self) → std::string
Ids()

List with all layer id of the sample.

Returns:

Layers ids.

Return type:

list

IncreaseDistributionIndex(ForwardSample self, size_t const distribution_points)
Interfaces()

A list with the positions of the layer interfaces.

Returns:

Position of the Layer interfaces.

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

ObjectMatrix(isotope, detuning, calc_transitions)

Calculates the sample matrix - the product of all layer matrices.

Parameters:
  • isotope (MoessbauerIsotope) – Moessbauer isotope.

  • detuning (list or ndarray) – Detuning values of the calculation.

  • 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

PopulateFitHandler(ForwardSample self, OptimizerHandler fit_handler)
PopulateThicknessDistribution(ForwardSample self, size_t const distribution_points) → size_t
ResetDistributionIndex(ForwardSample self)
TotalThickness()

Calculates the total thickness of the sample.

Returns:

Total thickness of the sample (nm).

Return type:

float

Update(ForwardSample self)
property drive_detuning

std::vector<(double,std::allocator<(double)>)>

Type:

drive_detuning

property function_time

p.FunctionTime

Type:

function_time

property id

std::string

Type:

id

property layers

std::vector<(p.Layer,std::allocator<(p.Layer)>)>

Type:

layers

property object_id

NxObjectId

Type:

object_id

property object_matrix

LayerMatrix2

Type:

object_matrix