Ticket #10200: verify10200.py

File verify10200.py, 684 bytes (added by Wenduo Zhou, 6 years ago)
Line 
1vecx = []
2vecy = []
3vece = []
4
5import random
6random.seed(0)
7import math
8
9x0 = 0.0
10dx = 0.1
11for 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
23ws = CreateWorkspace(DataX=vecx, DataY=vecy, DataE=vece, NSpec=1)
24
25fitws1 = FindPeaks(InputWorkspace=ws, WorkspaceIndex=0,PeakPositions="2.17, 5.1", PeakFunction="Gaussian", BackgroundType="Linear")
26
27fitws2 = FindPeaks(InputWorkspace=ws, WorkspaceIndex=0,PeakPositions="2.17, 5.1", PeakFunction="Gaussian", BackgroundType="Linear", MinimumPeakHeightObs=5)