Index: pr_inversion/test/test_output.txt
===================================================================
--- pr_inversion/test/test_output.txt	(revision f71287f458148547d69aae7ddc900f1afde663f6)
+++ pr_inversion/test/test_output.txt	(revision f71287f458148547d69aae7ddc900f1afde663f6)
@@ -0,0 +1,117 @@
+#d_max=160
+#nfunc=10
+#alpha=0.0007
+#chi2=16654.1
+#elapsed=0
+#alpha_estimate=2.23431
+#C_0=1254.55002508+-12.0889464446
+#C_1=386.59602793+-62.4851961458
+#C_2=5.10066421813+-235.84586924
+#C_3=48.454288318+-1217.94687676
+#C_4=0.4174373785+-213577.449972
+#C_5=17.3551976035+-2673.36274352
+#C_6=-0.228001082457+-692.661759936
+#C_7=1.95934734382+-332.134754291
+#C_8=-0.885447495+-200.862052487
+#C_9=0.401866788245+-137.064680609
+<r>  <Pr>  <dPr>
+0  0  0
+1.6  236.371  235.678
+3.2  943.103  930.744
+4.8  2113.12  2049.82
+6.4  3734.86  3535.61
+8  5792.64  5311.37
+9.6  8267.09  7284.04
+11.2  11135.7  9348.1
+12.8  14373.5  11389.7
+14.4  17953.5  13291.4
+16  21847.7  14936.2
+17.6  26027.5  16212.7
+19.2  30464.2  17019.1
+20.8  35129.9  17267.8
+22.4  39997.6  16889.2
+24  45041.7  15836.1
+25.6  50238.2  14088.7
+27.2  55565.1  11662.9
+28.8  61002  8635.92
+30.4  66530.4  5281.73
+32  72133.5  3272.64
+33.6  77796  6067.26
+35.2  83503.6  10814.7
+36.8  89243.2  16028.2
+38.4  95001.9  21350.2
+40  100767  26561.2
+41.6  106527  31468
+43.2  112267  35887.3
+44.8  117975  39646.4
+46.4  123636  42586.2
+48  129233  44565.8
+49.6  134751  45467.6
+51.2  140171  45201.5
+52.8  145473  43709.8
+54.4  150638  40971.1
+56  155645  37005.5
+57.6  160473  31882.9
+59.2  165101  25742.1
+60.8  169508  18857.3
+62.4  173675  11970.1
+64  177583  8265.15
+65.6  181215  12750.9
+67.2  184556  21038.7
+68.8  187595  30104.6
+70.4  190321  39131.5
+72  192727  47705.7
+73.6  194808  55513.2
+75.2  196563  62282.7
+76.8  197991  67775.3
+78.4  199093  71784.5
+80  199873  74140.4
+81.6  200335  74714.1
+83.2  200484  73422.4
+84.8  200325  70232.5
+86.4  199862  65166
+88  199101  58304.9
+89.6  198044  49801.3
+91.2  196695  39903.5
+92.8  195056  29050.8
+94.4  193129  18346.5
+96  190915  12397.7
+97.6  188414  18724.8
+99.2  185629  30770.1
+100.8  182559  43834
+102.4  179206  56683.4
+104  175572  68726.9
+105.6  171661  79534.1
+107.2  167475  88745.8
+108.8  163019  96054.4
+110.4  158298  101203
+112  153320  103987
+113.6  148091  104262
+115.2  142620  101947
+116.8  136919  97026.9
+118.4  130998  89560.4
+120  124872  79680.9
+121.6  118558  67605.7
+123.2  112075  53655.8
+124.8  105448  38339.4
+126.4  98705.1  22821
+128  91877.8  13090.4
+129.6  85003.8  22520.4
+131.2  78125.5  39345.4
+132.8  71289.5  56946.4
+134.4  64546.5  73969.2
+136  57949.9  89741.1
+137.6  51554.5  103751
+139.2  45414.9  115564
+140.8  39583.1  124808
+142.4  34106.6  131176
+144  29025.7  134426
+145.6  24371.3  134390
+147.2  20162.8  130981
+148.8  16406  124194
+150.4  13091.6  114114
+152  10194.5  100912
+153.6  7673.45  84850.4
+155.2  5471.36  66272.7
+156.8  3516.48  45601.3
+158.4  1724.23  23326.7
Index: pr_inversion/test/utest_invertor.py
===================================================================
--- pr_inversion/test/utest_invertor.py	(revision 2d06beb109031c888260d5a73af0ae5e57628b01)
+++ pr_inversion/test/utest_invertor.py	(revision f71287f458148547d69aae7ddc900f1afde663f6)
@@ -333,4 +333,46 @@
         for i in range(len(self.x_in)):
             self.assertEqual(self.x_in[i], clone.x[i])
+        
+    def test_save(self):
+        x, y, err = load("sphere_80.txt")
+
+        # Choose the right d_max...
+        self.invertor.d_max = 160.0
+        # Set a small alpha
+        self.invertor.alpha = .0007
+        # Set data
+        self.invertor.x   = x
+        self.invertor.y   = y
+        self.invertor.err = err
+        # Perform inversion
+        
+        out, cov = self.invertor.lstsq(10)
+        
+        # Save
+        self.invertor.to_file("test_output.txt")
+    
+    def test_load(self):
+        self.invertor.from_file("test_output.txt")
+        self.assertEqual(self.invertor.d_max, 160.0)
+        self.assertEqual(self.invertor.alpha, 0.0007)
+        self.assertEqual(self.invertor.chi2, 16654.1)
+        self.assertAlmostEqual(self.invertor.pr(self.invertor.out, 10.0), 8948.22689927, 4)
+        
+    def test_qmin(self):
+        self.invertor.q_min = 1.0
+        print self.invertor.q_min
+        self.assertEqual(self.invertor.q_min, 1.0)
+        
+        self.invertor.q_min = None
+        self.assertEqual(self.invertor.q_min, None)
+        
+                         
+    def test_qmax(self):
+        self.invertor.q_max = 1.0
+        self.assertEqual(self.invertor.q_max, 1.0)
+       
+        self.invertor.q_max = None
+        self.assertEqual(self.invertor.q_max, None)
+
         
 def pr_theory(r, R):
