Index: src/sas/sascalc/dataloader/readers/ascii_reader.py
===================================================================
--- src/sas/sascalc/dataloader/readers/ascii_reader.py	(revision b09095a7f7ba6ae5e7ee28a9d240400222cbae19)
+++ src/sas/sascalc/dataloader/readers/ascii_reader.py	(revision 8ffafd1261e10b3f4556af59ce0dfbe8c7d78c3e)
@@ -85,15 +85,10 @@
                     self.reset_data_list(len(lines) - line_no)
 
-                candidate_lines += 1
-                # If 5 or more lines, this is considering the set data
-                if candidate_lines >= self.min_data_pts:
-                    is_data = True
-
-                self.current_dataset.x[candidate_lines - 1] = float(toks[0])
-                self.current_dataset.y[candidate_lines - 1] = float(toks[1])
+                self.current_dataset.x[candidate_lines] = float(toks[0])
+                self.current_dataset.y[candidate_lines] = float(toks[1])
 
                 # If a 3rd row is present, consider it dy
                 if new_lentoks > 2:
-                    self.current_dataset.dy[candidate_lines - 1] = \
+                    self.current_dataset.dy[candidate_lines] = \
                         float(toks[2])
                     has_error_dy = True
@@ -101,7 +96,12 @@
                 # If a 4th row is present, consider it dx
                 if new_lentoks > 3:
-                    self.current_dataset.dx[candidate_lines - 1] = \
+                    self.current_dataset.dx[candidate_lines] = \
                         float(toks[3])
                     has_error_dx = True
+
+                candidate_lines += 1
+                # If 5 or more lines, this is considering the set data
+                if candidate_lines >= self.min_data_pts:
+                    is_data = True
 
                 # To remember the # of columns on the current line
@@ -143,17 +143,13 @@
         if len(self.current_dataset.x) < 1:
             raise RuntimeError("ascii_reader: could not load file")
-            return None
 
         # Data
-        self.current_dataset.x = \
-            self.current_dataset.x[self.current_dataset.x != 0]
-        self.current_dataset.y = \
-            self.current_dataset.y[self.current_dataset.x != 0]
-        self.current_dataset.dy = \
-            self.current_dataset.dy[self.current_dataset.x != 0] if \
-                has_error_dy else np.zeros(len(self.current_dataset.y))
-        self.current_dataset.dx = \
-            self.current_dataset.dx[self.current_dataset.x != 0] if \
-                has_error_dx else np.zeros(len(self.current_dataset.x))
+        x = self.current_dataset.x
+        self.current_dataset.x = self.current_dataset.x[x != 0]
+        self.current_dataset.y = self.current_dataset.y[x != 0]
+        self.current_dataset.dy = self.current_dataset.dy[x != 0] if \
+            has_error_dy else np.zeros(len(self.current_dataset.y))
+        self.current_dataset.dx = self.current_dataset.dx[x != 0] if \
+            has_error_dx else np.zeros(len(self.current_dataset.x))
 
         self.current_dataset.xaxis("\\rm{Q}", 'A^{-1}')
Index: test/sasdataloader/test/utest_averaging.py
===================================================================
--- test/sasdataloader/test/utest_averaging.py	(revision b09095a7f7ba6ae5e7ee28a9d240400222cbae19)
+++ test/sasdataloader/test/utest_averaging.py	(revision 8ffafd1261e10b3f4556af59ce0dfbe8c7d78c3e)
@@ -1,11 +1,11 @@
 
+import math
 import unittest
-import math
-
-from sas.sascalc.dataloader.loader import Loader
-from sas.sascalc.dataloader.manipulations import Ring, CircularAverage, SectorPhi, get_q,reader2D_converter
-
 import numpy as np
 import sas.sascalc.dataloader.data_info as data_info
+from sas.sascalc.dataloader.loader import Loader
+from sas.sascalc.dataloader.manipulations import Boxsum, Boxavg, Ring, get_q,\
+    CircularAverage, SectorPhi, SectorQ, reader2D_converter, SlabX, SlabY
+
 
 class Averaging(unittest.TestCase):
