From 685a2b473319beaa5f9f27eecefeeb3a2e63e724 Mon Sep 17 00:00:00 2001
From: Mathieu Doucet <doucetm@ornl.gov>
Date: Wed, 7 Mar 2012 15:23:00 -0500
Subject: [PATCH] Re #4919 fix stitching for distributions (as opposed to
 histos)

---
 Code/Mantid/scripts/LargeScaleStructures/data_stitching.py   | 5 ++++-
 .../reduction/instruments/reflectometer/data_manipulation.py | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/Code/Mantid/scripts/LargeScaleStructures/data_stitching.py b/Code/Mantid/scripts/LargeScaleStructures/data_stitching.py
index 8ae0d93fa92..72a193e0e45 100644
--- a/Code/Mantid/scripts/LargeScaleStructures/data_stitching.py
+++ b/Code/Mantid/scripts/LargeScaleStructures/data_stitching.py
@@ -248,7 +248,10 @@ class DataSet(object):
         sum = 0.0
         sum_err = 0.0
         for i in range(len(y)):
-            if x[i]>=xmin and x[i+1]<=xmax:
+            upper_bound = x[i]
+            if len(x)==len(y)+1:
+                upper_bound = x[i+1]
+            if x[i]>=xmin and upper_bound<=xmax:
                 sum += y[i]/(e[i]*e[i])
                 sum_err += 1.0/(e[i]*e[i])
 
diff --git a/Code/Mantid/scripts/reduction/instruments/reflectometer/data_manipulation.py b/Code/Mantid/scripts/reduction/instruments/reflectometer/data_manipulation.py
index 7d425d23e56..e54f5022a66 100644
--- a/Code/Mantid/scripts/reduction/instruments/reflectometer/data_manipulation.py
+++ b/Code/Mantid/scripts/reduction/instruments/reflectometer/data_manipulation.py
@@ -75,7 +75,7 @@ def counts_vs_pixel_distribution(file_path, is_pixel_y=True, callback=None,
         
         # The Y pixel numbers start at 1 from the perspective of the users
         # They also read in reversed order
-        if is_pixel_y:
+        if False and is_pixel_y:
             x=mtd[ws_output].dataX(0)
             y_reversed=mtd[ws_output].dataY(0)
             y=[i for i in y_reversed]
-- 
GitLab