EnergySpectrum

class nexus.EnergySpectrum(experiment, detuning, electronic=True, intensity_data=[], scaling='auto', background='auto', resolution=0.0, distribution_points=1, fit_weight=1.0, kernel_type='Gauss', residual=<nexus.clib.cnexus.Sqrt; proxy of <Swig Object of type 'Residual *'> >, time_gate=[], coherence=False, id='')

Bases: FitMeasurement

Constructor for the EnergySpectrum class. Class to calculate the energy-dependent intensity of the experiment.

Parameters:
  • id (string) – User identifier.

  • experiment (Experiment) – Experiment for the calculation.

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

  • electronic (bool) – If True electronic scattering is included.

  • intensity_data (list or ndarray) – Intensity data for fitting. Default is an empty list.

  • scaling (float or Var or string) – Intensity scaling factor for fitting. Default is auto.

  • background (float or Var or string) – Background for fitting. Default is 0.

  • resolution (float or Var) – Resolution value for convolution (Gamma). Default is 0.

  • distribution_points (int) – Number of points for thickness distributions in forward geometry and angular divergence in grazing geometry. Both distributions assume incoherent summation over the weighted contributions. Default is 1.

  • fit_weight (float) – Relative weight for the cost function in multi measurement fitting. Default is 1.

  • kernel_type (string) – Type of the resolution kernel. Is used for the convolution of the calculated energy spectrum with the resolution kernel. Can be Gauss or Lorentz. Default is Gauss.

  • residual (Residual) – Implementation of the residual calculation used for fitting.

  • time_gate (list) –

    An empty or two element list. If a two element list is passed these two values [start, stop] are taken as a time gating. The spectrum is Fourier transformed, the time gate is applied, and time response is transformed back to a spectrum. This does not give a time gated Moessbauer spectrum. Given in ns.

    New in version 1.0.1.

  • coherence (bool) –

    Determines if the summation over the thickness and divergence distributions is performed coherently (True) or incoherently (False). Default is False.

    New in version 1.0.3.

id

User identifier.

Type:

string

experiment

Experiment for the calculation.

Type:

Experiment

detuning

Detuning values for the calculation (Gamma).

Type:

list or ndarray

electronic

If True electronic scattering is included.

Type:

bool

result

List of detuning dependent intensity values.

Type:

list

intensity_data

Intensity data for fitting.

Type:

list

data_size

Number of data points of experimental intensity data.

Type:

int

scaling

Intensity scaling factor for fitting.

Type:

Var

background

Background for fitting.

Type:

Var

resolution

Resolution value for convolution.

Type:

Var

resolution_kernel

The used kernel, same step size as detuning.

Type:

list

distribution_points

Number of points for thickness distributions in forward geometry and angular divergence in grazing geometry. Both distributions assume incoherent summation over the weighted contributions.

Type:

int

fit_weight

Relative weight for the cost function in multi measurement fitting.

Type:

float

kernel_type

Type of the resolution kernel. Is used for the convolution of the calculated energy spectrum with the resolution kernel. Can be Gauss or Lorentz.

Type:

string

residual

Implementation of the residual calculation used for fitting.

Type:

Residual

time_gate

An empty or two element list. If a two element list is passed these two values [start, stop] are taken as a time gating. The spectrum is Fourier transformed, the time gate is applied, and time response is transformed back to a spectrum. This does not give a time gated Moessbauer spectrum. Given in ns.

New in version 1.0.1.

Type:

list

coherence

Determines if the summation over the thickness and divergence distributions is performed coherently (True) or incoherently (False). Default is False.

New in version 1.0.3.

Type:

bool

Calculate()

Calculates the class method. Also callable via operator ().

Returns:

Array of float values.

Return type:

ndarray

Plot(data=True, residuals=True, velocity=False, datacolor='black', theorycolor='r', theorywidth=2, datalinestyle='none', datamarker='+', datamarkersize=2, datafillstyle='full', legend=True, errors=False, errorcap=2, name=None)

Plot the EnergySpectrum.

New in version 1.0.3.

Parameters:
  • data (bool) – Select if intensity_data should be plot.

  • residuals (bool) – Select if residuals from fit should be plot.

  • velocity (bool) – Plot velocity instead of detuning.

  • datacolor (string) – See matplotlib documentation.

  • theorycolor (string) – See matplotlib documentation.

  • theorywidth (float) – See matplotlib documentation.

  • datalinestyle (string) – See matplotlib documentation.

  • datamarker (string) – See matplotlib documentation.

  • datamarkersize (float) – See matplotlib documentation.

  • datafillstyle (string) – See matplotlib documentation.

  • legend (bool) – Select if legend should be plot when model and data are plot.

  • errors (bool) – Select if error bars should be plot.

  • errorcap (float) – See matplotlib documentation (capsize).

  • name (string) –

    If given, the plot is saved under this name.

    New in version 1.1.0.