Ticket #8658: test.py

File test.py, 1.2 KB (added by Jose Borreguero, 7 years ago)
Line 
1'''This is a fit to data.nxs using the convolution of a resolution and a DiffRotDiscreteCircle function.
2The data and resolution correspond to an experiment of Octa-Methyl Silsesquioxane molecules
3carried out at 200K
4
5data.nxs is such that the optimized parameters should be:
6
7   Intensity = 0.745,  Radius = 0.876(Angstroms),  Decay = 121.5(pico-seconds)
8
9In DiffRotDiscreteCircle, "N" and "Q " are attributes, not fitting parameters.
10Data corresponds to Q=1.9. This is a fit to methyl rotations, thus N-3 was selected
11
12I chose starting parameters in "fitstring" reasonable far apart from
13the optimal values. Feel free to change this initial guess.
14
15The units for this example are:
16  [Intensity] = arbitray units
17  [Radius] = Angstroms
18  [Decay] = pico-seconds
19  [X-values in data.nxs] = micro-eV
20 
21'''
22data = LoadNexus(Filename='/tmp/data.nxs')
23resolution = LoadNexus(Filename='/tmp/resolution.nxs')
24fitstring='(composite=Convolution,FixResolution=true,NumDeriv=true;name=TabulatedFunction,Workspace=resolution,Scaling=1;(name=DiffRotDiscreteCircle,N=3,NumDeriv=true,Q=1.9,Intensity=1,Radius=1,Decay=10));name=LinearBackground,A0=0.001,A1=0.0001'
25Fit(Function=fitstring, InputWorkspace='data', CreateOutput=1)