@@ -18,27 +18,26 @@
             should return the predefined height of the distribution (1.0).
         """
-        x_0  = np.ones([100,100])
+        x_0 = np.ones([100,100])
         dx_0 = np.ones([100,100])
-        
+
         self.data = data_info.Data2D(data=x_0, err_data=dx_0)
         detector = data_info.Detector()
-        detector.distance = 1000.0  #mm
-        detector.pixel_size.x = 1.0 #mm
-        detector.pixel_size.y = 1.0 #mm
-        
+        detector.distance = 1000.0  # mm
+        detector.pixel_size.x = 1.0 # mm
+        detector.pixel_size.y = 1.0 # mm
+
         # center in pixel position = (len(x_0)-1)/2
-        detector.beam_center.x = (len(x_0)-1)/2 #pixel number
-        detector.beam_center.y = (len(x_0)-1)/2 #pixel number
+        detector.beam_center.x = (len(x_0)-1)/2 # pixel number
+        detector.beam_center.y = (len(x_0)-1)/2 # pixel number
         self.data.detector.append(detector)
         
         source = data_info.Source()
-        source.wavelength = 10.0 #A
+        source.wavelength = 10.0 # A
         self.data.source = source
-        
-        # get_q(dx, dy, det_dist, wavelength) where units are mm,mm,mm,and A respectively.
+
+        # get_q(dx, dy, det_dist, wavelength) where units are mm, mm, mm, and A
         self.qmin = get_q(1.0, 1.0, detector.distance, source.wavelength)
-
         self.qmax = get_q(49.5, 49.5, detector.distance, source.wavelength)
-        
+
         self.qstep = len(x_0)
         x=  np.linspace(start= -1*self.qmax,
@@ -53,5 +52,5 @@
         self.data.y_bins=y
         self.data = reader2D_converter(self.data)
-            
+
     def test_ring_flat_distribution(self):
         """
@@ -62,9 +61,9 @@
                  center_y=self.data.detector[0].beam_center.y)
         r.nbins_phi = 20
-        
+
         o = r(self.data)
         for i in range(20):
             self.assertEqual(o.y[i], 1.0)
-            
+
     def test_sectorphi_full(self):
         """
@@ -77,6 +76,5 @@
         for i in range(7):
             self.assertEqual(o.y[i], 1.0)
-            
-            
+
     def test_sectorphi_partial(self):
         """
@@ -91,12 +89,11 @@
         for i in range(17):
             self.assertEqual(o.y[i], 1.0)
-            
-            
-
-class data_info_tests(unittest.TestCase):
-    
+
+
+class DataInfoTests(unittest.TestCase):
+
     def setUp(self):
         self.data = Loader().load('MAR07232_rest.ASC')
-        
+
     def test_ring(self):
         """
@@ -107,16 +104,16 @@
                  center_y=self.data.detector[0].beam_center.y,
                  nbins = 20)
-        ##r.nbins_phi = 20
-        
+        # r.nbins_phi = 20
+
         o = r(self.data)
         data_list = Loader().load('ring_testdata.txt')
         answer = data_list[0]
-        
+
         for i in range(r.nbins_phi - 1):
             self.assertAlmostEqual(o.x[i + 1], answer.x[i], 4)
             self.assertAlmostEqual(o.y[i + 1], answer.y[i], 4)
             self.assertAlmostEqual(o.dy[i + 1], answer.dy[i], 4)
-            
-    def test_circularavg(self):
+
+    def test_circular_avg(self):
         """
             Test circular averaging
@@ -126,13 +123,13 @@
                  bin_width=0.0003)
         r.nbins_phi = 20
-        
-        o = r(self.data)
-
-        answer = Loader().load('avg_testdata.txt')
+        o = r(self.data)
+
+        output = Loader().load('avg_testdata.txt')
+        answer = output[0]
         for i in range(r.nbins_phi):
             self.assertAlmostEqual(o.x[i], answer.x[i], 4)
             self.assertAlmostEqual(o.y[i], answer.y[i], 4)
             self.assertAlmostEqual(o.dy[i], answer.dy[i], 4)
-            
+
     def test_box(self):
         """
@@ -140,6 +137,4 @@
             The test data was not generated by IGOR.
         """
-        from sas.sascalc.dataloader.manipulations import Boxsum, Boxavg
-        
         r = Boxsum(x_min=.01, x_max=.015, y_min=0.01, y_max=0.015)
         s, ds, npoints = r(self.data)
@@ -147,10 +142,10 @@
         self.assertAlmostEqual(ds, 7.8007981835194293, 4)
         self.assertAlmostEqual(npoints, 324.0000, 4)        
-    
+
         r = Boxavg(x_min=.01, x_max=.015, y_min=0.01, y_max=0.015)
         s, ds = r(self.data)
         self.assertAlmostEqual(s, 0.10579935462962962, 4)
         self.assertAlmostEqual(ds, 0.024076537603455028, 4)
-            
+
     def test_slabX(self):
         """
@@ -158,16 +153,15 @@
             The test data was not generated by IGOR.
         """
