Ticket #4394: test.py

File test.py, 1.3 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       Intensity = 0.74,  Radius = 2.25,  Diffusion = 0.024
7After the fit, check workspace data_Parameters for f1.f1 parameters
8
9The units for this example are:
10  [Intensity] = arbitray units
11  [Radius] = Angstroms
12  [Diffusion] = Anstroms^2 / pico-seconds
13  [X-values in data.nxs] = mili-eV
14'''
15
16workdir = '/tmp'
17LoadNexus(Filename='{0}/data.nxs'.format( workdir), OutputWorkspace='data' )
18LoadNexus(Filename='{0}/resolution.nxs'.format( workdir), OutputWorkspace='resolution' )
19
20#The fitstring defines the model:  A * Elastic + B*Convolution( Elastic, DiffSphere) + LinearBackground
21fitstring='name=TabulatedFunction,Workspace=resolution,WorkspaceIndex=0,Scaling=0.02,constraints=(0.0001<Scaling);(composite=Convolution,FixResolution=true,NumDeriv=true;name=TabulatedFunction,Workspace=resolution,WorkspaceIndex=0,Scaling=1;(name=DiffSphere,NumDeriv=true,Q=1.0,Intensity=0.2,Radius=4.0,Diffusion=0.05));name=LinearBackground,A0=0.0,A1=-0.0'
22
23Fit(Function=fitstring, InputWorkspace='data', StartX=-0.1, EndX=0.1, CreateOutput=1)