EnergyTimeSpectrum
- class nexus.EnergyTimeSpectrum(experiment, time_length=200, time_step=0.2, mode='i', electronic=False, time_data=[], intensity_data=[[]], scaling='auto', background=0.0, energy_resolution=0.0, time_resolution=0.7, distribution_points=1, fit_weight=1.0, bunch_spacing=inf, residual=<nexus.clib.cnexus.Sqrt; proxy of <Swig Object of type 'Residual *'> >, id='')
Bases:
FitMeasurement
Constructor for the
EnergyTimeSpectrum
class. Class to calculate the energy and time-dependent intensity of the experiment. One sample has to have a drive detuning.- Parameters:
id (string) – User identifier.
experiment (
Experiment
) – Experiment.time_length (float) – Length of the calculation in nanoseconds.
time_step (float) – Step size of the calculation in nanoseconds.
mode (string) –
Identifier for the calculation mode.
i
Interpolate detuning values. Fast mode.f
Full calculation via change of the isomer shift. Slow mode.
electronic (bool) – If
True
electronic scattering is also included.time_data (list or ndarray) – Time data for fitting.
intensity_data (ndarray) – 2D intensity data for fitting. 1st dimension detuning, 2nd dimension time.
scaling (float or
Var
or string) – Intensity scaling factor for fitting. Default isauto
.background (float or
Var
or string) – Background for fitting. Default is0
.energy_resolution (float or
Var
) – Energy resolution value for convolution.time_resolution (float or
Var
) – Time resolution value for convolution.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.
bunch_spacing (float) – Spacing of subsequent X-ray bunches in time (nanoseconds).
residual (
Residual
) – Implementation of the residual calculation used for fitting.
- id
User identifier.
- Type:
string
- experiment
Experiment
- Type:
- time_length
Length of the calculation in nanoseconds.
- Type:
float
- time_step
Step size of the calculation in nanoseconds.
- Type:
float
- electronic
If True electronic scattering is also included.
- Type:
bool
- mode
Identifier for the calculation mode.
i
: interpolate detuning values, fast mode.f
: full calculation via change of the isomer shift.
- Type:
string
- time_data
Time data for fitting.
- Type:
list
- intensity_data
2D intensity data for fitting. 1st dimension detuning, 2nd dimension time.
- Type:
array
- data_size
Number of data points of experimental data.
- Type:
int
- energy_resolution
Energy resolution value used for the convolution. The energy resolution is not the energy resolution of the drive sample (e.g. an analyzer foil). This intrinsic resolution is given by the energy spectrum of drive sample. The energy resolution specified here is an additional energy resolution due to the experimental conditions, like an in proper drive motion itself.
- Type:
- resolution_kernel
Weight of 2D Gaussian resolution. Same step size as detuning.
- Type:
array
- 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
- bunch_spacing
Spacing of subsequent X-ray bunches in time (nanoseconds).
- Type:
float
- result
Array of intensity values in units of (\(\Gamma/ns\)).
- Type:
ndarray
- drive_sample
Sample with drive detuning.
Added in version 1.0.3.
Changed in version 2.0.0: changed from old
Sample
class toBasicSample
.- Type:
- Calculate()
Calculates the class method. Also callable via operator
()
.- Returns:
2D array of intensities.
- Return type:
ndarray
- Cost()
Get the cost function of the measurement
\[cost = \frac{1}{n} \sum_i r(y_i, \hat{y}_i)\]Added in version 2.0.0.
- Returns:
cost function value.
- Return type:
float
- MeanSquaredError()
Get the mean squared error (MSE) of the measurement
\[cost = \frac{1}{n} \sum_i (y_i - \hat{y}_i)^2\]Added in version 2.0.0.
- Returns:
MSE value.
- Return type:
float
- Plot()
Plot the
EnergyTimeSpectrum
.Added in version 1.0.3.
- Velocity()
Returns the velocity detuning of the measurement in units of mm/s.
- Returns:
Velocity detuning (mm/s).
- Return type:
ndarray