-        from sas.sascalc.dataloader.manipulations import SlabX
-        
         r = SlabX(x_min=-.01, x_max=.01, y_min=-0.0002, y_max=0.0002, bin_width=0.0004)
         r.fold = False
         o = r(self.data)
 
-        answer = Loader().load('slabx_testdata.txt')
-        for i in range(len(o.x)):
-            self.assertAlmostEqual(o.x[i], answer.x[i], 4)
-            self.assertAlmostEqual(o.y[i], answer.y[i], 4)
-            self.assertAlmostEqual(o.dy[i], answer.dy[i], 4)
-            
+        output = Loader().load('slabx_testdata.txt')
+        answer = output[0]
+        for i in range(len(o.x)):
+            self.assertAlmostEqual(o.x[i], answer.x[i], 4)
+            self.assertAlmostEqual(o.y[i], answer.y[i], 4)
+            self.assertAlmostEqual(o.dy[i], answer.dy[i], 4)
+
     def test_slabY(self):
         """
@@ -175,16 +169,15 @@
             The test data was not generated by IGOR.
         """
-        from sas.sascalc.dataloader.manipulations import SlabY
-        
         r = SlabY(x_min=.005, x_max=.01, y_min=-0.01, y_max=0.01, bin_width=0.0004)
         r.fold = False
         o = r(self.data)
 
-        answer = Loader().load('slaby_testdata.txt')
-        for i in range(len(o.x)):
-            self.assertAlmostEqual(o.x[i], answer.x[i], 4)
-            self.assertAlmostEqual(o.y[i], answer.y[i], 4)
-            self.assertAlmostEqual(o.dy[i], answer.dy[i], 4)
-            
+        output = Loader().load('slaby_testdata.txt')
+        answer = output[0]
+        for i in range(len(o.x)):
+            self.assertAlmostEqual(o.x[i], answer.x[i], 4)
+            self.assertAlmostEqual(o.y[i], answer.y[i], 4)
+            self.assertAlmostEqual(o.dy[i], answer.dy[i], 4)
+
     def test_sectorphi_full(self):
         """
@@ -194,11 +187,8 @@
             The test data was not generated by IGOR.
         """
-        from sas.sascalc.dataloader.manipulations import SectorPhi
-        import math
-        
         nbins = 19
         phi_min = math.pi / (nbins + 1)
         phi_max = math.pi * 2 - phi_min
-        
+
         r = SectorPhi(r_min=.005,
                       r_max=.01,
@@ -208,5 +198,6 @@
         o = r(self.data)
 
-        answer = Loader().load('ring_testdata.txt')
+        output = Loader().load('ring_testdata.txt')
+        answer = output[0]
         for i in range(len(o.x)):
             self.assertAlmostEqual(o.x[i], answer.x[i], 4)
@@ -219,12 +210,10 @@
             The test data was not generated by IGOR.
         """
-        from sas.sascalc.dataloader.manipulations import SectorPhi
-        import math
-        
         r = SectorPhi(r_min=.005, r_max=.01, phi_min=0, phi_max=math.pi/2.0)
         r.nbins_phi = 20
         o = r(self.data)
 
-        answer = Loader().load('sectorphi_testdata.txt')
+        output = Loader().load('sectorphi_testdata.txt')
+        answer = output[0]
         for i in range(len(o.x)):
             self.assertAlmostEqual(o.x[i], answer.x[i], 4)
@@ -237,17 +226,15 @@
             The test data was not generated by IGOR.
         """
-        from sas.sascalc.dataloader.manipulations import SectorQ
-        import math
-        
         r = SectorQ(r_min=.005, r_max=.01, phi_min=0, phi_max=math.pi/2.0)
         r.nbins_phi = 20
         o = r(self.data)
 
-        answer = Loader().load('sectorq_testdata.txt')
-        for i in range(len(o.x)):
-            self.assertAlmostEqual(o.x[i], answer.x[i], 4)
-            self.assertAlmostEqual(o.y[i], answer.y[i], 4)
-            self.assertAlmostEqual(o.dy[i], answer.dy[i], 4)
-            
+        output = Loader().load('sectorq_testdata.txt')
+        answer = output[0]
+        for i in range(len(o.x)):
+            self.assertAlmostEqual(o.x[i], answer.x[i], 4)
+            self.assertAlmostEqual(o.y[i], answer.y[i], 4)
+            self.assertAlmostEqual(o.dy[i], answer.dy[i], 4)
+
 
 if __name__ == '__main__':
