Ticket #9439: multifittest.py

File multifittest.py, 809 bytes (added by Roman Tolchenov, 6 years ago)
Line 
1
2# create a workspace with 3 spectra and a single point in each. x-values of each spctrum are different.
3ws = CreateWorkspace([1,2,3], [0,0,0],[1,1,1],3)
4
5# define a multi-domain function with a single member which is to be applied to 3 domains with indices form 0 to 2.
6fun = 'composite=MultiDomainFunction;name=UserFunction,Formula="x",$domains=(0-2)'
7
8# specify additional spectra using properties InputWorkspace_# and WorkspaceIndex_#
9kwargs = {
10        'MaxIterations':0,
11        'CreateOutput':1,
12        'InputWorkspace_1': ws,
13        'WorkspaceIndex_1': 1,    # domain 1
14        'InputWorkspace_2': ws,
15        'WorkspaceIndex_2': 2,    # domain 2
16        }
17
18# evaluate the function
19Fit(fun,ws,**kwargs)
20
21# check the output ws_Workspaces: Calc-values should be equal to x-values