diff --git a/Framework/Algorithms/inc/MantidAlgorithms/RunCombinationHelpers/RunCombinationHelper.h b/Framework/Algorithms/inc/MantidAlgorithms/RunCombinationHelpers/RunCombinationHelper.h index 7093a030439be1cc9dd394771052b7b2cbbb0d51..3b2e9a7eebcc2d1e217af5a965b036efef6f9b08 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/RunCombinationHelpers/RunCombinationHelper.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/RunCombinationHelpers/RunCombinationHelper.h @@ -64,6 +64,7 @@ private: std::string m_instrumentName; bool m_isHistogramData; bool m_isScanning; + std::vector<bool> m_hasDx; }; } // namespace Algorithms diff --git a/Framework/Algorithms/src/ConjoinXRuns.cpp b/Framework/Algorithms/src/ConjoinXRuns.cpp index fa9504834ad4f8b10e3a1595a7a14465916e881d..99b7bf058ff419a315a2fe586997b0fca3c671f7 100644 --- a/Framework/Algorithms/src/ConjoinXRuns.cpp +++ b/Framework/Algorithms/src/ConjoinXRuns.cpp @@ -10,6 +10,10 @@ #include "MantidAlgorithms/RunCombinationHelpers/RunCombinationHelper.h" #include "MantidAlgorithms/RunCombinationHelpers/SampleLogsBehaviour.h" #include "MantidGeometry/Instrument.h" +#include "MantidHistogramData/HistogramDx.h" +#include "MantidHistogramData/HistogramE.h" +#include "MantidHistogramData/HistogramX.h" +#include "MantidHistogramData/HistogramY.h" #include "MantidKernel/ArrayProperty.h" #include "MantidKernel/Exception.h" #include "MantidKernel/ListValidator.h" @@ -271,28 +275,32 @@ void ConjoinXRuns::fillHistory() { * @param wsIndex : the workspace index */ void ConjoinXRuns::joinSpectrum(int64_t wsIndex) { - std::vector<double> spectrum; - std::vector<double> errors; - std::vector<double> axis; + std::vector<double> spectrum, errors, axis, x, xerrors; spectrum.reserve(m_outWS->blocksize()); errors.reserve(m_outWS->blocksize()); axis.reserve(m_outWS->blocksize()); size_t index = static_cast<size_t>(wsIndex); - for (const auto &input : m_inputWS) { - auto y = input->y(index).rawData(); - auto e = input->e(index).rawData(); - std::vector<double> x; + HistogramData::HistogramY y = input->y(index); + spectrum.insert(spectrum.end(), y.begin(), y.end()); + auto e = input->e(index); + errors.insert(errors.end(), e.begin(), e.end()); if (m_logEntry.empty()) { - x = input->x(index).rawData(); + auto x = input->x(index); + axis.insert(axis.end(), x.begin(), x.end()); } else { x = m_axisCache[input->getName()]; + axis.insert(axis.end(), x.begin(), x.end()); + } + if (input->hasDx(index)) { + auto dx = input->dx(index); + xerrors.insert(xerrors.end(), dx.begin(), dx.end()); } - spectrum.insert(spectrum.end(), y.begin(), y.end()); - errors.insert(errors.end(), e.begin(), e.end()); - axis.insert(axis.end(), x.begin(), x.end()); } - + if (!xerrors.empty()) { + m_outWS->setPointStandardDeviations(index, m_outWS->blocksize()); + m_outWS->mutableDx(index) = xerrors; + } m_outWS->mutableY(index) = spectrum; m_outWS->mutableE(index) = errors; m_outWS->mutableX(index) = axis; diff --git a/Framework/Algorithms/src/RunCombinationHelpers/RunCombinationHelper.cpp b/Framework/Algorithms/src/RunCombinationHelpers/RunCombinationHelper.cpp index adde7248cd6b49cd7d33761001365862c8b6e500..4f8ae81b93dc3130e2744df0dec37505e93362a3 100644 --- a/Framework/Algorithms/src/RunCombinationHelpers/RunCombinationHelper.cpp +++ b/Framework/Algorithms/src/RunCombinationHelpers/RunCombinationHelper.cpp @@ -54,6 +54,11 @@ void RunCombinationHelper::setReferenceProperties(MatrixWorkspace_sptr ref) { m_isHistogramData = ref->isHistogramData(); m_isScanning = ref->detectorInfo().isScanning(); m_instrumentName = ref->getInstrument()->getName(); + if (m_numberSpectra) { + m_hasDx.reserve(m_numberSpectra); + for (unsigned int i = 0; i < m_numberSpectra; ++i) + m_hasDx.push_back(ref->hasDx(i)); + } } //---------------------------------------------------------------------------------------------- @@ -65,7 +70,7 @@ void RunCombinationHelper::setReferenceProperties(MatrixWorkspace_sptr ref) { std::string RunCombinationHelper::checkCompatibility(MatrixWorkspace_sptr ws, bool checkNumberHistograms) { - std::string errors = ""; + std::string errors; if (ws->getNumberHistograms() != m_numberSpectra && checkNumberHistograms) errors += "different number of histograms; "; if (ws->getAxis(0)->unit()->unitID() != m_xUnit) @@ -83,6 +88,16 @@ RunCombinationHelper::checkCompatibility(MatrixWorkspace_sptr ws, "detectors; "; if (ws->getInstrument()->getName() != m_instrumentName) errors += "different instrument names; "; + if (ws->getNumberHistograms() == m_numberSpectra) { + if (!m_hasDx.empty()) { + for (unsigned int i = 0; i < m_numberSpectra; ++i) { + if (m_hasDx[i] != ws->hasDx(i)) { + errors += "spectra must have either Dx values or not; "; + break; + } + } + } + } return errors; } diff --git a/Framework/Algorithms/test/ConjoinXRunsTest.h b/Framework/Algorithms/test/ConjoinXRunsTest.h index 8133133d9614ad865bb76317ee54976b307c5e5a..fd1e397fdc023c13b3409f3dc3fe9a8e0d96696f 100644 --- a/Framework/Algorithms/test/ConjoinXRunsTest.h +++ b/Framework/Algorithms/test/ConjoinXRunsTest.h @@ -8,15 +8,26 @@ #include "MantidAlgorithms/AddSampleLog.h" #include "MantidAlgorithms/AddTimeSeriesLog.h" #include "MantidAlgorithms/ConjoinXRuns.h" +#include "MantidHistogramData/Counts.h" +#include "MantidHistogramData/HistogramDx.h" +#include "MantidHistogramData/HistogramE.h" +#include "MantidHistogramData/HistogramX.h" +#include "MantidHistogramData/HistogramY.h" +#include "MantidHistogramData/Points.h" #include "MantidKernel/Unit.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" using Mantid::Algorithms::ConjoinXRuns; using Mantid::Algorithms::AddSampleLog; using Mantid::Algorithms::AddTimeSeriesLog; +using Mantid::HistogramData::Counts; +using Mantid::HistogramData::HistogramDx; +using Mantid::HistogramData::HistogramE; +using Mantid::HistogramData::HistogramX; +using Mantid::HistogramData::HistogramY; +using Mantid::HistogramData::Points; using namespace Mantid::API; using namespace WorkspaceCreationHelper; -using namespace Mantid::HistogramData; class ConjoinXRunsTest : public CxxTest::TestSuite { public: @@ -26,37 +37,33 @@ public: static void destroySuite(ConjoinXRunsTest *suite) { delete suite; } void setUp() override { - MatrixWorkspace_sptr ws1 = create2DWorkspace123(5, 3); // 3 points - MatrixWorkspace_sptr ws2 = create2DWorkspace154(5, 2); // 2 points - MatrixWorkspace_sptr ws3 = create2DWorkspace123(5, 1); // 1 point - MatrixWorkspace_sptr ws4 = create2DWorkspace154(5, 1); // 1 point - MatrixWorkspace_sptr ws5 = create2DWorkspace123(5, 3); // 3 points - MatrixWorkspace_sptr ws6 = create2DWorkspace123(5, 3); // 3 points - - ws1->getAxis(0)->setUnit("TOF"); - ws2->getAxis(0)->setUnit("TOF"); - ws3->getAxis(0)->setUnit("TOF"); - ws4->getAxis(0)->setUnit("TOF"); - ws5->getAxis(0)->setUnit("TOF"); - ws6->getAxis(0)->setUnit("TOF"); - - storeWS("ws1", ws1); - storeWS("ws2", ws2); - storeWS("ws3", ws3); - storeWS("ws4", ws4); - storeWS("ws5", ws5); - storeWS("ws6", ws6); - + std::vector<MatrixWorkspace_sptr> ws(6); + // Workspaces have 5 spectra must be point data, don't have masks and have + // dx + ws[0] = create2DWorkspace123(5, 3, false, std::set<int64_t>(), + true); // 3 points + ws[1] = create2DWorkspace154(5, 2, false, std::set<int64_t>(), + true); // 2 points + ws[2] = + create2DWorkspace123(5, 1, false, std::set<int64_t>(), true); // 1 point + ws[3] = + create2DWorkspace154(5, 1, false, std::set<int64_t>(), true); // 1 point + ws[4] = create2DWorkspace123(5, 3, false, std::set<int64_t>(), + true); // 3 points + ws[5] = create2DWorkspace123(5, 3, false, std::set<int64_t>(), + true); // 3 points m_testWS = {"ws1", "ws2", "ws3", "ws4", "ws5", "ws6"}; + + for (unsigned int i = 0; i < ws.size(); ++i) { + ws[i]->getAxis(0)->setUnit("TOF"); + storeWS(m_testWS[i], ws[i]); + } } void tearDown() override { - removeWS("ws1"); - removeWS("ws2"); - removeWS("ws3"); - removeWS("ws4"); - removeWS("ws5"); - removeWS("ws6"); + for (unsigned int i = 0; i < m_testWS.size(); ++i) { + removeWS(m_testWS[i]); + } m_testWS.clear(); } @@ -80,34 +87,43 @@ public: TS_ASSERT_EQUALS(out->blocksize(), 7); TS_ASSERT(!out->isHistogramData()); TS_ASSERT_EQUALS(out->getAxis(0)->unit()->unitID(), "TOF"); + std::vector<double> x{1., 2., 3., 1., 2., 1., 1.}; + std::vector<double> y{2., 2., 2., 5., 5., 2., 5.}; + std::vector<double> e{3., 3., 3., 4., 4., 3., 4.}; + TS_ASSERT_EQUALS(out->x(0).rawData(), x); + TS_ASSERT_EQUALS(out->y(0).rawData(), y); + TS_ASSERT_EQUALS(out->e(0).rawData(), e); + TSM_ASSERT_EQUALS("Dx and y values are the same", out->dx(0).rawData(), y); + } + + void testWSWithoutDxValues() { + // Workspaces have 5 spectra must be point data + MatrixWorkspace_sptr ws0 = create2DWorkspace123(5, 3); // 3 points + MatrixWorkspace_sptr ws1 = create2DWorkspace154(5, 2); // 2 points + ws0->getAxis(0)->setUnit("TOF"); + ws1->getAxis(0)->setUnit("TOF"); + storeWS("ws_0", ws0); + storeWS("ws_1", ws1); + m_testee.setProperty("InputWorkspaces", + std::vector<std::string>{"ws_0", "ws_1"}); + m_testee.setProperty("OutputWorkspace", "out"); + TS_ASSERT_THROWS_NOTHING(m_testee.execute()); + TS_ASSERT(m_testee.isExecuted()); + + MatrixWorkspace_sptr out = + AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>("out"); - std::vector<double> spectrum = out->y(0).rawData(); - std::vector<double> error = out->e(0).rawData(); - std::vector<double> xaxis = out->x(0).rawData(); - - TS_ASSERT_EQUALS(spectrum[0], 2.); - TS_ASSERT_EQUALS(spectrum[1], 2.); - TS_ASSERT_EQUALS(spectrum[2], 2.); - TS_ASSERT_EQUALS(spectrum[3], 5.); - TS_ASSERT_EQUALS(spectrum[4], 5.); - TS_ASSERT_EQUALS(spectrum[5], 2.); - TS_ASSERT_EQUALS(spectrum[6], 5.); - - TS_ASSERT_EQUALS(error[0], 3.); - TS_ASSERT_EQUALS(error[1], 3.); - TS_ASSERT_EQUALS(error[2], 3.); - TS_ASSERT_EQUALS(error[3], 4.); - TS_ASSERT_EQUALS(error[4], 4.); - TS_ASSERT_EQUALS(error[5], 3.); - TS_ASSERT_EQUALS(error[6], 4.); - - TS_ASSERT_EQUALS(xaxis[0], 1.); - TS_ASSERT_EQUALS(xaxis[1], 2.); - TS_ASSERT_EQUALS(xaxis[2], 3.); - TS_ASSERT_EQUALS(xaxis[3], 1.); - TS_ASSERT_EQUALS(xaxis[4], 2.); - TS_ASSERT_EQUALS(xaxis[5], 1.); - TS_ASSERT_EQUALS(xaxis[6], 1.); + TS_ASSERT(out); + TS_ASSERT_EQUALS(out->getNumberHistograms(), 5); + TS_ASSERT_EQUALS(out->blocksize(), 5); + TS_ASSERT(!out->isHistogramData()); + TS_ASSERT_EQUALS(out->getAxis(0)->unit()->unitID(), "TOF"); + std::vector<double> x{1., 2., 3., 1., 2.}; + std::vector<double> y{2., 2., 2., 5., 5.}; + std::vector<double> e{3., 3., 3., 4., 4.}; + TS_ASSERT_EQUALS(out->x(0).rawData(), x); + TS_ASSERT_EQUALS(out->y(0).rawData(), y); + TS_ASSERT_EQUALS(out->e(0).rawData(), e); } void testFailDifferentNumberBins() { @@ -127,9 +143,11 @@ public: MatrixWorkspace_sptr ws6 = AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>("ws6"); - Counts counts{{4, 9, 16}}; - Points points{{0.4, 0.9, 1.1}}; - ws6->setHistogram(3, points, counts); + for (auto i = 0; i < 5; + i++) { // modify all 5 spectra of ws6 in terms of y and x + ws6->mutableY(i) = {4., 9., 16.}; + ws6->mutableX(i) = {0.4, 0.9, 1.1}; + } m_testee.setProperty("InputWorkspaces", std::vector<std::string>{"ws1", "ws6"}); @@ -146,55 +164,17 @@ public: TS_ASSERT(!out->isHistogramData()); TS_ASSERT_EQUALS(out->getAxis(0)->unit()->unitID(), "TOF"); - auto spectrum0 = out->y(0).rawData(); - auto error0 = out->e(0).rawData(); - auto xaxis0 = out->x(0).rawData(); - - TS_ASSERT_EQUALS(spectrum0[0], 2.); - TS_ASSERT_EQUALS(spectrum0[1], 2.); - TS_ASSERT_EQUALS(spectrum0[2], 2.); - TS_ASSERT_EQUALS(spectrum0[3], 2.); - TS_ASSERT_EQUALS(spectrum0[4], 2.); - TS_ASSERT_EQUALS(spectrum0[5], 2.); - - TS_ASSERT_EQUALS(error0[0], 3.); - TS_ASSERT_EQUALS(error0[1], 3.); - TS_ASSERT_EQUALS(error0[2], 3.); - TS_ASSERT_EQUALS(error0[3], 3.); - TS_ASSERT_EQUALS(error0[4], 3.); - TS_ASSERT_EQUALS(error0[5], 3.); - - TS_ASSERT_EQUALS(xaxis0[0], 1.); - TS_ASSERT_EQUALS(xaxis0[1], 2.); - TS_ASSERT_EQUALS(xaxis0[2], 3.); - TS_ASSERT_EQUALS(xaxis0[3], 1.); - TS_ASSERT_EQUALS(xaxis0[4], 2.); - TS_ASSERT_EQUALS(xaxis0[5], 3.); - - auto spectrum3 = out->y(3).rawData(); - auto error3 = out->e(3).rawData(); - auto xaxis3 = out->x(3).rawData(); - - TS_ASSERT_EQUALS(spectrum3[0], 2.); - TS_ASSERT_EQUALS(spectrum3[1], 2.); - TS_ASSERT_EQUALS(spectrum3[2], 2.); - TS_ASSERT_EQUALS(spectrum3[3], 4.); - TS_ASSERT_EQUALS(spectrum3[4], 9.); - TS_ASSERT_EQUALS(spectrum3[5], 16.); - - TS_ASSERT_EQUALS(error3[0], 3.); - TS_ASSERT_EQUALS(error3[1], 3.); - TS_ASSERT_EQUALS(error3[2], 3.); - TS_ASSERT_EQUALS(error3[3], 2.); - TS_ASSERT_EQUALS(error3[4], 3.); - TS_ASSERT_EQUALS(error3[5], 4.); - - TS_ASSERT_EQUALS(xaxis3[0], 1.); - TS_ASSERT_EQUALS(xaxis3[1], 2.); - TS_ASSERT_EQUALS(xaxis3[2], 3.); - TS_ASSERT_EQUALS(xaxis3[3], 0.4); - TS_ASSERT_EQUALS(xaxis3[4], 0.9); - TS_ASSERT_EQUALS(xaxis3[5], 1.1); + std::vector<double> x_vec{1., 2., 3., .4, .9, 1.1}; + std::vector<double> y_vec{2., 2., 2., 4., 9., 16.}; + std::vector<double> e_vec{3., 3., 3., 3., 3., 3.}; + std::vector<double> dx_vec{2., 2., 2., 2., 2., 2.}; + // Check all 5 spectra + for (auto i = 0; i < 5; i++) { + TS_ASSERT_EQUALS(out->y(i).rawData(), y_vec); + TS_ASSERT_EQUALS(out->e(i).rawData(), e_vec); + TS_ASSERT_EQUALS(out->x(i).rawData(), x_vec); + TS_ASSERT_EQUALS(out->dx(i).rawData(), dx_vec); + } } void testFailWithNumLog() { @@ -245,16 +225,12 @@ public: TS_ASSERT_EQUALS(out->getNumberHistograms(), 5); TS_ASSERT_EQUALS(out->getAxis(0)->unit()->unitID(), "Energy"); - std::vector<double> xaxis = out->x(0).rawData(); - std::vector<double> spectrum = out->y(0).rawData(); - std::vector<double> error = out->e(0).rawData(); - - TS_ASSERT_EQUALS(xaxis[0], 0.7); - TS_ASSERT_EQUALS(xaxis[1], 1.1); - TS_ASSERT_EQUALS(spectrum[0], 2.); - TS_ASSERT_EQUALS(spectrum[1], 5.); - TS_ASSERT_EQUALS(error[0], 3.); - TS_ASSERT_EQUALS(error[1], 4.); + TS_ASSERT_EQUALS(out->x(0)[0], 0.7); + TS_ASSERT_EQUALS(out->x(0)[1], 1.1); + TS_ASSERT_EQUALS(out->y(0)[0], 2.); + TS_ASSERT_EQUALS(out->y(0)[1], 5.); + TS_ASSERT_EQUALS(out->e(0)[0], 3.); + TS_ASSERT_EQUALS(out->e(0)[1], 4.); } void testFailWithStringLog() { @@ -315,27 +291,13 @@ public: TS_ASSERT_EQUALS(out->blocksize(), 5); TS_ASSERT_EQUALS(out->getNumberHistograms(), 5); - std::vector<double> spectrum = out->y(0).rawData(); - std::vector<double> xaxis = out->x(0).rawData(); - std::vector<double> error = out->e(0).rawData(); - - TS_ASSERT_EQUALS(spectrum[0], 2.); - TS_ASSERT_EQUALS(spectrum[1], 2.); - TS_ASSERT_EQUALS(spectrum[2], 2.); - TS_ASSERT_EQUALS(spectrum[3], 5.); - TS_ASSERT_EQUALS(spectrum[4], 5.); - - TS_ASSERT_EQUALS(error[0], 3.); - TS_ASSERT_EQUALS(error[1], 3.); - TS_ASSERT_EQUALS(error[2], 3.); - TS_ASSERT_EQUALS(error[3], 4.); - TS_ASSERT_EQUALS(error[4], 4.); - - TS_ASSERT_EQUALS(xaxis[0], 5.7); - TS_ASSERT_EQUALS(xaxis[1], 6.1); - TS_ASSERT_EQUALS(xaxis[2], 6.7); - TS_ASSERT_EQUALS(xaxis[3], 8.3); - TS_ASSERT_EQUALS(xaxis[4], 9.5); + std::vector<double> y_vec{2., 2., 2., 5., 5.}; + std::vector<double> x_vec{5.7, 6.1, 6.7, 8.3, 9.5}; + std::vector<double> e_vec{3., 3., 3., 4., 4.}; + TS_ASSERT_EQUALS(out->y(0).rawData(), y_vec); + TS_ASSERT_EQUALS(out->x(0).rawData(), x_vec); + TS_ASSERT_EQUALS(out->e(0).rawData(), e_vec); + TS_ASSERT_EQUALS(out->dx(0).rawData(), y_vec) } void testFailWithNumSeriesLog() { @@ -402,7 +364,8 @@ public: void setUp() override { m_ws.reserve(100); for (size_t i = 0; i < 100; ++i) { - MatrixWorkspace_sptr ws = create2DWorkspace123(10000, 100); + MatrixWorkspace_sptr ws = + create2DWorkspace123(2000, 100, false, std::set<int64_t>(), true); std::string name = "ws" + std::to_string(i); storeWS(name, ws); m_ws.push_back(name); diff --git a/Framework/Algorithms/test/ConvertToPointDataTest.h b/Framework/Algorithms/test/ConvertToPointDataTest.h index d9f2963fa683b27883395ee001fb817b272101e1..33a2a42f94137f5a76665ef3f902fb2bde5ab1cf 100644 --- a/Framework/Algorithms/test/ConvertToPointDataTest.h +++ b/Framework/Algorithms/test/ConvertToPointDataTest.h @@ -13,8 +13,6 @@ using Mantid::API::IAlgorithm_sptr; using Mantid::API::MatrixWorkspace; using Mantid::API::MatrixWorkspace_sptr; using Mantid::DataObjects::Workspace2D_sptr; -using Mantid::HistogramData::HistogramDx; -using Mantid::Kernel::make_cow; class ConvertToPointDataTest : public CxxTest::TestSuite { @@ -106,8 +104,9 @@ public: double xBoundaries[11] = {0.0, 1.0, 3.0, 5.0, 6.0, 7.0, 10.0, 13.0, 16.0, 17.0, 17.5}; const int numSpectra(2); - Workspace2D_sptr testWS = WorkspaceCreationHelper::create2DWorkspaceBinned( - numSpectra, 11, xBoundaries); + Workspace2D_sptr testWS = + WorkspaceCreationHelper::create2DWorkspaceNonUniformlyBinned( + numSpectra, 11, xBoundaries); const size_t numBins = testWS->blocksize(); TS_ASSERT_EQUALS(testWS->isHistogramData(), true); @@ -147,14 +146,12 @@ public: double xBoundaries[numBins] = {0.0, 1.0, 3.0, 5.0, 6.0, 7.0, 10.0, 13.0, 16.0, 17.0, 17.5}; constexpr int numSpectra{2}; - Workspace2D_sptr testWS = WorkspaceCreationHelper::create2DWorkspaceBinned( - numSpectra, numBins, xBoundaries); + Workspace2D_sptr testWS = + WorkspaceCreationHelper::create2DWorkspaceNonUniformlyBinned( + numSpectra, numBins, xBoundaries, true); TS_ASSERT(testWS->isHistogramData()) double xErrors[numBins - 1] = {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0}; - auto dxs = make_cow<HistogramDx>(xErrors, xErrors + numBins - 1); - testWS->setSharedDx(0, dxs); - testWS->setSharedDx(1, dxs); MatrixWorkspace_sptr outputWS = runAlgorithm(testWS); TS_ASSERT(outputWS) TS_ASSERT(!outputWS->isHistogramData()) @@ -163,7 +160,7 @@ public: const auto &dx = outputWS->dx(i); TS_ASSERT_EQUALS(dx.size(), numBins - 1) for (size_t j = 0; j < dx.size(); ++j) { - TS_ASSERT_EQUALS(dx[j], xErrors[j]) + TS_ASSERT_DELTA(dx[j], xErrors[j], 1E-16); } } } diff --git a/Framework/Algorithms/test/CopyInstrumentParametersTest.h b/Framework/Algorithms/test/CopyInstrumentParametersTest.h index 6109c023b2a07f06eedd00f32a98864ad31746be..4a5b449f498d632b0680169d54022ead2d385197 100644 --- a/Framework/Algorithms/test/CopyInstrumentParametersTest.h +++ b/Framework/Algorithms/test/CopyInstrumentParametersTest.h @@ -3,32 +3,25 @@ #include <cxxtest/TestSuite.h> -#include "MantidDataHandling/LoadInstrument.h" -#include "MantidAPI/IAlgorithm.h" #include "MantidAlgorithms/CopyInstrumentParameters.h" -#include "MantidAPI/Workspace.h" -#include "MantidDataObjects/Workspace2D.h" -#include "MantidGeometry/Instrument/DetectorInfo.h" +#include "MantidAPI/AnalysisDataService.h" +#include "MantidAPI/IAlgorithm.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidAPI/SpectrumInfo.h" #include "MantidAPI/WorkspaceFactory.h" -#include "WorkspaceCreationHelperTest.h" -#include "MantidAPI/AnalysisDataService.h" -#include "MantidAPI/ITableWorkspace.h" -#include "MantidAPI/TableRow.h" #include "MantidKernel/V3D.h" #include "MantidGeometry/Instrument.h" #include "MantidGeometry/Instrument/Component.h" -#include "MantidDataHandling/LoadEmptyInstrument.h" +#include "MantidGeometry/Instrument/DetectorInfo.h" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include <cmath> #include <stdexcept> using namespace Mantid::Algorithms; using namespace Mantid::API; -using namespace Mantid::Kernel; -using namespace Mantid::DataObjects; -using Mantid::Geometry::IDetector_const_sptr; -using Mantid::Geometry::IComponent_const_sptr; +using Mantid::Geometry::Instrument_const_sptr; +using Mantid::Geometry::ParameterMap; +using Mantid::Kernel::V3D; class CopyInstrumentParametersTest : public CxxTest::TestSuite { public: @@ -62,10 +55,10 @@ public: TS_ASSERT_THROWS_NOTHING( copyInstParam.setPropertyValue("OutputWorkspace", wsName2)); // Get instrument of input workspace and move some detectors - Geometry::ParameterMap *pmap; + ParameterMap *pmap; pmap = &(ws1->instrumentParameters()); auto &detectorInfoWs1 = ws1->mutableDetectorInfo(); - Geometry::Instrument_const_sptr instrument = ws1->getInstrument(); + Instrument_const_sptr instrument = ws1->getInstrument(); detectorInfoWs1.setPosition(0, V3D(6.0, 0.0, 0.7)); detectorInfoWs1.setPosition(1, V3D(6.0, 0.1, 0.7)); @@ -119,8 +112,8 @@ public: AnalysisDataServiceImpl &dataStore = AnalysisDataService::Instance(); dataStore.add(wsName1, ws1); - Geometry::Instrument_const_sptr instrument = ws1->getInstrument(); - Geometry::ParameterMap *pmap; + Instrument_const_sptr instrument = ws1->getInstrument(); + ParameterMap *pmap; pmap = &(ws1->instrumentParameters()); // add auxiliary instrument parameters pmap->addDouble(instrument.get(), "Ei", 100); @@ -218,8 +211,8 @@ public: AnalysisDataServiceImpl &dataStore = AnalysisDataService::Instance(); dataStore.add(m_SourceWSName, ws1); - Geometry::Instrument_const_sptr instrument = ws1->getInstrument(); - Geometry::ParameterMap *pmap; + Instrument_const_sptr instrument = ws1->getInstrument(); + ParameterMap *pmap; pmap = &(ws1->instrumentParameters()); for (size_t i = 0; i < n_Parameters; i++) { // add auxiliary instrument parameters @@ -230,7 +223,8 @@ public: // calibrate detectors; auto &detectorInfo = ws1->mutableDetectorInfo(); for (size_t i = 0; i < n_detectors; i++) { - auto detIndex = detectorInfo.indexOf(static_cast<Mantid::detid_t>(i + 1)); + size_t detIndex = + detectorInfo.indexOf(static_cast<Mantid::detid_t>(i + 1)); detectorInfo.setPosition( detIndex, V3D(sin(M_PI * double(i)), cos(M_PI * double(i / 500)), 7)); } @@ -270,7 +264,7 @@ public: AnalysisDataServiceImpl &dataStore = AnalysisDataService::Instance(); MatrixWorkspace_sptr ws2 = - dataStore.retrieveWS<API::MatrixWorkspace>(m_TargetWSName); + dataStore.retrieveWS<MatrixWorkspace>(m_TargetWSName); auto instr2 = ws2->getInstrument(); auto param_names = instr2->getParameterNames(); diff --git a/Framework/Algorithms/test/MergeRunsTest.h b/Framework/Algorithms/test/MergeRunsTest.h index bbdde628d2bbd91664c7e438943547a8b0530bce..a895e35e8d63a90189ea519d0595e90f03181e12 100644 --- a/Framework/Algorithms/test/MergeRunsTest.h +++ b/Framework/Algorithms/test/MergeRunsTest.h @@ -3,25 +3,21 @@ #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include <cxxtest/TestSuite.h> -#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include <stdarg.h> #include "MantidAPI/AnalysisDataService.h" #include "MantidGeometry/Instrument/DetectorInfo.h" #include "MantidAPI/SpectrumInfo.h" -#include "MantidAPI/WorkspaceGroup.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidAPI/WorkspaceGroup.h" #include "MantidAlgorithms/GroupWorkspaces.h" #include "MantidAlgorithms/MergeRuns.h" -#include "MantidAlgorithms/GroupWorkspaces.h" #include "MantidAlgorithms/Rebin.h" #include "MantidGeometry/Instrument.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidKernel/TimeSeriesProperty.h" #include <boost/make_shared.hpp> #include <boost/shared_ptr.hpp> -#include <boost/make_shared.hpp> #include <MantidAlgorithms/RunCombinationHelpers/RunCombinationHelper.h> #include <MantidAlgorithms/RunCombinationHelpers/SampleLogsBehaviour.h> #include "MantidTypes/SpectrumDefinition.h" @@ -305,17 +301,17 @@ public: MergeRunsTest() { AnalysisDataService::Instance().add( - "in1", WorkspaceCreationHelper::create2DWorkspaceBinned(3, 10, 1)); + "in1", WorkspaceCreationHelper::create2DWorkspaceBinned(3, 10, 1.)); AnalysisDataService::Instance().add( - "in2", WorkspaceCreationHelper::create2DWorkspaceBinned(3, 10, 1)); + "in2", WorkspaceCreationHelper::create2DWorkspaceBinned(3, 10, 1.)); AnalysisDataService::Instance().add( - "in3", WorkspaceCreationHelper::create2DWorkspaceBinned(3, 10, 1)); + "in3", WorkspaceCreationHelper::create2DWorkspaceBinned(3, 10, 1.)); AnalysisDataService::Instance().add( - "in4", WorkspaceCreationHelper::create2DWorkspaceBinned(3, 5, 20)); + "in4", WorkspaceCreationHelper::create2DWorkspaceBinned(3, 5, 20.)); AnalysisDataService::Instance().add( - "in5", WorkspaceCreationHelper::create2DWorkspaceBinned(3, 5, 3.5, 2)); + "in5", WorkspaceCreationHelper::create2DWorkspaceBinned(3, 5, 3.5, 2.)); AnalysisDataService::Instance().add( - "in6", WorkspaceCreationHelper::create2DWorkspaceBinned(3, 3, 2, 2)); + "in6", WorkspaceCreationHelper::create2DWorkspaceBinned(3, 3, 2., 2.)); } void checkOutput(std::string wsname) { diff --git a/Framework/Algorithms/test/RunCombinationHelperTest.h b/Framework/Algorithms/test/RunCombinationHelperTest.h index 3545278c02b8566f13f1ef4bde72be731ae3138d..154f72f6e45db91f3c45b0b4f9cf854e5b245218 100644 --- a/Framework/Algorithms/test/RunCombinationHelperTest.h +++ b/Framework/Algorithms/test/RunCombinationHelperTest.h @@ -9,15 +9,18 @@ #include "MantidAPI/Axis.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidGeometry/Instrument/DetectorInfo.h" +#include "MantidHistogramData/HistogramDx.h" #include "MantidAlgorithms/CreateSampleWorkspace.h" #include "MantidAlgorithms/GroupWorkspaces.h" #include "MantidKernel/UnitFactory.h" +#include "MantidKernel/make_cow.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" using Mantid::Algorithms::RunCombinationHelper; using Mantid::Algorithms::GroupWorkspaces; using Mantid::Algorithms::CreateSampleWorkspace; using namespace Mantid::API; +using namespace Mantid::HistogramData; using namespace Mantid::Kernel; using namespace WorkspaceCreationHelper; @@ -122,6 +125,16 @@ public: "different X units; different spectrum axis units; "); } + void testIncompatibleDx() { + // create a workspace where spectrum 1 has Dx + MatrixWorkspace_sptr ws2 = m_reference->clone(); + auto dx = + Mantid::Kernel::make_cow<Mantid::HistogramData::HistogramDx>(3, 0.2); + ws2->setSharedDx(1, dx); + TS_ASSERT_EQUALS(m_testee.checkCompatibility(ws2), + "spectra must have either Dx values or not; "); + } + void test_scanning_workspaces_throw_no_error() { const auto scanWS1 = createSampleScanningWorkspace(2); const auto scanWS2 = createSampleScanningWorkspace(2); diff --git a/Framework/Algorithms/test/WorkspaceCreationHelperTest.h b/Framework/Algorithms/test/WorkspaceCreationHelperTest.h index f56173e6a3f265fb1237bd961ed00aa21cbe32b5..e788871524e4bfade6d5977e735470f3d60f3c72 100644 --- a/Framework/Algorithms/test/WorkspaceCreationHelperTest.h +++ b/Framework/Algorithms/test/WorkspaceCreationHelperTest.h @@ -1,14 +1,9 @@ #ifndef MANTID_ALGORITHMS_WORKSPACECREATIONHELPERTEST_H_ #define MANTID_ALGORITHMS_WORKSPACECREATIONHELPERTEST_H_ -#include "MantidKernel/System.h" -#include "MantidKernel/Timer.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include <cxxtest/TestSuite.h> -#include "MantidAPI/SpectraDetectorTypes.h" -using namespace Mantid; -using namespace Mantid::API; using namespace Mantid::DataObjects; /** Test class for the helpers in MantidTestHelpers/WorkspaceCreationHelper.h */ @@ -36,6 +31,19 @@ public: TS_ASSERT(ws->getSpectrum(0).hasDetectorID(100)); TS_ASSERT(ws->getSpectrum(1).hasDetectorID(101)); } + + void test_create2DWorkspaceWithValues() { + Workspace2D_sptr ws = WorkspaceCreationHelper::create2DWorkspace123( + 1, 2, false, std::set<int64_t>(), true); + TS_ASSERT(ws); + TS_ASSERT_EQUALS(ws->getNumberHistograms(), 1); + TS_ASSERT_EQUALS(ws->size(), 2); + TS_ASSERT(ws->hasDx(0)); + TS_ASSERT_EQUALS(ws->dx(0).rawData()[0], 2.); + Workspace2D_sptr ws2 = WorkspaceCreationHelper::create2DWorkspace123( + 1, 2, false, std::set<int64_t>(), false); + TS_ASSERT(!ws2->hasDx(0)); + } }; #endif /* MANTID_ALGORITHMS_WORKSPACECREATIONHELPERTEST_H_ */ diff --git a/Framework/Crystal/test/SCDCalibratePanelsTest.h b/Framework/Crystal/test/SCDCalibratePanelsTest.h index 68b8026d4f6d0a59a632744f00e868dd3b0e4478..3113192c978c7ba6de20ae2428dbcb9e1a8acd58 100644 --- a/Framework/Crystal/test/SCDCalibratePanelsTest.h +++ b/Framework/Crystal/test/SCDCalibratePanelsTest.h @@ -17,7 +17,6 @@ using namespace Mantid::DataObjects; using namespace std; using namespace Mantid::Geometry; using namespace Mantid::Kernel; -using namespace Mantid::Geometry; using namespace Mantid::Crystal; class SCDCalibratePanelsTest : public CxxTest::TestSuite { diff --git a/Framework/DataHandling/test/MaskDetectorsTest.h b/Framework/DataHandling/test/MaskDetectorsTest.h index a23e6800cf403ec0dc631646f78a6790c550042e..caee36084d2b7066b68d67be6dd327de4fbb36d0 100644 --- a/Framework/DataHandling/test/MaskDetectorsTest.h +++ b/Framework/DataHandling/test/MaskDetectorsTest.h @@ -668,7 +668,7 @@ public: // Make workspace to act as mask const auto numMaskWSSpec = inputWS->getInstrument()->getNumberDetectors(); auto maskWs = WorkspaceCreationHelper::create2DWorkspaceBinned( - static_cast<int>(numMaskWSSpec), 1, 0, 0); + static_cast<int>(numMaskWSSpec), 1, 0., 0.); maskWs->setInstrument(inputWS->getInstrument()); for (size_t i = 0; i < maskWs->getNumberHistograms(); ++i) { maskWs->mutableY(i)[0] = 1.0; @@ -736,7 +736,7 @@ public: // Make workspace to act as mask const auto numMaskWSSpec = inputWS->getInstrument()->getNumberDetectors(); auto maskWs = WorkspaceCreationHelper::create2DWorkspaceBinned( - static_cast<int>(numMaskWSSpec), 1, 0, 0); + static_cast<int>(numMaskWSSpec), 1, 0., 0.); maskWs->setInstrument(inputWS->getInstrument()); for (size_t i = 0; i < maskWs->getNumberHistograms(); ++i) { maskWs->mutableY(i)[0] = 1.0; diff --git a/Framework/TestHelpers/inc/MantidTestHelpers/WorkspaceCreationHelper.h b/Framework/TestHelpers/inc/MantidTestHelpers/WorkspaceCreationHelper.h index b49022e4ae06281ec0d877d17aa5b09efc022b14..516e70ebfc2fcfa29f0c5b67db71fe0bb47336cb 100644 --- a/Framework/TestHelpers/inc/MantidTestHelpers/WorkspaceCreationHelper.h +++ b/Framework/TestHelpers/inc/MantidTestHelpers/WorkspaceCreationHelper.h @@ -135,10 +135,12 @@ Mantid::DataObjects::Workspace2D_sptr create2DWorkspaceWhereYIsWorkspaceIndex(int nhist, int numBoundaries); Mantid::DataObjects::Workspace2D_sptr create2DWorkspace123( int64_t nHist, int64_t nBins, bool isHist = false, - const std::set<int64_t> &maskedWorkspaceIndices = std::set<int64_t>()); + const std::set<int64_t> &maskedWorkspaceIndices = std::set<int64_t>(), + bool hasDx = false); Mantid::DataObjects::Workspace2D_sptr create2DWorkspace154( int64_t nHist, int64_t nBins, bool isHist = false, - const std::set<int64_t> &maskedWorkspaceIndices = std::set<int64_t>()); + const std::set<int64_t> &maskedWorkspaceIndices = std::set<int64_t>(), + bool hasDx = false); Mantid::DataObjects::Workspace2D_sptr create2DWorkspaceWithValuesAndXerror( int64_t nHist, int64_t nBins, bool isHist, double xVal, double yVal, double eVal, double dxVal, @@ -164,8 +166,9 @@ create2DWorkspaceBinned(int nhist, int numVals, double x0 = 0.0, * Filled with Y = 2.0 and E = sqrt(2.0)w */ Mantid::DataObjects::Workspace2D_sptr -create2DWorkspaceBinned(int nhist, const int numBoundaries, - const double xBoundaries[]); +create2DWorkspaceNonUniformlyBinned(int nhist, const int numBoundaries, + const double xBoundaries[], + bool hasDx = false); struct returnOne { double operator()(const double, size_t) { return 1; } @@ -228,7 +231,8 @@ void addNoise(Mantid::API::MatrixWorkspace_sptr ws, double noise, Mantid::DataObjects::Workspace2D_sptr create2DWorkspaceWithFullInstrument( int nhist, int nbins, bool includeMonitors = false, bool startYNegative = false, bool isHistogram = true, - const std::string &instrumentName = std::string("testInst")); + const std::string &instrumentName = std::string("testInst"), + bool hasDx = false); /** * Create a workspace as for create2DWorkspaceWithFullInstrument, but including diff --git a/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp b/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp index efa55cce50024e36445b7742e0e7b1f4f53c7b6e..bd6dbfe1d9601af31ad07a0bb3f1eb5da57d779b 100644 --- a/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp +++ b/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp @@ -30,12 +30,14 @@ #include "MantidGeometry/Instrument/ReferenceFrame.h" #include "MantidGeometry/Objects/ShapeFactory.h" #include "MantidHistogramData/LinearGenerator.h" +#include "MantidHistogramData/HistogramDx.h" #include "MantidIndexing/IndexInfo.h" #include "MantidKernel/MersenneTwister.h" #include "MantidKernel/OptionalBool.h" #include "MantidKernel/TimeSeriesProperty.h" #include "MantidKernel/UnitFactory.h" #include "MantidKernel/VectorHelper.h" +#include "MantidKernel/make_cow.h" #include "MantidKernel/make_unique.h" #include "MantidKernel/V3D.h" @@ -195,20 +197,36 @@ Workspace2D_sptr create2DWorkspaceThetaVsTOF(int nHist, int nBins) { return outputWS; } +/** + * @brief create2DWorkspaceWithValues + * @param nHist :: Number of spectra + * @param nBins :: Number of points (not bin edges!) + * @param isHist :: Flag if it is a histogram or point data + * @param maskedWorkspaceIndices :: Mask workspace indices + * @param xVal :: bin edge or point + * @param yVal :: y value + * @param eVal :: error values + * @param hasDx :: wether workspace has dx values defined (default is false) + * @return A workspace filled with nBins bins or points and nHist spectra of the + * values yVal and the error eVal as well as Dx values which are copies of the y + * values + */ Workspace2D_sptr create2DWorkspaceWithValues(int64_t nHist, int64_t nBins, bool isHist, const std::set<int64_t> &maskedWorkspaceIndices, - double xVal, double yVal, double eVal) { + double xVal, double yVal, double eVal, + bool hasDx = false) { auto x1 = Kernel::make_cow<HistogramData::HistogramX>( isHist ? nBins + 1 : nBins, LinearGenerator(xVal, 1.0)); Counts y1(nBins, yVal); CountStandardDeviations e1(nBins, eVal); + auto dx = Kernel::make_cow<HistogramData::HistogramDx>(nBins, yVal); auto retVal = boost::make_shared<Workspace2D>(); - retVal->initialize(nHist, isHist ? nBins + 1 : nBins, nBins); + retVal->initialize(nHist, createHisto(isHist, y1, e1)); for (int i = 0; i < nHist; i++) { - retVal->setX(i, x1); - retVal->setCounts(i, y1); - retVal->setCountStandardDeviations(i, e1); + retVal->setSharedX(i, x1); + if (hasDx) + retVal->setSharedDx(i, dx); retVal->getSpectrum(i).setDetectorID(i); retVal->getSpectrum(i).setSpectrumNo(i); } @@ -231,16 +249,18 @@ Workspace2D_sptr create2DWorkspaceWithValuesAndXerror( Workspace2D_sptr create2DWorkspace123(int64_t nHist, int64_t nBins, bool isHist, - const std::set<int64_t> &maskedWorkspaceIndices) { - return create2DWorkspaceWithValues(nHist, nBins, isHist, - maskedWorkspaceIndices, 1.0, 2.0, 3.0); + const std::set<int64_t> &maskedWorkspaceIndices, + bool hasDx) { + return create2DWorkspaceWithValues( + nHist, nBins, isHist, maskedWorkspaceIndices, 1.0, 2.0, 3.0, hasDx); } Workspace2D_sptr create2DWorkspace154(int64_t nHist, int64_t nBins, bool isHist, - const std::set<int64_t> &maskedWorkspaceIndices) { - return create2DWorkspaceWithValues(nHist, nBins, isHist, - maskedWorkspaceIndices, 1.0, 5.0, 4.0); + const std::set<int64_t> &maskedWorkspaceIndices, + bool hasDx) { + return create2DWorkspaceWithValues( + nHist, nBins, isHist, maskedWorkspaceIndices, 1.0, 5.0, 4.0, hasDx); } Workspace2D_sptr maskSpectra(Workspace2D_sptr workspace, @@ -303,31 +323,34 @@ Workspace2D_sptr create2DWorkspaceBinned(int nhist, int numVals, double x0, Counts y(numVals, 2); CountStandardDeviations e(numVals, M_SQRT2); auto retVal = boost::make_shared<Workspace2D>(); - retVal->initialize(nhist, numVals + 1, numVals); - for (int i = 0; i < nhist; i++) { + retVal->initialize(nhist, createHisto(true, y, e)); + for (int i = 0; i < nhist; i++) retVal->setBinEdges(i, x); - retVal->setCounts(i, y); - retVal->setCountStandardDeviations(i, e); - } return retVal; } /** Create a 2D workspace with this many histograms and bins. The bins are * assumed to be non-uniform and given by the input array * Filled with Y = 2.0 and E = M_SQRT2w + * If hasDx is true, all spectra will have dx values, starting from 0.1 and + * increased by 0.1 for each bin. */ -Workspace2D_sptr create2DWorkspaceBinned(int nhist, const int numBoundaries, - const double xBoundaries[]) { +Workspace2D_sptr create2DWorkspaceNonUniformlyBinned(int nhist, + const int numBoundaries, + const double xBoundaries[], + bool hasDx) { BinEdges x(xBoundaries, xBoundaries + numBoundaries); const int numBins = numBoundaries - 1; Counts y(numBins, 2); CountStandardDeviations e(numBins, M_SQRT2); + auto dx = Kernel::make_cow<HistogramData::HistogramDx>( + numBins, LinearGenerator(0.1, .1)); auto retVal = boost::make_shared<Workspace2D>(); - retVal->initialize(nhist, numBins + 1, numBins); + retVal->initialize(nhist, createHisto(true, y, e)); for (int i = 0; i < nhist; i++) { retVal->setBinEdges(i, x); - retVal->setCounts(i, y); - retVal->setCountStandardDeviations(i, e); + if (hasDx) + retVal->setSharedDx(i, dx); } return retVal; } @@ -360,11 +383,11 @@ void addNoise(Mantid::API::MatrixWorkspace_sptr ws, double noise, * from the centre of the * previous. * Data filled with: Y: 2.0, E: M_SQRT2, X: nbins of width 1 starting at 0 + * The flag hasDx is responsible for creating dx values or not */ -Workspace2D_sptr -create2DWorkspaceWithFullInstrument(int nhist, int nbins, bool includeMonitors, - bool startYNegative, bool isHistogram, - const std::string &instrumentName) { +Workspace2D_sptr create2DWorkspaceWithFullInstrument( + int nhist, int nbins, bool includeMonitors, bool startYNegative, + bool isHistogram, const std::string &instrumentName, bool hasDx) { if (includeMonitors && nhist < 2) { throw std::invalid_argument("Attempting to 2 include monitors for a " "workspace with fewer than 2 histograms"); @@ -373,9 +396,10 @@ create2DWorkspaceWithFullInstrument(int nhist, int nbins, bool includeMonitors, Workspace2D_sptr space; if (isHistogram) space = create2DWorkspaceBinned( - nhist, nbins); // A 1:1 spectra is created by default + nhist, nbins, hasDx); // A 1:1 spectra is created by default else - space = create2DWorkspace123(nhist, nbins, false); + space = + create2DWorkspace123(nhist, nbins, false, std::set<int64_t>(), hasDx); space->setTitle( "Test histogram"); // actually adds a property call run_title to the logs space->getAxis(0)->setUnit("TOF"); diff --git a/Framework/WorkflowAlgorithms/test/ExtractQENSMembersTest.h b/Framework/WorkflowAlgorithms/test/ExtractQENSMembersTest.h index 044e013d5764b5d0268098caa6e413ccf71c5b01..592fac50c42b58868b2dafc16f4149087169e173 100644 --- a/Framework/WorkflowAlgorithms/test/ExtractQENSMembersTest.h +++ b/Framework/WorkflowAlgorithms/test/ExtractQENSMembersTest.h @@ -178,7 +178,7 @@ private: createResultWorkspace(const std::vector<std::string> &members, const std::vector<double> &dataX) const { MatrixWorkspace_sptr resultWorkspace = - WorkspaceCreationHelper::create2DWorkspaceBinned( + WorkspaceCreationHelper::create2DWorkspaceNonUniformlyBinned( static_cast<int>(members.size()), static_cast<int>(dataX.size()), dataX.data()); diff --git a/docs/source/algorithms/ConjoinXRuns-v1.rst b/docs/source/algorithms/ConjoinXRuns-v1.rst index 97c0261bf535c436e3955d48893217a9398ad0ae..72524c195fbf05108da8f62627e89c842481e8e8 100644 --- a/docs/source/algorithms/ConjoinXRuns-v1.rst +++ b/docs/source/algorithms/ConjoinXRuns-v1.rst @@ -10,7 +10,7 @@ Description ----------- -This algorithm joins the input workspaces into a single one by concatenating their spectra. The concatenation is done in the same order as in the input workspaces list. Consider using :ref:`SortXAxis <algm-SortXAxis>` afterwards, if necessary. The instrument and the units are copied from the first workspace. The sample logs are also copied from the first input, but the behaviour can be controlled by the instrument parameter file (IPF), as described in :ref:`MergeRuns <algm-MergeRuns>`. Furthermore, that behaviour can be overriden by providing input to the relevant optional properties of the algorithm. +This algorithm joins the input workspaces into a single one by concatenating their spectra. The concatenation is done in the same order as in the input workspaces list. Consider using :ref:`SortXAxis <algm-SortXAxis>` afterwards, if necessary. The instrument and the units are copied from the first workspace. The sample logs are also copied from the first input, but the behaviour can be controlled by the instrument parameter file (IPF), as described in :ref:`MergeRuns <algm-MergeRuns>`. Furthermore, that behaviour can be overriden by providing input to the relevant optional properties of the algorithm. This algorithm joins Dx values, if present. InputWorkspaces --------------- diff --git a/docs/source/release/v3.13.0/framework.rst b/docs/source/release/v3.13.0/framework.rst index e87f0e62808027ec137808e2728a630108fed254..41ce869761af52f972dbd766004b14a7fa0da840 100644 --- a/docs/source/release/v3.13.0/framework.rst +++ b/docs/source/release/v3.13.0/framework.rst @@ -31,6 +31,7 @@ Improved - :ref:`ConvertToPointData <algm-ConvertToPointData>` and :ref:`ConvertToHistogram <algm-ConvertToHistogram>` now propagate the Dx errors to the output. - The algorithm :ref:`algm-Stitch1D` can now receive point data as input workspaces and does apply a full overlap while keeping corresponding Dx values. - The algorithm :ref:`CreateWorkspace <algm-CreateWorkspace>` can now optionally receive the Dx errors. +- :ref:`ConjoinXRuns <algm-ConjoinXRuns>` joins Dx errors if present - The algorithm :ref:`SortXAxis <algm-SortXAxis>` has a new input option that allows ascending (default) and descending sorting. Furthermore, Dx values will be considered if present. The documentation needed to be corrected. Bug fixes