Skip to content
Snippets Groups Projects
Commit 22010426 authored by Harriet Brown's avatar Harriet Brown
Browse files

correct eps term in placzek correction

parent 0b199566
No related merge requests found
......@@ -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;
......
......@@ -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,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment