Index: test/corfunc/test/98929.txt
===================================================================
--- test/corfunc/test/98929.txt	(revision 0bc068325a6539d7d9fbd96156da277fd6103a77)
+++ test/corfunc/test/98929.txt	(revision 0bc068325a6539d7d9fbd96156da277fd6103a77)
@@ -0,0 +1,140 @@
+0.007	2.11E+01
+0.009	6.91E+00
+0.011	3.30E+00
+0.013	1.95E+00
+0.015	1.37E+00
+0.017	9.86E-01
+0.019	8.56E-01
+0.021	8.00E-01
+0.023	7.40E-01
+0.025	7.03E-01
+0.027	6.65E-01
+0.029	6.67E-01
+0.031	6.63E-01
+0.033	6.90E-01
+0.035	6.97E-01
+0.037	7.13E-01
+0.039	7.02E-01
+0.041	7.49E-01
+0.043	7.58E-01
+0.045	7.84E-01
+0.047	8.41E-01
+0.049	8.84E-01
+0.051	9.26E-01
+0.053	9.74E-01
+0.055	1.02E+00
+0.057	1.06E+00
+0.059	1.09E+00
+0.061	1.11E+00
+0.063	1.16E+00
+0.065	1.16E+00
+0.067	1.17E+00
+0.069	1.15E+00
+0.071	1.15E+00
+0.073	1.13E+00
+0.075	1.11E+00
+0.077	1.07E+00
+0.079	1.04E+00
+0.081	1.03E+00
+0.083	9.79E-01
+0.085	9.27E-01
+0.087	8.77E-01
+0.089	8.38E-01
+0.091	8.00E-01
+0.093	7.68E-01
+0.095	7.24E-01
+0.097	6.80E-01
+0.099	6.45E-01
+0.101	6.18E-01
+0.103	5.87E-01
+0.105	5.70E-01
+0.107	5.51E-01
+0.109	5.40E-01
+0.111	5.23E-01
+0.113	4.99E-01
+0.115	4.84E-01
+0.117	4.69E-01
+0.119	4.54E-01
+0.121	4.44E-01
+0.123	4.37E-01
+0.125	4.32E-01
+0.127	4.27E-01
+0.129	4.26E-01
+0.131	4.16E-01
+0.133	4.13E-01
+0.135	4.11E-01
+0.137	4.05E-01
+0.139	4.03E-01
+0.141	4.01E-01
+0.143	4.01E-01
+0.145	3.95E-01
+0.147	3.86E-01
+0.149	3.79E-01
+0.151	3.80E-01
+0.153	3.74E-01
+0.155	3.71E-01
+0.157	3.68E-01
+0.159	3.72E-01
+0.161	3.69E-01
+0.163	3.69E-01
+0.165	3.66E-01
+0.167	3.59E-01
+0.169	3.56E-01
+0.171	3.58E-01
+0.173	3.57E-01
+0.175	3.57E-01
+0.177	3.51E-01
+0.179	3.55E-01
+0.181	3.59E-01
+0.183	3.51E-01
+0.185	3.48E-01
+0.187	3.43E-01
+0.189	3.46E-01
+0.191	3.49E-01
+0.193	3.41E-01
+0.195	3.44E-01
+0.197	3.38E-01
+0.199	3.41E-01
+0.201	3.39E-01
+0.203	3.38E-01
+0.205	3.37E-01
+0.207	3.33E-01
+0.209	3.28E-01
+0.211	3.27E-01
+0.213	3.23E-01
+0.215	3.23E-01
+0.217	3.27E-01
+0.219	3.30E-01
+0.221	3.33E-01
+0.223	3.33E-01
+0.225	3.28E-01
+0.227	3.26E-01
+0.229	3.19E-01
+0.231	3.11E-01
+0.233	3.12E-01
+0.235	3.02E-01
+0.237	3.12E-01
+0.239	3.23E-01
+0.241	3.24E-01
+0.243	3.45E-01
+0.245	3.49E-01
+0.247	3.50E-01
+0.249	3.55E-01
+0.251	3.50E-01
+0.253	3.47E-01
+0.255	3.47E-01
+0.257	3.18E-01
+0.259	3.10E-01
+0.261	2.90E-01
+0.263	2.80E-01
+0.265	2.90E-01
+0.267	3.09E-01
+0.269	3.04E-01
+0.271	3.36E-01
+0.273	3.17E-01
+0.275	3.19E-01
+0.277	2.94E-01
+0.279	3.11E-01
+0.281	2.21E-01
+0.283	1.66E-01
+0.285	1.62E-01
Index: test/corfunc/test/utest_corfunc.py
===================================================================
--- test/corfunc/test/utest_corfunc.py	(revision acefa2b7b00d8d908758f184828fbf18d106e742)
+++ test/corfunc/test/utest_corfunc.py	(revision acefa2b7b00d8d908758f184828fbf18d106e742)
@@ -0,0 +1,90 @@
+"""
+Unit Tests for CorfuncCalculator class
+"""
+
+import unittest
+import time
+import numpy as np
+from sas.sascalc.corfunc.corfunc_calculator import CorfuncCalculator
+from sas.sascalc.dataloader.data_info import Data1D
+import matplotlib.pyplot as plt
+
+class TestCalculator(unittest.TestCase):
+
+    def setUp(self):
+        self.data = load_data()
+        self.calculator = CorfuncCalculator(data=self.data, lowerq=0.013,
+            upperq=(0.15, 0.24))
+        self.extrapolation = None
+
+    def extrapolate(self):
+        params, extrapolation = self.calculator.compute_extrapolation()
+
+        # Check the extrapolation parameters
+        self.assertAlmostEqual(params['A'], 4.19, places=2)
+        self.assertAlmostEqual(params['B'], -25470, places=0)
+        self.assertAlmostEqual(params['K'], 4.5e-5, places=2)
+        self.assertAlmostEqual(params['sigma'], 2.2e-10, places=2)
+
+        # Ensure the extraplation tends to the background value
+        self.assertAlmostEqual(extrapolation.y[-1], self.calculator.background)
+
+        # Test extrapolation for q values between 0.02 and 0.24
+        mask = np.logical_and(self.data.x > 0.02, self.data.x < 0.24)
+        qs = self.data.x[mask]
+        iqs = self.data.y[mask]
+
+        for q, iq in zip(qs, iqs):
+            # Find the q value in the extraplation nearest to the value in
+            # the data
+            q_extrap = min(extrapolation.x, key=lambda x:abs(x-q))
+            # Find the index of this value in the extrapolation
+            index = list(extrapolation.x).index(q_extrap)
+            # Find it's corresponding intensity value
+            iq_extrap = extrapolation.y[index]
+            # Check the extrapolation agrees to the data at this point to 1 d.p
+            self.assertAlmostEqual(iq_extrap, iq, 1)
+
+        self.extrapolation = extrapolation
+
+    def transform(self):
+        self.calculator.compute_transform(self.extrapolation, 'fourier',
+            completefn=self.transform_callback)
+        # Transform is performed asynchronously; give it time to run
+        while True:
+            time.sleep(0.001)
+            if not self.calculator.transform_isrunning():
+                break
+
+    def transform_callback(self, transform):
+        self.assertIsNotNone(transform)
+        self.assertAlmostEqual(transform.y[0], 1)
+        self.assertAlmostEqual(transform.y[-1], 0, 5)
+        self.transformation = transform
+
+    def extract_params(self):
+        params = self.calculator.extract_parameters(self.transformation)
+        self.assertIsNotNone(params)
+        self.assertEqual(len(params), 6)
+        self.assertLess(abs(params['max']-75), 2.5) # L_p ~= 75
+
+
+    # Ensure tests are ran in correct order;
+    # Each test depends on the one before it
+    def test_calculator(self):
+        steps = [self.extrapolate, self.transform, self.extract_params]
+        for test in steps:
+            try:
+                test()
+            except Exception as e:
+                self.fail("{} failed ({}: {})".format(test, type(e), e))
+
+
+def load_data(filename="98929.txt"):
+    data = np.loadtxt(filename, dtype=np.float32)
+    q = data[:,0]
+    iq = data[:,1]
+    return Data1D(x=q, y=iq)
+
+if __name__ == '__main__':
+    unittest.main()
