Repository: refnx/refnx

Issue:
Event mode reduction is not calculating the correct resolution for each timeslice

Discussion:

Patch:
diff --git a/refnx/reduce/platypusnexus.py b/refnx/reduce/platypusnexus.py
index ae28b951..f041c3ff 100644
--- a/refnx/reduce/platypusnexus.py
+++ b/refnx/reduce/platypusnexus.py
@@ -516,6 +516,9 @@ class PlatypusNexus(object):
                 m_spec_tof_hist[:] = TOF - toffset
                 flight_distance[:] = flight_distance[0]
                 detpositions[:] = detpositions[0]
+                domega[:] = domega[0]
+                d_cx[:] = d_cx[0]
+                phase_angle[:] = phase_angle[0]
                 break
             else:
                 scanpoint += 1


Test patch:
diff --git a/refnx/reduce/test/test_reduce.py b/refnx/reduce/test/test_reduce.py
index 92f1f5f6..4b9f6990 100644
--- a/refnx/reduce/test/test_reduce.py
+++ b/refnx/reduce/test/test_reduce.py
@@ -3,7 +3,7 @@ import os.path
 import numpy as np
 from refnx.reduce import reduce_stitch, ReducePlatypus
 from numpy.testing import (assert_almost_equal, assert_, assert_equal,
-                           assert_array_less)
+                           assert_array_less, assert_allclose)
 import xml.etree.ElementTree as ET
 
 class TestReduce(unittest.TestCase):
@@ -44,6 +44,11 @@ class TestReduce(unittest.TestCase):
             eventmode=[0, 900, 1800])
         assert_equal(a.ydata.shape[0], 2)
 
+        # check that the resolutions are pretty much the same
+        assert_allclose(a.xdata_sd[0] / a.xdata[0],
+                        a.xdata_sd[1] / a.xdata[1],
+                        atol = 0.001)
+
         # check that the right timestamps are written into the datafile
         tree = ET.parse(os.path.join(os.getcwd(), 'PLP0011641_1.xml'))
         t = tree.find('.//REFentry').attrib['time']