Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ void PolarizerEfficiency::calculatePolarizerEfficiency() {

const MatrixWorkspace_sptr effCell = getProperty(PropertyNames::ANALYSER_EFFICIENCY);

auto &&effPolarizer = (t00Ws - t01Ws) / (4 * (2 * effCell - 1) * (t00Ws + t01Ws)) + 0.5;
auto &&effPolarizer = (t00Ws - t01Ws) / (2 * (2 * effCell - 1) * (t00Ws + t01Ws)) + 0.5;

calculateErrors(t00Ws, t01Ws, effCell, effPolarizer);

Expand Down Expand Up @@ -199,9 +199,9 @@ void PolarizerEfficiency::calculateErrors(const MatrixWorkspace_sptr &t00Ws, con
const auto &twoCellEffMinusOne = 2 * effCellY[i] - 1;
const auto &t00PlusT01 = t00Y[i] + t01Y[i];

const auto &delta00 = (t01Y[i]) / (2 * (twoCellEffMinusOne)*pow(t00PlusT01, 2));
const auto &delta01 = (-1 * t00Y[i]) / (2 * (twoCellEffMinusOne)*pow(t00PlusT01, 2));
const auto &deltaEffCell = (t01Y[i] - t00Y[i]) / (2 * pow(twoCellEffMinusOne, 2) * (t00PlusT01));
const auto &delta00 = (t01Y[i]) / ((twoCellEffMinusOne)*pow(t00PlusT01, 2));
const auto &delta01 = (-1 * t00Y[i]) / ((twoCellEffMinusOne)*pow(t00PlusT01, 2));
const auto &deltaEffCell = (t01Y[i] - t00Y[i]) / (pow(twoCellEffMinusOne, 2) * (t00PlusT01));
effPolarizerE[i] = sqrt(pow(delta00 * t00E[i], 2) + pow(delta01 * t01E[i], 2) + pow(deltaEffCell * effCellE[i], 2));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ class PolarizerEfficiencyTest : public CxxTest::TestSuite {
polariserEfficiency->getProperty("OutputWorkspace"));

// The T_para and T_anti curves are 4 and 2 (constant wrt wavelength) respectively, and the analyser
// efficiency is 1 for all wavelengths, which should give us a polarizer efficiency of 7/12
// efficiency is 1 for all wavelengths, which should give us a polarizer efficiency of 2/3
for (const double &y : calculatedPolariserEfficiency->dataY(0)) {
TS_ASSERT_DELTA(7.0 / 12.0, y, 1e-8);
TS_ASSERT_DELTA(2.0 / 3.0, y, 1e-8);
}
}

Expand All @@ -151,9 +151,9 @@ class PolarizerEfficiencyTest : public CxxTest::TestSuite {
polariserEfficiency->getProperty("OutputWorkspace"));

// The T_para and T_anti curves are 4 and 2 (constant wrt wavelength) respectively, and the analyser
// efficiency is 1 for all wavelengths, which should give us a polarizer efficiency of 7/12
// efficiency is 1 for all wavelengths, which should give us a polarizer efficiency of 2/3
for (const double &y : calculatedPolariserEfficiency->dataY(0)) {
TS_ASSERT_DELTA(7.0 / 12.0, y, 1e-8);
TS_ASSERT_DELTA(2.0 / 3.0, y, 1e-8);
}
}

Expand All @@ -164,8 +164,7 @@ class PolarizerEfficiencyTest : public CxxTest::TestSuite {
polarizerEfficiency->getProperty("OutputWorkspace"));
const auto &errors = eff->dataE(0);
// Skip the first error because with this toy data it'll be NaN
const std::vector<double> expectedErrors{44.194173824159222, 19.641855032959654, 11.048543456039805,
7.0710678118654755};
const std::vector<double> expectedErrors{88.3883476283, 39.2837100613, 22.0970869124, 14.1421356255};
for (size_t i = 0; i < expectedErrors.size(); ++i) {
TS_ASSERT_DELTA(expectedErrors[i], errors[i + 1], 1e-7);
}
Expand Down
8 changes: 4 additions & 4 deletions docs/source/algorithms/PolarizerEfficiency-v1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The polarization of the polarizer, :math:`P_{SM}`, is given by [#KRYCKA]_
Since the efficiency, :math:`\epsilon_{SM}`, is given by :math:`\frac{1 + P_{SM}}{2}`, we have that

.. math::
\epsilon_{SM} = \frac{1}{2} + \frac{T_{00} - T_{01}}{4(2\epsilon_{cell} - 1)(T_{00} + T_{01})}
\epsilon_{SM} = \frac{1}{2} + \frac{T_{00} - T_{01}}{2(2\epsilon_{cell} - 1)(T_{00} + T_{01})}

The error in the calculation can then be determined thus:

Expand All @@ -34,13 +34,13 @@ The error in the calculation can then be determined thus:
where:

.. math::
\frac{\delta \epsilon_{SM}}{\delta T_{00}} = \frac{T_{01}}{2(2\epsilon_{cell} - 1)(T_{00} + T_{01})^2}
\frac{\delta \epsilon_{SM}}{\delta T_{00}} = \frac{T_{01}}{(2\epsilon_{cell} - 1)(T_{00} + T_{01})^2}

.. math::
\frac{\delta \epsilon_{SM}}{\delta T_{01}} = \frac{-T_{00}}{2(2\epsilon_{cell} - 1)(T_{00} + T_{01})^2}
\frac{\delta \epsilon_{SM}}{\delta T_{01}} = \frac{-T_{00}}{(2\epsilon_{cell} - 1)(T_{00} + T_{01})^2}

.. math::
\frac{\delta \epsilon_{SM}}{\delta \epsilon_{cell}} = \frac{T_{01} - T_{00}}{2(2\epsilon_{cell} - 1)^2(T_{00} + T_{01})}
\frac{\delta \epsilon_{SM}}{\delta \epsilon_{cell}} = \frac{T_{01} - T_{00}}{(2\epsilon_{cell} - 1)^2(T_{00} + T_{01})}

Usage
-----
Expand Down
Loading