diff --git a/Framework/Algorithms/src/CalculatePlaczekSelfScattering.cpp b/Framework/Algorithms/src/CalculatePlaczekSelfScattering.cpp index d834c27ded871c0ad68cf1b4187dd7b2c4b07f82..db46d119f72ed5792251897eb84c4044bad13e4f 100644 --- a/Framework/Algorithms/src/CalculatePlaczekSelfScattering.cpp +++ b/Framework/Algorithms/src/CalculatePlaczekSelfScattering.cpp @@ -114,10 +114,10 @@ void CalculatePlaczekSelfScattering::exec() { phi1.push_back((xLambda[i] + dx) * incidentPrime[i] / incident[i]); } // set detector law term (eps1) - const double lambdaD = 1.44; std::vector<double> eps1; + const double lambdaD = 1.44; for (size_t i = 0; i < xLambda.size() - 1; i++) { - double xTerm = -(xLambda[i] + dx) / lambdaD; + double xTerm = (xLambda[i] + dx) / lambdaD; eps1.push_back(xTerm * exp(xTerm) / (1.0 - exp(xTerm))); } /* Placzek @@ -163,10 +163,9 @@ void CalculatePlaczekSelfScattering::exec() { specInfo.twoTheta(specIndex), 0, 1.0, 1.0); for (size_t xIndex = 0; xIndex < xLambda.size() - 1; xIndex++) { const double term1 = (f - 1.0) * phi1[xIndex]; - const double term2 = -f * eps1[xIndex]; - const double term3 = f - 3.0; + const double term2 = f * (1.0 - eps1[xIndex]); const double inelasticPlaczekSelfCorrection = - 2.0 * (term1 + term2 + term3) * sinThetaBy2 * sinThetaBy2 * + 2.0 * (term1 + term2 - 3) * sinThetaBy2 * sinThetaBy2 * summationTerm; x[xIndex] = wavelength.singleToTOF(xLambda[xIndex]); y[xIndex] = inelasticPlaczekSelfCorrection; diff --git a/scripts/Diffraction/isis_powder/polaris_routines/polaris_algs.py b/scripts/Diffraction/isis_powder/polaris_routines/polaris_algs.py index bdefcd7ba63ce080f3d644b77d6c09d2f9f96589..644d82acf73fa5ab16be24f57c8588839f2f0afe 100644 --- a/scripts/Diffraction/isis_powder/polaris_routines/polaris_algs.py +++ b/scripts/Diffraction/isis_powder/polaris_routines/polaris_algs.py @@ -151,8 +151,8 @@ def _generate_grouped_ts_pdf(run_number, focused_ws, q_lims, cal_file_name, samp width_x = (max_x-min_x)/x_data.size fit_spectra = mantid.FitIncidentSpectrum(InputWorkspace=monitor, BinningForCalc=[min_x, 1*width_x, max_x], - BinningForFit=[min_x, 50*width_x, max_x], - FitSpectrumWith="GaussConvCubicSpline") + BinningForFit=[min_x, 1*width_x, max_x], + FitSpectrumWith="CubicSpline") placzek = mantid.CalculatePlaczekSelfScattering(InputWorkspace=raw_ws, IncidentSpecta=fit_spectra) mantid.ConvertFromDistribution(Workspace=placzek) cal_workspace = mantid.LoadCalFile(InputWorkspace=placzek, @@ -174,10 +174,6 @@ def _generate_grouped_ts_pdf(run_number, focused_ws, q_lims, cal_file_name, samp mantid.Subtract(LHSWorkspace=focused_data_combined, RHSWorkspace=placzek, OutputWorkspace=focused_data_combined) - - mantid.MatchSpectra(InputWorkspace=focused_data_combined, - OutputWorkspace=focused_data_combined, - ReferenceSpectrum=1) if type(q_lims) == str: q_min = [] q_max = [] @@ -202,6 +198,9 @@ def _generate_grouped_ts_pdf(run_number, focused_ws, q_lims, cal_file_name, samp q_max[i] = pdf_x_array[np.amax(np.where(pdf_x_array <= q_max[i]))] bin_width = min(pdf_x_array[1] - pdf_x_array[0], bin_width) focused_data_combined = mantid.CropWorkspaceRagged(InputWorkspace=focused_data_combined, XMin=q_min, XMax=q_max) + mantid.MatchSpectra(InputWorkspace=focused_data_combined, + OutputWorkspace=focused_data_combined, + ReferenceSpectrum=1) focused_data_combined = mantid.Rebin(InputWorkspace=focused_data_combined, Params=[min(q_min), bin_width, max(q_max)]) focused_data_combined = mantid.SumSpectra(InputWorkspace=focused_data_combined,