diff --git a/Framework/Algorithms/src/ReflectometryReductionOneAuto2.cpp b/Framework/Algorithms/src/ReflectometryReductionOneAuto2.cpp index f4138788f6d04b8c8262c2950753f9dcbb9e6694..0e9b1399870d7869635d59178852ea12a68aecf9 100644 --- a/Framework/Algorithms/src/ReflectometryReductionOneAuto2.cpp +++ b/Framework/Algorithms/src/ReflectometryReductionOneAuto2.cpp @@ -549,7 +549,7 @@ ReflectometryReductionOneAuto2::rebinAndScale(MatrixWorkspace_sptr inputWS, IAlgorithm_sptr calcRes = createChildAlgorithm("NRCalculateSlitResolution"); calcRes->setProperty("Workspace", inputWS); - calcRes->setProperty("TwoTheta", theta); + calcRes->setProperty("TwoTheta", 2 * theta); calcRes->execute(); if (!calcRes->isExecuted()) { diff --git a/Framework/Algorithms/test/ReflectometryReductionOneAuto2Test.h b/Framework/Algorithms/test/ReflectometryReductionOneAuto2Test.h index bf59b5460b45f97ac423e993351b2277305bc95b..7faa8beb0c14086329b187589b22f22070a5227f 100644 --- a/Framework/Algorithms/test/ReflectometryReductionOneAuto2Test.h +++ b/Framework/Algorithms/test/ReflectometryReductionOneAuto2Test.h @@ -248,6 +248,14 @@ public: alg.execute(); MatrixWorkspace_sptr out = alg.getProperty("OutputWorkspace"); + // Check default rebin params + const double qStep = alg.getProperty("MomentumTransferStep"); + const double qMin = alg.getProperty("MomentumTransferMin"); + const double qMax = alg.getProperty("MomentumTransferMax"); + TS_ASSERT_DELTA(qStep, 0.034028, 1e-6); + TS_ASSERT_DELTA(qMin, out->x(0).front(), 1e-6); + TS_ASSERT_DELTA(qMax, out->x(0).back(), 1e-6); + // Compare instrument components before and after auto instIn = inter->getInstrument(); auto instOut = out->getInstrument(); @@ -511,6 +519,14 @@ public: alg.execute(); MatrixWorkspace_sptr outQbinned = alg.getProperty("OutputWorkspaceBinned"); + // Check the rebin params have not changed + const double qStep = alg.getProperty("MomentumTransferStep"); + const double qMin = alg.getProperty("MomentumTransferMin"); + const double qMax = alg.getProperty("MomentumTransferMax"); + TS_ASSERT_EQUALS(qStep, -0.04); + TS_ASSERT_EQUALS(qMin, 1.0); + TS_ASSERT_EQUALS(qMax, 10.0); + TS_ASSERT_EQUALS(outQbinned->getNumberHistograms(), 1); // blocksize = (10.0 - 1.0) / 0.04 TS_ASSERT_EQUALS(outQbinned->blocksize(), 225); diff --git a/Framework/Algorithms/test/ReflectometryReductionOneTest.h b/Framework/Algorithms/test/ReflectometryReductionOneTest.h index bb3ea8f84fe0c32f0bff754c1c7f13cd06817a04..51c16bac0825d905a63dfeb1aca5e17c95be2c1e 100644 --- a/Framework/Algorithms/test/ReflectometryReductionOneTest.h +++ b/Framework/Algorithms/test/ReflectometryReductionOneTest.h @@ -241,10 +241,10 @@ public: auto alg = construct_standard_algorithm(); auto inWS = create2DWorkspace154(1, 10, true); // this instrument does not have a "slit-gap" property - // defined in the IPF, so CalculateResolution should throw. + // defined in the IPF, so NRCalculateSlitResolution should throw. inWS->setInstrument(m_tinyReflWS->getInstrument()); inWS->getAxis(0)->setUnit("Wavelength"); - // Setup bad bin edges, Rebin will throw (not CalculateResolution?) + // Setup bad bin edges, Rebin will throw (not NRCalculateSlitResolution?) inWS->mutableX(0) = inWS->x(0)[0]; alg->setProperty("InputWorkspace", inWS); alg->setProperty("OutputWorkspace", "rebinnedWS"); diff --git a/docs/source/algorithms/ReflectometryReductionOneAuto-v2.rst b/docs/source/algorithms/ReflectometryReductionOneAuto-v2.rst index 60975e334cfbed5cb1a4ff100c58722f4e70257b..da1244479589b24760cbd4db2fd332179f20ccaf 100644 --- a/docs/source/algorithms/ReflectometryReductionOneAuto-v2.rst +++ b/docs/source/algorithms/ReflectometryReductionOneAuto-v2.rst @@ -149,8 +149,8 @@ Output: 0.00462 0.63441 0.41079 - 0.01248 - 0.00905 + 0.44792 + 0.23703 **Example - Basic reduction with a transmission run** @@ -175,8 +175,8 @@ Output: 0.00338 1.16756 0.89144 - 0.98439 - 1.00991 + 1.46655 + 1.41327 **Example - Reduction overriding some default values** @@ -200,8 +200,8 @@ Output: 0.00462 0.64241 0.41453 - 0.50007 - 0.48771 + 0.51029 + 0.52240 .. categories:: diff --git a/docs/source/release/v3.11.0/reflectometry.rst b/docs/source/release/v3.11.0/reflectometry.rst index e1285faf1b41ed364365edb12c4234c5c32acfb1..d407d50c8263edc57da6b3095bc84ac08c0aad8a 100644 --- a/docs/source/release/v3.11.0/reflectometry.rst +++ b/docs/source/release/v3.11.0/reflectometry.rst @@ -55,5 +55,13 @@ ISIS Reflectometry - Button disabled while reduction in process. Can be re-enabled by pausing autoreduction, where clicking 'autoreduce' again will continue processing rows. - Changing the instrument, investigation id or transfer method while paused and clicking 'autoreduce' will start a new autoreduction. +- The calculation of :math:`\frac{dQ}{Q}` has been fixed in line with the changes to the :ref:`algm-NRCalculateSlitResolution` algorithm. An additional bug has been fixed where :math:`\theta` was being passed to this algorithm instead of :math:`2\theta`. + + +ISIS Reflectometry (Old) +######################## + +- The calculation of :math:`\frac{dQ}{Q}` has been fixed in line with the changes to the :ref:`algm-NRCalculateSlitResolution` algorithm. An additional bug has been fixed where :math:`\theta` was being passed to this algorithm instead of :math:`2\theta`. + `Full list of changes on github <http://github.com/mantidproject/mantid/pulls?q=is%3Apr+milestone%3A%22Release+3.11%22+is%3Amerged+label%3A%22Component%3A+Reflectometry%22>`__ diff --git a/qt/scientific_interfaces/ISISReflectometry/ReflGenericDataProcessorPresenterFactory.cpp b/qt/scientific_interfaces/ISISReflectometry/ReflGenericDataProcessorPresenterFactory.cpp index 246b8fecfc7d3190c3fb5138217b671e3f69887e..483890a61f880427ccf33b300efb47920ce40ae3 100644 --- a/qt/scientific_interfaces/ISISReflectometry/ReflGenericDataProcessorPresenterFactory.cpp +++ b/qt/scientific_interfaces/ISISReflectometry/ReflGenericDataProcessorPresenterFactory.cpp @@ -59,7 +59,8 @@ ReflGenericDataProcessorPresenterFactory::create() { whitelist.addElement( "dQ/Q", "MomentumTransferStep", "<b>Resolution used when rebinning</b><br /><i>optional</i><br />If " - "left blank, this is calculated for you using the CalculateResolution " + "left blank, this is calculated for you using the " + "NRCalculateSlitResolution " "algorithm. <br /><br /><b>Example:</b> <samp>0.9</samp>"); whitelist.addElement( "Scale", "ScaleFactor", diff --git a/scripts/Interface/ui/reflectometer/refl_gui.py b/scripts/Interface/ui/reflectometer/refl_gui.py index dbbaf544b7833fd6b44a33b33c0f8bfe6d54d9a1..3a4456f7db37f2ca1d3ae70dffac56dfefc6d26f 100644 --- a/scripts/Interface/ui/reflectometer/refl_gui.py +++ b/scripts/Interface/ui/reflectometer/refl_gui.py @@ -745,27 +745,29 @@ class ReflGui(QtGui.QMainWindow, Ui_windowRefl): else: Load(Filename=runno[0], OutputWorkspace="_run") loadedRun = mtd["_run"] - two_theta_str = str(self.tableMain.item(row, 1).text()) + theta_in_str = str(self.tableMain.item(row, 1).text()) try: - two_theta = None - if len(two_theta_str) > 0: - two_theta = float(two_theta_str) + theta_in = None + if len(theta_in_str) > 0: + theta_in = float(theta_in_str) # Make sure we only ever run calculate resolution on a non-group workspace. # If we're given a group workspace, we can just run it on the first member of the group instead thetaRun = loadedRun if isinstance(thetaRun, WorkspaceGroup): thetaRun = thetaRun[0] - dqq, two_theta = CalculateResolution(Workspace=thetaRun, TwoTheta=two_theta) + if not theta_in: + theta_in = getLogValue(thetaRun, "Theta") + dqq = NRCalculateSlitResolution(Workspace=thetaRun, TwoTheta=2*theta_in) # Put the calculated resolution into the table resItem = QtGui.QTableWidgetItem() resItem.setText(str(dqq)) self.tableMain.setItem(row, 15, resItem) - # Update the value for two_theta in the table + # Update the value for theta_in in the table ttItem = QtGui.QTableWidgetItem() - ttItem.setText(str(two_theta)) + ttItem.setText(str(theta_in)) self.tableMain.setItem(row, 1, ttItem) logger.notice("Calculated resolution: " + str(dqq)) @@ -778,7 +780,7 @@ class ReflGui(QtGui.QMainWindow, Ui_windowRefl): else: dqq = float(self.tableMain.item(row, 15).text()) - # Check secondary and tertiary two_theta columns, if they're + # Check secondary and tertiary theta_in columns, if they're # blank and their corresponding run columns are set, fill them. for run_col in [5, 10]: tht_col = run_col + 1