Skip to content

Commit

Permalink
Refs #10018 Finished with the fitting part
Browse files Browse the repository at this point in the history
  • Loading branch information
jmborr committed Jul 30, 2014
1 parent 814ae38 commit fd4b90c
Showing 1 changed file with 34 additions and 2 deletions.
36 changes: 34 additions & 2 deletions Code/Mantid/docs/source/algorithms/LoadSassena-v1.rst
Expand Up @@ -54,7 +54,39 @@ Usage

.. testcode:: Ex

ws = LoadSassena("loadSassenaExample.h5")

ws = LoadSassena("loadSassenaExample.h5", TimeUnit=1.0)
print 'workspaces instantiated: ', ', '.join(ws.getNames())
fqtReal = ws[1] # Real part of F(Q,t)
# Let's fit it to a Gaussian. We start with an initial guess
intensity = 0.5
center = 0.0
sigma = 200.0
startX = -900.0
endX = 900.0
myFunc = 'name=Gaussian,Height={0},PeakCentre={1},Sigma={2}'.format(intensity,center,sigma)

# Call the Fit algorithm and perform the fit
fitStatus, chiSq, covarianceTable, paramTable, fitWorkspace =\
Fit(Function=myFunc, InputWorkspace=fqtReal, WorkspaceIndex=0, StartX = startX, EndX=endX, Output='fit')

print "The fit was: " + fitStatus
print("Fitted Height value is: %.2f" % paramTable.column(1)[0])
print("Fitted centre value is: %.2f" % abs(paramTable.column(1)[1]))
print("Fitted sigma value is: %.1f" % paramTable.column(1)[2])
# fitWorkspace contains the data, the calculated and the difference patterns
print "Number of spectra in fitWorkspace is: " + str(fitWorkspace.getNumberHistograms())
print("The 989th y-value of the fitted curve: %.3f" % fitWorkspace.readY(1)[989])

Output:

.. testoutput:: Ex

workspaces instantiated: ws_qvectors, ws_fqt.Re, ws_fqt.Im
The fit was: success
Fitted Height value is: 1.00
Fitted centre value is: 0.00
Fitted sigma value is: 100.0
Number of spectra in fitWorkspace is: 3
The 989th y-value of the fitted curve: 0.673

.. categories::

0 comments on commit fd4b90c

Please sign in to comment.