Changeset 43c0a8e in sasview for pr_inversion/test
- Timestamp:
- May 23, 2008 10:55:39 AM (17 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- dfb58f8
- Parents:
- eb06cbe
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pr_inversion/test/utest_invertor.py
rf71287f4 r43c0a8e 11 11 from sans.pr.invertor import Invertor 12 12 13 class TestFiguresOfMerit(unittest.TestCase): 14 15 def setUp(self): 16 self.invertor = Invertor() 17 self.invertor.d_max = 100.0 18 19 # Test array 20 self.ntest = 5 21 self.x_in = numpy.ones(self.ntest) 22 for i in range(self.ntest): 23 self.x_in[i] = 1.0*(i+1) 24 25 x, y, err = load("sphere_80.txt") 26 27 # Choose the right d_max... 28 self.invertor.d_max = 160.0 29 # Set a small alpha 30 self.invertor.alpha = .0007 31 # Set data 32 self.invertor.x = x 33 self.invertor.y = y 34 self.invertor.err = err 35 # Perform inversion 36 #out, cov = self.invertor.invert(10) 37 38 self.out, self.cov = self.invertor.lstsq(10) 39 40 def test_positive(self): 41 """ 42 Test whether P(r) is positive 43 """ 44 self.assertEqual(self.invertor.get_positive(self.out), 1) 45 46 def test_positive_err(self): 47 """ 48 Test whether P(r) is at least 1 sigma greater than zero 49 for all r-values 50 """ 51 self.assertTrue(self.invertor.get_pos_err(self.out, self.cov)>0.9) 52 13 53 class TestBasicComponent(unittest.TestCase): 14 54 … … 236 276 print "chi2(P(r)) =", chi2/51.0 237 277 raise 278 279 # Test the number of peaks 280 self.assertEqual(self.invertor.get_peaks(out), 1) 238 281 239 282 def test_q_zero(self):
Note: See TracChangeset
for help on using the changeset viewer.