Skip to content

Commit 442688a

Browse files
authored
Merge pull request #37815 from peterfpeterson/ewm6796_loadeventnxs_tof_min_bug
LoadEventNexus change tofmin to be at the lowest event's tof
2 parents 00f4f6f + 1af3dc5 commit 442688a

File tree

7 files changed

+22
-18
lines changed

7 files changed

+22
-18
lines changed

Framework/DataHandling/src/LoadEventNexus.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,8 +1271,8 @@ void LoadEventNexus::loadEvents(API::Progress *const prog, const bool monitors)
12711271
if (eventsLoaded > 0) {
12721272
int nBins = getProperty("NumberOfBins");
12731273
auto binEdgesVec = std::vector<double>(nBins + 1);
1274-
binEdgesVec[0] = shortest_tof - 1;
1275-
binEdgesVec[nBins] = longest_tof + 1;
1274+
binEdgesVec[0] = shortest_tof; // left edge is inclusive
1275+
binEdgesVec[nBins] = longest_tof + 1; // right edge is exclusive
12761276
double binStep = (binEdgesVec[nBins] - binEdgesVec[0]) / nBins;
12771277
for (int binIndex = 1; binIndex < nBins; binIndex++) {
12781278
binEdgesVec[binIndex] = binEdgesVec[0] + (binStep * binIndex);

Framework/DataHandling/test/LoadEventNexusTest.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ class LoadEventNexusTest : public CxxTest::TestSuite {
538538
TS_ASSERT_EQUALS(WS->getNumberEvents(), 112266);
539539
// TOF limits found. There is a pad of +-1 given around the actual TOF
540540
// founds.
541-
TS_ASSERT_DELTA((*WS->refX(0))[0], 44162.6, 0.05);
541+
TS_ASSERT_DELTA((*WS->refX(0))[0], 44163.6, 0.05);
542542
TS_ASSERT_DELTA((*WS->refX(0))[1], 60830.2, 0.05);
543543
// Valid spectrum info
544544
TS_ASSERT_EQUALS(WS->getSpectrum(0).getSpectrumNo(), 1);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
9e7cd5cb0a44319e99aa8a1fd2a5b549
1+
4eec33256ef34ab9cbc302eb4bdf9a7e
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8bb9ff77463d810b9a72f7d3aaf2b9a8
1+
9af80ceca5fe5d41c23940871f5783c1

Testing/SystemTests/tests/framework/TOPAZPeakFinding.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import numpy
1515
from mantid.simpleapi import *
1616
from mantid.dataobjects import PeaksWorkspace, LeanElasticPeaksWorkspace
17+
from mantid.geometry import UnitCell
1718

1819

1920
class TOPAZPeakFinding(systemtesting.MantidSystemTest):
@@ -22,6 +23,8 @@ def requiredMemoryMB(self):
2223
return 2000
2324

2425
def runTest(self):
26+
unitcell_exp = UnitCell(4.714, 6.06, 10.40) # orthorhombic
27+
2528
# Load then convert to Q in the lab frame
2629
LoadEventNexus(Filename=r"TOPAZ_3132_event.nxs", OutputWorkspace="topaz_3132")
2730
ConvertToDiffractionMDWorkspace(
@@ -113,12 +116,12 @@ def runTest(self):
113116
w = mtd["topaz_3132"]
114117
s = w.sample()
115118
ol = s.getOrientedLattice()
116-
self.assertDelta(ol.a(), 4.714, 0.01, "Correct lattice a value not found.")
117-
self.assertDelta(ol.b(), 6.06, 0.01, "Correct lattice b value not found.")
118-
self.assertDelta(ol.c(), 10.42, 0.01, "Correct lattice c value not found.")
119-
self.assertDelta(ol.alpha(), 90, 0.4, "Correct lattice angle alpha value not found.")
120-
self.assertDelta(ol.beta(), 90, 0.4, "Correct lattice angle beta value not found.")
121-
self.assertDelta(ol.gamma(), 90, 0.4, "Correct lattice angle gamma value not found.")
119+
self.assertDelta(ol.a(), unitcell_exp.a(), 0.01, "Correct lattice a value not found.")
120+
self.assertDelta(ol.b(), unitcell_exp.b(), 0.01, "Correct lattice b value not found.")
121+
self.assertDelta(ol.c(), unitcell_exp.c(), 0.01, "Correct lattice c value not found.")
122+
self.assertDelta(ol.alpha(), unitcell_exp.alpha(), 0.4, "Correct lattice angle alpha value not found.")
123+
self.assertDelta(ol.beta(), unitcell_exp.beta(), 0.4, "Correct lattice angle beta value not found.")
124+
self.assertDelta(ol.gamma(), unitcell_exp.gamma(), 0.4, "Correct lattice angle gamma value not found.")
122125

123126
# Compare new and old UBs
124127
newUB = numpy.array(mtd["topaz_3132"].sample().getOrientedLattice().getUB())
@@ -155,12 +158,12 @@ def runTest(self):
155158
w = mtd["topaz_3132"]
156159
s = w.sample()
157160
ol = s.getOrientedLattice()
158-
self.assertDelta(ol.a(), 4.714, 0.01, "Correct lattice a value not found.")
159-
self.assertDelta(ol.b(), 6.06, 0.01, "Correct lattice b value not found.")
160-
self.assertDelta(ol.c(), 10.42, 0.01, "Correct lattice c value not found.")
161-
self.assertDelta(ol.alpha(), 90, 0.4, "Correct lattice angle alpha value not found.")
162-
self.assertDelta(ol.beta(), 90, 0.4, "Correct lattice angle beta value not found.")
163-
self.assertDelta(ol.gamma(), 90, 0.4, "Correct lattice angle gamma value not found.")
161+
self.assertDelta(ol.a(), unitcell_exp.a(), 0.01, "Correct lattice a value not found.")
162+
self.assertDelta(ol.b(), unitcell_exp.b(), 0.01, "Correct lattice b value not found.")
163+
self.assertDelta(ol.c(), unitcell_exp.c(), 0.01, "Correct lattice c value not found.")
164+
self.assertDelta(ol.alpha(), unitcell_exp.alpha(), 0.4, "Correct lattice angle alpha value not found.")
165+
self.assertDelta(ol.beta(), unitcell_exp.beta(), 0.4, "Correct lattice angle beta value not found.")
166+
self.assertDelta(ol.gamma(), unitcell_exp.gamma(), 0.4, "Correct lattice angle gamma value not found.")
164167

165168
# Compare new and old UBs
166169
newUB = numpy.array(mtd["topaz_3132"].sample().getOrientedLattice().getUB())
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
00c4d103c9ef25d6b91490546b44e4f1
1+
b0387c5656e8396cb473835d38aa59c1
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Modify :ref:`LoadEventNexus <algm-LoadEventNexus>` so the minimum histogram bin edge is equal to the lowest time-of-flight event rather than one less. The effect is that there is no longer negative bin edges unless there is actually a negative time-of-flight in the data.

0 commit comments

Comments
 (0)