PrimStretchedExpFT¶
Properties (fitting parameters)¶
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 |
Description¶
Provides the Fourier Transform of the Symmetrized Stretched Exponential Function integrated over each energy bin.
with
In the picture below we evaluated function StretcheExpFT at the center of bins of width
Usage¶
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:
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 a plot MantidWorkbench, construct the model.
- Tie parameter
# 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 a plot in MantidWorkbench, 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
Source¶
Python: PrimStretchedExpFT.py