\(\renewcommand\AA{\unicode{x212B}}\)

QENSFitSimultaneous v1

Summary

Performs a simultaneous QENS fit

See Also

ConvolutionFitSimultaneous, IqtFitSimultaneous, Fit

Properties

Name

Direction

Type

Default

Description

Function

InOut

Function

Mandatory

Parameters defining the fitting function and its initial values

InputWorkspace

Input

Workspace

Mandatory

Name of the input Workspace

IgnoreInvalidData

Input

boolean

False

Flag to ignore infinities, NaNs and data with zero errors.

DomainType

Input

string

Simple

The type of function domain to use: Simple, Sequential, or Parallel. Allowed values: [‘Simple’, ‘Sequential’, ‘Parallel’]

EvaluationType

Input

string

CentrePoint

The way the function is evaluated on histogram data sets. If value is “CentrePoint” then function is evaluated at centre of each bin. If it is “Histogram” then function is integrated within the bin and the integrals returned. Allowed values: [‘CentrePoint’, ‘Histogram’]

StepSizeMethod

Input

string

Default

The way the step size is calculated for numerical derivatives. See the section about step sizes in the Fit algorithm documentation to understand the difference between “Default” and “Sqrt epsilon”. Allowed values: [‘Default’, ‘Sqrt epsilon’]

PeakRadius

Input

number

0

A value of the peak radius the peak functions should use. A peak radius defines an interval on the x axis around the centre of the peak where its values are calculated. Values outside the interval are not calculated and assumed zeros.Numerically the radius is a whole number of peak widths (FWHM) that fit into the interval on each side from the centre. The default value of 0 means the whole x axis.

Ties

Input

string

Math expressions defining ties between parameters of the fitting function.

Constraints

Input

string

List of constraints

MaxIterations

Input

number

500

Stop after this number of iterations if a good fit is not found

Minimizer

Input

string

Levenberg-Marquardt

Minimizer to use for fitting. Allowed values: [‘BFGS’, ‘Conjugate gradient (Fletcher-Reeves imp.)’, ‘Conjugate gradient (Polak-Ribiere imp.)’, ‘Damped GaussNewton’, ‘FABADA’, ‘Levenberg-Marquardt’, ‘Levenberg-MarquardtMD’, ‘Simplex’, ‘SteepestDescent’, ‘Trust Region’]

CalcErrors

Input

boolean

False

Set to true to calcuate errors when output isn’t created (default is false).

ExtractMembers

Input

boolean

False

If true, then each member of the fit will be extracted, into their own workspace. These workspaces will have a histogram for each spectrum (Q-value) and will be grouped.

ConvolveMembers

Input

boolean

False

If true members of any Convolution are output convolved with corresponding resolution

OutputCompositeMembers

Input

boolean

False

If true and CreateOutput is true then the value of each member of a Composite Function is also output.

ResultXAxisUnit

Input

string

MomentumTransfer

The unit to assign to the X Axis of the result workspace, defaults to MomentumTransfer. Allowed values: [‘AtomicDistance’, ‘Degrees’, ‘DeltaE’, ‘DeltaE_inFrequency’, ‘DeltaE_inWavenumber’, ‘dSpacing’, ‘dSpacingPerpendicular’, ‘Empty’, ‘Energy’, ‘Energy_inWavenumber’, ‘Label’, ‘Momentum’, ‘MomentumTransfer’, ‘Phi’, ‘QSquared’, ‘SpinEchoLength’, ‘SpinEchoTime’, ‘Temperature’, ‘Time’, ‘TOF’, ‘Wavelength’, ‘’]

OutputWorkspace

Output

WorkspaceGroup

Mandatory

The output result workspace(s)

OutputParameterWorkspace

Output

TableWorkspace

The output parameter workspace

OutputWorkspaceGroup

Output

WorkspaceGroup

The output group workspace

OutputFitStatus

Input

boolean

True

Flag to output fit status information, which consists of the fit OutputStatus and the OutputChiSquared

CostFunction

InOut

string

Least squares

The cost function to be used for the fit, default is Least squares. Allowed values: [‘Least squares’, ‘Poisson’, ‘Rwp’, ‘Unweighted least squares’]

Description

An algorithm used for fitting QENS-data simultaneously and formatting the output. Uses the Fit algorithm to perform the simultaneous fit.

The method of providing multiple data-sets to this algorithm is specified in the Fit documentation.

Workflow

../_images/QENSFitSimultaneous-v1_wkflw.svg

Usage

Example - QENSFitSimultaneous

# Load sample and resolution files
sample = Load('irs26176_graphite002_red.nxs')
resolution = Load('irs26173_graphite002_res.nxs')

background = LinearBackground(A0=0, A1=0)
peak_function = Lorentzian(Amplitude=1, PeakCentre=0, FWHM=0.0175)
resolution_function = Resolution(Workspace=resolution.getName(), WorkspaceIndex=0)
model = CompositeFunction(background, Convolution(peak_function, resolution_function))
multi_function = MultiDomainFunction(model, model)

startX = -0.547608
endX = 0.543217
convolve = True  # Convolve the fitted model components with the resolution
minimizer = "Levenberg-Marquardt"
maxIt = 500

# Run algorithm (fit spectra 1 and 2)
result, params, fit_group, status, chi2 = QENSFitSimultaneous(Function=multi_function,
                                                              InputWorkspace=sample,
                                                              WorkspaceIndex=0,
                                                              InputWorkspace_1=sample,
                                                              WorkspaceIndex_1=1,
                                                              StartX=startX, EndX=endX,
                                                              StartX_1=startX, EndX_1=endX,
                                                              ConvolveMembers=convolve,
                                                              Minimizer=minimizer,
                                                              MaxIterations=maxIt,
                                                              OutputWorkspace="QENSFitResult")

Categories: AlgorithmIndex | Workflow\MIDAS

Source

C++ header: QENSFitSimultaneous.h

C++ source: QENSFitSimultaneous.cpp