Skip to content

Commit

Permalink
refs #10384 Sphinx warnings and different background errors formula
Browse files Browse the repository at this point in the history
  • Loading branch information
abuts committed Oct 29, 2014
1 parent 56b7a3c commit 39487eb
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 26 deletions.
10 changes: 6 additions & 4 deletions Code/Mantid/Framework/Algorithms/src/BackgroundHelper.cpp
Expand Up @@ -94,17 +94,19 @@ namespace Mantid
double L2 = detector->getDistance(*m_Sample);
double delta(std::numeric_limits<double>::quiet_NaN());
// clone unit conversion to avoid multithreading issues
auto unitCong = m_WSUnit->clone();
auto unitConv = m_WSUnit->clone();
unitCong->initialize(m_L1, L2,twoTheta, m_Emode, m_Efix,delta);
double tof1 = unitCong->singleToTOF(XValues[0]);
double tof1 = unitConv->singleToTOF(XValues[0]);
for(size_t i=0;i<y_data.size();i++)
{
double tof2=unitCong->singleToTOF(XValues[i+1]);
double tof2=unitConv->singleToTOF(XValues[i+1]);
double Jack = std::fabs((tof2-tof1)/dtBg);
double normBkgrnd = IBg*Jack;
tof1=tof2;
y_data[i] -=normBkgrnd;
e_data[i] =std::sqrt((ErrSq*Jack*Jack+e_data[i]*e_data[i])/2.); // needs further clarification -- Gaussian error summation?
//e_data[i] =std::sqrt((ErrSq*Jack*Jack+e_data[i]*e_data[i])/2.); // needs further clarification -- Gaussian error summation?
//--> assume error for background is sqrt(signal):
e_data[i] =std::sqrt((normBkgrnd+e_data[i]*e_data[i])/2.); // needs further clarification -- Gaussian error summation?
}

}
Expand Down
45 changes: 23 additions & 22 deletions Code/Mantid/docs/source/algorithms/Rebin-v1.rst
Expand Up @@ -345,7 +345,7 @@ Output:
What type is the workspace after 1st rebin: <class 'mantid.api._api.IEventWorkspace'>
What type is the workspace after 2nd rebin: <class 'mantid.api._api.MatrixWorkspace'>

**Example -- Background removal during rebinning
**Example - Background removal during rebinning**

.. testcode:: ExRebinWithBkgRemoval

Expand Down Expand Up @@ -384,25 +384,26 @@ Output:
.. testoutput:: ExRebinWithBkgRemoval

| x sampl | x result | S sample | S no bg | Err samp | Err no_bg|
| -20.0| -20.0| 1.0000| -0.959| 1.000| 83.115|
| -18.0| -18.0| 2.0000| -0.101| 1.414| 89.127|
| -16.0| -16.0| 3.0000| 0.740| 1.732| 95.900|
| -14.0| -14.0| 1.0000| -1.441| 1.000| 103.568|
| -12.0| -12.0| 5.0000| 2.353| 2.236| 112.332|
| -10.0| -10.0| 2.0000| -0.885| 1.414| 122.387|
| -8.0| -8.0| 5.0000| 1.841| 2.236| 134.052|
| -6.0| -6.0| 2.0000| -1.481| 1.414| 147.684|
| -4.0| -4.0| 4.0000| 0.139| 2.000| 163.806|
| -2.0| -2.0| 3.0000| -1.315| 1.732| 183.086|
| 0.0| 0.0| 6.0000| 1.133| 2.449| 206.478|
| 2.0| 2.0| 7.0000| 1.454| 2.646| 235.313|
| 4.0| 4.0| 5.0000| -1.400| 2.236| 271.548|
| 6.0| 6.0| 7.0000| -0.499| 2.646| 318.157|
| 8.0| 8.0| 9.0000| 0.047| 3.000| 379.833|
| 10.0| 10.0| 11.0000| 0.054| 3.317| 464.415|
| 12.0| 12.0| 16.0000| 2.190| 4.000| 585.907|
| 14.0| 14.0| 16.0000| -2.188| 4.000| 771.675|
| 16.0| 16.0| 26.0000| 0.490| 5.099| 1082.292|
| 18.0| 18.0| 39.0000| -0.581| 6.245| 1679.267|
| -20.0| -20.0| 1.0000| -0.959| 1.000| 1.216|
| -18.0| -18.0| 2.0000| -0.101| 1.414| 1.432|
| -16.0| -16.0| 3.0000| 0.740| 1.732| 1.622|
| -14.0| -14.0| 1.0000| -1.441| 1.000| 1.312|
| -12.0| -12.0| 5.0000| 2.353| 2.236| 1.955|
| -10.0| -10.0| 2.0000| -0.885| 1.414| 1.563|
| -8.0| -8.0| 5.0000| 1.841| 2.236| 2.020|
| -6.0| -6.0| 2.0000| -1.481| 1.414| 1.655|
| -4.0| -4.0| 4.0000| 0.139| 2.000| 1.983|
| -2.0| -2.0| 3.0000| -1.315| 1.732| 1.912|
| 0.0| 0.0| 6.0000| 1.133| 2.449| 2.331|
| 2.0| 2.0| 7.0000| 1.454| 2.646| 2.505|
| 4.0| 4.0| 5.0000| -1.400| 2.236| 2.388|
| 6.0| 6.0| 7.0000| -0.499| 2.646| 2.692|
| 8.0| 8.0| 9.0000| 0.047| 3.000| 2.996|
| 10.0| 10.0| 11.0000| 0.054| 3.317| 3.313|
| 12.0| 12.0| 16.0000| 2.190| 4.000| 3.861|
| 14.0| 14.0| 16.0000| -2.188| 4.000| 4.135|
| 16.0| 16.0| 26.0000| 0.490| 5.099| 5.075|
| 18.0| 18.0| 39.0000| -0.581| 6.245| 6.268|

.. categories::

0 comments on commit 39487eb

Please sign in to comment.