Transmission
- class nexus.Transmission(experiment, sample, energy, angles, intensity_data=[], scaling='auto', background=0.0, offset=0.0, fit_weight=1.0, instrument=<nexus.clib.cnexus.DefaultInstrumentGaussian; proxy of <Swig Object of type 'Instrument *'> >, residual=<nexus.clib.cnexus.Log10; proxy of <Swig Object of type 'Residual *'> >, id='')
Bases:
FitMeasurementConstructor for the
Transmissionclass. Calculates the intensity of the experiment for one sample whose incidence angle is changed in grazing-incidence transmission geometry.- Parameters:
id (string) – User identifier.
experiment (
Experiment) – Experiment.sample (
GrazingSample) –Sample of the
Experimentwhose angle is changed.Changed in version 2.0.0: changed from old
Sampleclass toGrazingSample.energy (float) – X-ray energy in eV.
angles (list) – List of the angles.
intensity_data (list or ndarray) – Intensity data for fitting.
scaling (float or
Varor string) – Intensity scaling factor for fitting. Default isauto.background (float or
Varor string) – Background for fitting. Default is0.offset (float or
Var) –Angular offset of the model. Default is
0.Added in version 1.1.0.
resolution (float or
Var) –Resolution value for convolution.
Removed in version 2.0.0.
fit_weight (float) – Relative weight for the cost function in multi measurement fitting.
instrument (
Instrument) –Instrumentobject with the implementation of a resolution function.Default is a Gaussian instrument function with 0.001 degree FWHM.
Added in version 2.0.0.
residual (
Residual) – Implementation of the residual calculation used for fitting.
- id
User identifier.
- Type:
string
- experiment
Experiment.
- Type:
- sample
Sample of the
Experimentwhose angle is changed.Changed in version 2.0.0: changed from old
Sampleclass toGrazingSample.- Type:
- energy
X-ray energy in eV.
- Type:
float
- angles
List of the angles.
- Type:
list
- result
List of intensity values.
- Type:
list
- intensity_data
Intensity data for fitting.
- Type:
list or ndarray
- data_size
Number of data points of experimental data.
- Type:
int
- resolution_kernel
weight of the Gaussian resolution same step size as detuning.
Removed in version 2.0.0.
- Type:
list
- fit_weight
Relative weight for the cost function in multi measurement fitting.
- Type:
float
- instrument
Instrumentobject with the implementation of a resolution function.Added in version 2.0.0.
- Type:
- Calculate()
Calculates the class method. Also callable via operator
().- Returns:
Array of float values.
- 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(data=True, residuals=True, datacolor='black', theorycolor='r', theorywidth=2, datalinestyle='none', datamarker='+', datamarkersize=2, datafillstyle='full', legend=True, errors=False, errorcap=2, name=None)
Plot the
Transmission.Added in version 1.0.3.
Changed in version 1.2.0.
- Parameters:
data (bool) – Select if
intensity_datashould be plot.residuals (bool) – Select if
residualsfrom fit should be plot.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.
Added in version 1.1.0.
- Velocity()
Returns the velocity detuning of the measurement in units of mm/s.
- Returns:
Velocity detuning (mm/s).
- Return type:
ndarray