1 | import numpy as np |
---|
2 | |
---|
3 | def noise(n): |
---|
4 | return ( np.random.random(n) - 0.5 ) / 10 |
---|
5 | |
---|
6 | ws = CreateWorkspace('-10,10,-10,10,-10,10','0,0,0,0,0,0',NSpec=3) |
---|
7 | ws = Rebin('ws','-10,0.01,10') |
---|
8 | n = ws.blocksize() |
---|
9 | x = ws.readX(0) |
---|
10 | ws.setY(0, np.exp( -(x+1.0)**2/0.99 ) * 1.1 + noise(n) ) |
---|
11 | ws.setY(1, np.exp( -(x)**2 ) + noise(n) ) |
---|
12 | ws.setY(2, np.exp( -(x-1.0)**2/1.01 ) * 0.9 + noise(n) ) |
---|
13 | |
---|
14 | fun = 'name=Gaussian,$domains=i,Height=1,Sigma=1,PeakCentre=0' |
---|
15 | muli_domain = 'composite=MultiDomainFunction;(%s);(%s);(%s);ties=(f2.Sigma=f1.Sigma=f0.Sigma)' % (fun,fun,fun) |
---|
16 | |
---|
17 | kwargs = {\ |
---|
18 | 'WorkspaceIndex': 0, |
---|
19 | 'InputWorkspace_1':'ws', |
---|
20 | 'WorkspaceIndex_1': 1, |
---|
21 | 'InputWorkspace_2':'ws', |
---|
22 | 'WorkspaceIndex_2': 2, |
---|
23 | } |
---|
24 | |
---|
25 | Fit(muli_domain,'ws',Output='out',**kwargs) |
---|