Commit b9d851e9 authored by Mathieu Tillet's avatar Mathieu Tillet
Browse files

Load D16 omega scan as histograms

Because of compatibility reasons for wrongly fomatted data, omega scans
from D16 need to be loaded as histogram instead of point data. This
requires in turn some adjustements to existing algorithm using this kind
of data.
parent 78ca36c3
......@@ -503,18 +503,12 @@ size_t LoadILLSANS::loadDataFromMonitors(NeXus::NXEntry &firstEntry, size_t firs
HistogramData::BinEdges histoBinEdges(data.dim2() + 1, HistogramData::LinearGenerator(0.0, 1));
m_localWorkspace->setBinEdges(firstIndex, std::move(histoBinEdges));
} else {
if (m_isD16Omega) {
HistogramData::Points histoPoints =
HistogramData::Points(std::vector<double>(1, 0.5 * (m_defaultBinning[0] + m_defaultBinning[1])));
m_localWorkspace->setPoints(firstIndex, std::move(histoPoints));
if (type != MultichannelType::KINETIC) {
HistogramData::BinEdges histoBinEdges = HistogramData::BinEdges(m_defaultBinning);
m_localWorkspace->setBinEdges(firstIndex, std::move(histoBinEdges));
} else {
if (type != MultichannelType::KINETIC) {
HistogramData::BinEdges histoBinEdges = HistogramData::BinEdges(m_defaultBinning);
m_localWorkspace->setBinEdges(firstIndex, std::move(histoBinEdges));
} else {
HistogramData::Points histoPoints = HistogramData::Points(m_defaultBinning);
m_localWorkspace->setPoints(firstIndex, std::move(histoPoints));
}
HistogramData::Points histoPoints = HistogramData::Points(m_defaultBinning);
m_localWorkspace->setPoints(firstIndex, std::move(histoPoints));
}
}
// Add average monitor counts to a property:
......@@ -568,17 +562,12 @@ size_t LoadILLSANS::loadDataFromTubes(NeXus::NXInt &data, const std::vector<doub
m_localWorkspace->setCounts(index, histoCounts);
m_localWorkspace->setCountVariances(index, histoVariances);
if (m_isD16Omega) {
const HistogramData::Points histoPoints(std::vector<double>(1, 0.5 * (timeBinning[0] + timeBinning[1])));
if (type == MultichannelType::KINETIC) {
const HistogramData::Points histoPoints(timeBinning);
m_localWorkspace->setPoints(index, histoPoints);
} else {
if (type == MultichannelType::KINETIC) {
const HistogramData::Points histoPoints(timeBinning);
m_localWorkspace->setPoints(index, histoPoints);
} else {
const HistogramData::BinEdges binEdges(timeBinning);
m_localWorkspace->setBinEdges(index, binEdges);
}
const HistogramData::BinEdges binEdges(timeBinning);
m_localWorkspace->setBinEdges(index, binEdges);
}
}
}
......
......@@ -391,7 +391,7 @@ public:
TS_ASSERT(alg.isExecuted());
MatrixWorkspace_const_sptr outputWS = alg.getProperty("OutputWorkspace");
TS_ASSERT(outputWS);
TS_ASSERT(!outputWS->isHistogramData())
TS_ASSERT(outputWS->isHistogramData())
TS_ASSERT(outputWS->detectorInfo().isMonitor(320 * 320));
TS_ASSERT(outputWS->detectorInfo().isMonitor(320 * 320 + 1));
TS_ASSERT_EQUALS(outputWS->blocksize(), 1)
......
......@@ -139,6 +139,11 @@ class SANSILLParameterScan(PythonAlgorithm):
_, load_ws_name = needs_loading(self.sample, "Load")
LoadAndMerge(Filename=self.sample, OutputWorkspace=load_ws_name + "_grouped",
LoaderOptions={"Wavelength": self.wavelength}, startProgress=0, endProgress=0.7)
# Omega scans are loaded as histogram data for compatibility reasons, but we need point data from now on.
# Converting from histogram to point data is straight forward and no meaningful information can be lost.
ConvertToPointData(InputWorkspace=load_ws_name + "_grouped", OutputWorkspace=load_ws_name + "_grouped")
ConjoinXRuns(InputWorkspaces=load_ws_name + "_grouped",
OutputWorkspace=load_ws_name + "_joined",
SampleLogAsXAxis=self.observable, startProgress=0.7, endProgress=0.75)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment