| 1 | ###################################################################### |
|---|
| 2 | # Test procedure |
|---|
| 3 | # 1. Load data |
|---|
| 4 | # 2. Select background referring to data points selected by user |
|---|
| 5 | # 3. Fit the selected background |
|---|
| 6 | # 4. Select background (again) according to the fitted background function |
|---|
| 7 | ###################################################################### |
|---|
| 8 | LoadAscii(Filename=r'22946.gda',OutputWorkspace='V22946',Unit='TOF') |
|---|
| 9 | |
|---|
| 10 | ProcessBackground( |
|---|
| 11 | InputWorkspace='V22946', |
|---|
| 12 | OutputWorkspace='V22946_Bkgd01', |
|---|
| 13 | Options='SelectBackgroundPoints', |
|---|
| 14 | BackgroundType='Chebyshev', |
|---|
| 15 | BackgroundOrder='6', |
|---|
| 16 | BackgroundPoints='7449,8413,9217,10709,12183,13110,13317,14539,16103,17683,18700,19717,22912,25000,28900,37444,49000,53000,55000', |
|---|
| 17 | NoiseTolerance='200', |
|---|
| 18 | UserBackgroundWorkspace='FilterRef01', |
|---|
| 19 | SelectionMode = 'FitGivenDataPoints' |
|---|
| 20 | ) |
|---|
| 21 | |
|---|
| 22 | startx = 7360. |
|---|
| 23 | endx = 55375. |
|---|
| 24 | |
|---|
| 25 | functionstr = "name=%s,n=%d, EndX=%f, StartX=%f" % ("Chebyshev", 12, endx, startx) |
|---|
| 26 | for iborder in xrange(13): |
|---|
| 27 | functionstr = "%s,A%d=%.5f" % (functionstr, iborder, 0.0) |
|---|
| 28 | Fit( |
|---|
| 29 | Function = functionstr, |
|---|
| 30 | InputWorkspace = 'V22946_Bkgd01', |
|---|
| 31 | Output = 'V22946_Bkgd01', |
|---|
| 32 | MaxIterations = '1000', |
|---|
| 33 | Minimizer = 'Levenberg-MarquardtMD', |
|---|
| 34 | CreateOutput = '1', |
|---|
| 35 | StartX = startx, |
|---|
| 36 | EndX = endx) |
|---|
| 37 | |
|---|
| 38 | |
|---|
| 39 | ProcessBackground( |
|---|
| 40 | InputWorkspace='V22946', |
|---|
| 41 | OutputWorkspace='V22946_Bkgd02', |
|---|
| 42 | Options='SelectBackgroundPoints', |
|---|
| 43 | LowerBound = startx, |
|---|
| 44 | UpperBound = endx, |
|---|
| 45 | BackgroundType='Chebyshev', |
|---|
| 46 | SelectionMode = 'UserFunction', |
|---|
| 47 | BackgroundTableWorkspace = 'V22946_Bkgd01_Parameters', |
|---|
| 48 | NoiseTolerance='100', |
|---|
| 49 | UserBackgroundWorkspace='FilterRef02') |
|---|
| 50 | |
|---|
| 51 | functionstr = "name=%s,n=%d, EndX=%f, StartX=%f" % ("Chebyshev", 12, endx, startx) |
|---|
| 52 | for iborder in xrange(13): |
|---|
| 53 | functionstr = "%s,A%d=%.5f" % (functionstr, iborder, 0.0) |
|---|
| 54 | Fit( |
|---|
| 55 | Function = functionstr, |
|---|
| 56 | InputWorkspace = 'V22946_Bkgd02', |
|---|
| 57 | Output = 'V22946_Bkgd02', |
|---|
| 58 | MaxIterations = '1000', |
|---|
| 59 | Minimizer = 'Levenberg-MarquardtMD', |
|---|
| 60 | CreateOutput = '1', |
|---|
| 61 | StartX = startx, |
|---|
| 62 | EndX = endx) |
|---|