\(\renewcommand\AA{\unicode{x212B}}\)
Name | Default | Description |
---|---|---|
Height | 0.1 | Intensity at the origin |
Tau | 100.0 | Relaxation time |
Beta | 1.0 | Stretching exponent |
Centre | 0.0 | Centre of the peak |
Provides the Fourier Transform of the Symmetrized Stretched Exponential Function integrated over each energy bin.
with \(StretchedExpFT\) is fit function StretchedExpFT. Quantity \(\delta E\) is evaluated at run time. If we request to evaluate this function over a set of energy values \(E_0,..,E_N\), then \(2\delta E = \frac{E_N-E_0}{N}\)
In the picture below we evaluated function StretcheExpFT at the center of bins of width \(0.4 \mu eV\) (label <i>center_evaluated</i>). However, one should compare the integral of the model within each bin against experimental QENS data, because the data is a histogram. Nevertheless, we usually compare the value that the model takes at the center of each bin instead of the integral. This approximation is acceptable when the model does not change much within each bin. This is specially true at high energies when StretcheExpFT is very smooth. Sometimes this center-of-the-bin evaluation is wrong, like in the central bin [-0.2, 0.2]ueV. The integral of \(StretchedExpFT\) in this bin is the red dot, and the value of \(StretchedExpFT\) at the center of the bin is the black dot at the top. Very different! This situation is likely to arise for samples with a relaxation rate \(h/Tau \ll \delta E\). Finally, the blue line is the evaluation of \(PrimStretchedExpFT\) at each bin center, which by design amounts to the integral of \(StretchedExpFT\) within each bin. This curve coincides with the red dot for the central bin, as expected. Also, it agrees with the center-of-bin evaluation of \(StretchedExpFT\) at high energies, when the center-of-the-bin approximation is acceptable.
Note
To run these usage examples please first download the usage data, and add these to your path. In Mantid this is done using Manage User Directories.
Example - Fit to a QENS signal:
The QENS signal is modeled by the convolution of a resolution function with elastic and PrimStretchedExpFT components. Noise is modeled by a linear background:
\(S(Q,E) = R(Q,E) \otimes (\alpha \delta(E) + PrimStretchedExpFT(Q,E)) + (a+bE)\)
Obtaining an initial guess close to the optimal fit is critical. For this model, it is recommended to follow these steps: - In the Fit Function window of MantidPlot, construct the model. - Tie parameter \(Height\) of PrimStretchedExpFT to zero, then carry out the Fit. This will result in optimized elastic line and background. - Untie parameter \(Height\) of PrimStretchedExpFT and tie parameter \(Beta\) to 1.0, then carry out the fit. This will result in optimized model using an exponential. - Release the tie on Beta and redo the fit.
# Load resolution function and scattered signal
resolution = LoadNexus(Filename="resolution_14955.nxs")
qens_data = LoadNexus(Filename="qens_data_14955.nxs")
# This function_string is obtained by constructing the model
# with the Fit Function window of MantidPlot, then
# Setup--> Manage Setup --> Copy to Clipboard
function_string = "(composite=Convolution,FixResolution=true,NumDeriv=true;"
function_string += "name=TabulatedFunction,Workspace=resolution,WorkspaceIndex=0,Scaling=1,Shift=0,XScaling=1;"
function_string += "(name=DeltaFunction,Height=1,Centre=0;"
function_string += "name=PrimStretchedExpFT,Height=1.0,Tau=100,Beta=0.98,Centre=0));"
function_string += "name=LinearBackground,A0=0,A1=0"
# Carry out the fit. Produces workspaces fit_results_Parameters,
# fit_results_Workspace, and fit_results_NormalisedCovarianceMatrix.
Fit(Function=function_string,
InputWorkspace="qens_data",
WorkspaceIndex=0,
StartX=-0.15, EndX=0.15,
CreateOutput=1,
Output="fit_results")
# Collect and print parameters for PrimStrechtedExpFT
parameters_of_interest = ("Tau", "Beta")
values_found = {}
ws = mtd["fit_results_Parameters"] # Workspace containing optimized parameters
for row_index in range(ws.rowCount()):
full_parameter_name = ws.row(row_index)["Name"]
for parameter in parameters_of_interest:
if parameter in full_parameter_name:
values_found[parameter] = ws.row(row_index)["Value"]
break
if values_found["Beta"] > 0.63 and values_found["Beta"] < 0.71:
print("Beta found within [0.63, 0.71]")
if values_found["Tau"] > 54.0 and values_found["Tau"] < 60.0:
print( "Tau found within [54.0, 60.0]")
Output:
Beta found within [0.63, 0.71]
Tau found within [54.0, 60.0]
Categories: FitFunctions | QuasiElastic
Python: PrimStretchedExpFT.py (last modified: 2020-03-27)