1 | vecx = [] |
---|
2 | vecy = [] |
---|
3 | vece = [] |
---|
4 | |
---|
5 | import random |
---|
6 | random.seed(0) |
---|
7 | import math |
---|
8 | |
---|
9 | x0 = 0.0 |
---|
10 | dx = 0.1 |
---|
11 | for i in xrange(100): |
---|
12 | x = x0 + dx * float(i) |
---|
13 | y = int(random.random()*5) |
---|
14 | y += 10. * math.exp( -(x-5.0)**2/0.4 ) |
---|
15 | e = math.sqrt(y) |
---|
16 | if e < 1.: |
---|
17 | e = 1. |
---|
18 | |
---|
19 | vecx.append(x) |
---|
20 | vecy.append(y) |
---|
21 | vece.append(e) |
---|
22 | |
---|
23 | ws = CreateWorkspace(DataX=vecx, DataY=vecy, DataE=vece, NSpec=1) |
---|
24 | |
---|
25 | fitws1 = FindPeaks(InputWorkspace=ws, WorkspaceIndex=0,PeakPositions="2.17, 5.1", PeakFunction="Gaussian", BackgroundType="Linear") |
---|
26 | |
---|
27 | fitws2 = FindPeaks(InputWorkspace=ws, WorkspaceIndex=0,PeakPositions="2.17, 5.1", PeakFunction="Gaussian", BackgroundType="Linear", MinimumPeakHeightObs=5) |
---|