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

Add D11B loader

parent b311a41e
......@@ -59,6 +59,7 @@ private:
const std::string &);
void initWorkSpace(NeXus::NXEntry &, const std::string &);
void initWorkSpaceD11B(NeXus::NXEntry &, const std::string &);
void initWorkSpaceD33(NeXus::NXEntry &, const std::string &);
void initWorkSpaceD16(NeXus::NXEntry &, const std::string &);
void createEmptyWorkspace(const size_t, const size_t);
......
......@@ -147,6 +147,10 @@ void LoadILLSANS::exec() {
const double angle = firstEntry.getFloat(instrumentPath + "/Gamma/value");
placeD16(-angle, distance, "detector");
} else if (m_instrumentName == "D11B") {
initWorkSpaceD11B(firstEntry, instrumentPath);
progress.report("Loading the instrument " + m_instrumentName);
runLoadInstrument();
} else {
initWorkSpace(firstEntry, instrumentPath);
progress.report("Loading the instrument " + m_instrumentName);
......@@ -187,6 +191,11 @@ void LoadILLSANS::setInstrumentName(const NeXus::NXEntry &firstEntry,
firstEntry, instrumentNamePath + "/name");
const auto inst = std::find(m_supportedInstruments.begin(),
m_supportedInstruments.end(), m_instrumentName);
if (m_instrumentName == "D11" && firstEntry.containsGroup("data1")) {
m_instrumentName = "D11B";
}
if (inst == m_supportedInstruments.end()) {
throw std::runtime_error(
"Instrument " + m_instrumentName +
......@@ -266,6 +275,44 @@ void LoadILLSANS::initWorkSpace(NeXus::NXEntry &firstEntry,
}
}
/**
* @brief LoadILLSANS::initWorkSpaceD11B Load D11B data
* @param firstEntry
* @param instrumentPath
*/
void LoadILLSANS::initWorkSpaceD11B(NeXus::NXEntry &firstEntry,
const std::string &instrumentPath) {
g_log.debug("Fetching data...");
NXData data1 = firstEntry.openNXData("data1");
NXInt dataCenter = data1.openIntData();
dataCenter.load();
NXData data2 = firstEntry.openNXData("data2");
NXInt dataRight = data2.openIntData();
dataRight.load();
NXData data3 = firstEntry.openNXData("data3");
NXInt dataLeft = data3.openIntData();
dataLeft.load();
size_t numberOfHistograms =
static_cast<size_t>(dataCenter.dim0() * dataCenter.dim1() +
dataRight.dim0() * dataRight.dim1() +
dataLeft.dim0() * dataLeft.dim1()) +
N_MONITORS;
createEmptyWorkspace(numberOfHistograms, 1);
loadMetaData(firstEntry, instrumentPath);
size_t nextIndex;
nextIndex =
loadDataIntoWorkspaceFromVerticalTubes(dataCenter, m_defaultBinning, 0);
nextIndex = loadDataIntoWorkspaceFromVerticalTubes(dataLeft, m_defaultBinning,
nextIndex);
nextIndex = loadDataIntoWorkspaceFromVerticalTubes(
dataRight, m_defaultBinning, nextIndex);
nextIndex = loadDataIntoWorkspaceFromMonitors(firstEntry, nextIndex);
}
/**
* Loads data for D33
*/
......@@ -459,6 +506,7 @@ size_t LoadILLSANS::loadDataIntoWorkspaceFromVerticalTubes(
numberOfTubes = data.dim0();
histogramWidth = data.dim2();
}
const int numberOfPixelsPerTube = data.dim1();
const HistogramData::BinEdges binEdges(timeBinning);
......
<?xml version='1.0' encoding='ASCII'?>
<instrument xmlns="http://www.mantidproject.org/IDF/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="D11B" valid-from="2020-12-01 00:00:00" valid-to="2100-01-31 23:59:59" last-modified="2020-12-21 11:02:21.420880" xsi:schemaLocation="http://www.mantidproject.org/IDF/1.0 http://schema.mantidproject.org/IDF/1.0/IDFSchema.xsd">
<!-- This is the instrument definition file of the D11B SANS instrument at the ILL.
Generated file, PLEASE DO NOT EDIT THIS FILE!
This file was automatically generated by mantidgeometry/ILL/IDF/d11b_generateIDF.py
> python3 ./ILL/IDF/d11b_generateIDF.py
-->
<defaults>
<length unit="metre"/>
<angle unit="degree"/>
<reference-frame>
<along-beam axis="z"/>
<pointing-up axis="y"/>
<handedness val="right"/>
</reference-frame>
<default-view view="3D" axis-view="z-"/>
</defaults>
<!--SOURCE-->
<component type="monochromator">
<location x="0.0" y="0.0" z="-22"/>
</component>
<type name="monochromator" is="source"/>
<!--Sample position-->
<component type="sample_position">
<location x="0.0" y="0.0" z="0.0"/>
</component>
<type name="sample_position" is="SamplePos"/>
<!--MONITORS-->
<component type="monitors" idlist="monitors">
<location/>
</component>
<type name="monitors">
<component type="monitor">
<location z="-16.7" name="monitor1"/>
<location z="-1.2" name="monitor2"/>
</component>
</type>
<!--MONITOR SHAPE-->
<type name="monitor" is="monitor">
<cylinder id="cyl-approx">
<centre-of-bottom-base p="0.0" r="0.0" t="0.0"/>
<axis x="0.0" y="0.0" z="1.0"/>
<radius val="0.01"/>
<height val="0.03"/>
</cylinder>
<algebra val="cyl-approx"/>
</type>
<!--MONITOR IDs-->
<idlist idname="monitors">
<id val="100000"/>
<id val="100001"/>
</idlist>
<!--DETECTORS-->
<component type="detector">
<location x="0.0" y="0.0" z="0.0"/>
</component>
<type name="detector">
<component type="detector_center" idstart="0" idfillbyfirst="x" idstepbyrow="192">
<location x="0.0" y="0.0" z="8.0">
<rot val="90.0" axis-x="0" axis-y="0" axis-z="1"/>
</location>
</component>
<component type="detector_left" idstart="49152" idfillbyfirst="y" idstepbyrow="256">
<location x="0.0" y="0.0" z="7.895"/>
</component>
<component type="detector_right" idstart="57344" idfillbyfirst="y" idstepbyrow="256">
<location x="0.0" y="0.0" z="7.895"/>
</component>
</type>
<!--CENTER DETECTOR-->
<type xstart="-0.764" xstep="0.008" xpixels="192" ystart="-0.51" ystep="0.004" ypixels="256" name="detector_center" is="rectangular_detector" type="pixel_center"/>
<!--LEFT-->
<type xstart="0.758" xstep="-0.008" xpixels="32" ystart="-0.51" ystep="0.004" ypixels="256" name="detector_left" is="rectangular_detector" type="pixel_panels"/>
<!--RIGHT-->
<type xstart="-0.51" xstep="-0.008" xpixels="32" ystart="-0.51" ystep="0.004" ypixels="256" name="detector_right" is="rectangular_detector" type="pixel_panels"/>
<type name="pixel_center" is="detector">
<cuboid id="pixel_center">
<left-front-bottom-point x="-0.008" y="-0.004" z="5e-05"/>
<left-front-top-point x="-0.008" y="0.004" z="5e-05"/>
<left-back-bottom-point x="-0.008" y="-0.004" z="-5e-05"/>
<right-front-bottom-point x="0.008" y="-0.004" z="-5e-05"/>
</cuboid>
<algebra val="pixel_center"/>
</type>
<type name="pixel_panels" is="detector">
<cuboid id="pixel_panels">
<left-front-bottom-point x="-0.004" y="-0.008" z="5e-05"/>
<left-front-top-point x="-0.004" y="0.008" z="5e-05"/>
<left-back-bottom-point x="-0.004" y="-0.008" z="-5e-05"/>
<right-front-bottom-point x="0.004" y="-0.008" z="-5e-05"/>
</cuboid>
<algebra val="pixel_panels"/>
</type>
</instrument>
......@@ -684,6 +684,10 @@
<technique>SANS</technique>
</instrument>
<instrument name="D11B">
<technique>SANS</technique>
</instrument>
<instrument name="D16">
<technique>SANS</technique>
</instrument>
......
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