1 | from mantid.simpleapi import * |
---|
2 | #prepare data to the input of CalculateTransmission |
---|
3 | ws = LoadRaw("LOQ48097.raw", SpectrumMin=1, SpectrumMax=2); |
---|
4 | ws = ConvertUnits(ws, Target="Wavelength") |
---|
5 | m_dirWS = Rebin(ws, "6, 0.01, 7.5",OutputWorkspace="CalculateTransmissionTest_direct") |
---|
6 | m_transWS = Rebin(ws, "7.5, 0.01, 9",OutputWorkspace="CalculateTransmissionTest_trans") |
---|
7 | m_dirWS.setX(0, m_transWS.dataX(0)) |
---|
8 | m_dirWS.setX(1, m_transWS.dataX(0)) |
---|
9 | |
---|
10 | outlog = CalculateTransmission(m_transWS, m_dirWS, 1, 2,FitMethod='Log',OutputUnfittedData=True) |
---|
11 | out2 = CalculateTransmission(m_transWS, m_dirWS, 1, 2,FitMethod='Polynomial', PolynomialOrder=2,OutputUnfittedData=True) |
---|
12 | outlinear = CalculateTransmission(m_transWS, m_dirWS, 1, 2,FitMethod='Linear',OutputUnfittedData=True) |
---|
13 | |
---|
14 | |
---|
15 | unfitted = mtd['outlog_unfitted'] |
---|
16 | unf_log = Logarithm(unfitted, Natural=True) |
---|
17 | func_name ='name=LinearBackground' |
---|
18 | func_name = "name=Polynomial,n=2" |
---|
19 | Fit(Function=func_name, InputWorkspace=unf_log, CreateOutput=True, Output='unf_log_fit') |
---|
20 | unf_log_fit = ExtractSingleSpectrum('unf_log_fit_Workspace',1) |
---|
21 | fitted = Exponential(unf_log_fit) |
---|
22 | |
---|
23 | fitted_err = CreateWorkspace(range(len(fitted.dataE(0))),fitted.dataE(0)) |
---|
24 | out2 = out2[0] |
---|
25 | calc_err = CreateWorkspace(range(len(fitted.dataE(0))),out2.dataE(0)) |
---|
26 | |
---|
27 | |
---|
28 | # if you plot outlog, out2 and outlinear they should be similar. |
---|
29 | |
---|
30 | # fitted and out2 should be identical (the error will be slightly different due to an error to be dealt in #9011 |
---|