Index: test/sasdataloader/test/utest_averaging.py
===================================================================
--- test/sasdataloader/test/utest_averaging.py	(revision 9a5097cd1c76689d1f997b85ba43d12a95d8f243)
+++ test/sasdataloader/test/utest_averaging.py	(revision fa4af7651800e56c3e125ac82e9b2bd0a75ca5ba)
@@ -1,11 +1,17 @@
 
+import math
+import os
 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 (Boxavg, Boxsum,
+                                                  CircularAverage, Ring,
+                                                  SectorPhi, SectorQ, SlabX,
+                                                  SlabY, get_q,
+                                                  reader2D_converter)
+
 
 class Averaging(unittest.TestCase):
@@ -13,4 +19,5 @@
         Test averaging manipulations on a flat distribution
     """
+
     def setUp(self):
         """
@@ -18,70 +25,70 @@
             should return the predefined height of the distribution (1.0).
         """
-        x_0  = np.ones([100,100])
-        dx_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
+        # respectively.
         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,
-                               stop= self.qmax,
-                               num= self.qstep,
-                               endpoint=True )  
-        y = np.linspace(start= -1*self.qmax,
-                               stop= self.qmax,
-                               num= self.qstep,
-                               endpoint=True )
-        self.data.x_bins=x
-        self.data.y_bins=y
+        x = np.linspace(start=-1 * self.qmax,
+                        stop=self.qmax,
+                        num=self.qstep,
+                        endpoint=True)
+        y = np.linspace(start=-1 * self.qmax,
+                        stop=self.qmax,
+                        num=self.qstep,
+                        endpoint=True)
+        self.data.x_bins = x
+        self.data.y_bins = y
         self.data = reader2D_converter(self.data)
-            
+
     def test_ring_flat_distribution(self):
         """
             Test ring averaging
         """
-        r = Ring(r_min=2*self.qmin, r_max=5*self.qmin, 
-                 center_x=self.data.detector[0].beam_center.x, 
+        r = Ring(r_min=2 * self.qmin, r_max=5 * self.qmin,
+                 center_x=self.data.detector[0].beam_center.x,
                  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):
         """
             Test sector averaging
         """
-        r = SectorPhi(r_min=self.qmin, r_max=3*self.qmin, 
-                      phi_min=0, phi_max=math.pi*2.0)
+        r = SectorPhi(r_min=self.qmin, r_max=3 * self.qmin,
+                      phi_min=0, phi_max=math.pi * 2.0)
         r.nbins_phi = 20
         o = r(self.data)
         for i in range(7):
             self.assertEqual(o.y[i], 1.0)
-            
-            
+
     def test_sectorphi_partial(self):
         """
         """
         phi_max = math.pi * 1.5
-        r = SectorPhi(r_min=self.qmin, r_max=3*self.qmin, 
+        r = SectorPhi(r_min=self.qmin, r_max=3 * self.qmin,
                       phi_min=0, phi_max=phi_max)
         self.assertEqual(r.phi_max, phi_max)
@@ -91,65 +98,69 @@
         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')
-        
+        filepath = os.path.join(os.path.dirname(
+            os.path.realpath(__file__)), 'MAR07232_rest.ASC')
+        self.data = Loader().load(filepath)
+
     def test_ring(self):
         """
             Test ring averaging
         """
-        r = Ring(r_min=.005, r_max=.01, 
-                 center_x=self.data.detector[0].beam_center.x, 
+        r = Ring(r_min=.005, r_max=.01,
+                 center_x=self.data.detector[0].beam_center.x,
                  center_y=self.data.detector[0].beam_center.y,
-                 nbins = 20)
+                 nbins=20)
         ##r.nbins_phi = 20
-        
-        o = r(self.data)
-        answer = Loader().load('ring_testdata.txt')
-        
+
+        o = r(self.data)
+        filepath = os.path.join(os.path.dirname(
+            os.path.realpath(__file__)), 'ring_testdata.txt')
+        answer = Loader().load(filepath)
+
         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):
         """
+        Test circular averaging
+        The test data was not generated by IGOR.
+        """
+        r = CircularAverage(r_min=.00, r_max=.025,
+                            bin_width=0.0003)
+        r.nbins_phi = 20
+
+        o = r(self.data)
+
+        filepath = os.path.join(os.path.dirname(
+            os.path.realpath(__file__)), 'avg_testdata.txt')
+        answer = Loader().load(filepath)
+        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):
+        """
             Test circular averaging
             The test data was not generated by IGOR.
         """
-        r = CircularAverage(r_min=.00, r_max=.025, 
-                 bin_width=0.0003)
-        r.nbins_phi = 20
-        
-        o = r(self.data)
-
-        answer = Loader().load('avg_testdata.txt')
-        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):
-        """
-            Test circular averaging
-            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)
         self.assertAlmostEqual(s, 34.278990899999997, 4)
         self.assertAlmostEqual(ds, 7.8007981835194293, 4)
-        self.assertAlmostEqual(npoints, 324.0000, 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):
         """
@@ -157,16 +168,18 @@
             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 = 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)
-            
+        filepath = os.path.join(os.path.dirname(
+            os.path.realpath(__file__)), 'slabx_testdata.txt')
+        answer = Loader().load(filepath)
+        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):
         """
@@ -174,16 +187,18 @@
             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 = 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)
-            
+        filepath = os.path.join(os.path.dirname(
+            os.path.realpath(__file__)), 'slaby_testdata.txt')
+        answer = Loader().load(filepath)
+        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):
         """
@@ -193,11 +208,9 @@
             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,
@@ -207,10 +220,12 @@
         o = r(self.data)
 
-        answer = Loader().load('ring_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)
-            
+        filepath = os.path.join(os.path.dirname(
+            os.path.realpath(__file__)), 'ring_testdata.txt')
+        answer = Loader().load(filepath)
+        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_quarter(self):
         """
@@ -218,17 +233,17 @@
             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')
-        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)
-            
+
+        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)
+
+        filepath = os.path.join(os.path.dirname(
+            os.path.realpath(__file__)), 'sectorphi_testdata.txt')
+        answer = Loader().load(filepath)
+        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_sectorq_full(self):
         """
@@ -236,17 +251,17 @@
             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)
-            
+
+        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)
+
+        filepath = os.path.join(os.path.dirname(
+            os.path.realpath(__file__)), 'sectorq_testdata.txt')
+        answer = Loader().load(filepath)
+        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__':
