Changeset c8c4fa1 in sasview for Invariant


Ignore:
Timestamp:
Dec 18, 2009 12:49:00 PM (14 years ago)
Author:
Jae Cho <jhjcho@…>
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:
25a92d1
Parents:
eb62193
Message:

Added linear fit tests with/without holding the slope

Location:
Invariant/test
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • Invariant/test/utest_use_cases.py

    r0957dbdb rc8c4fa1  
    1111    print "I am not of type Dataloader.Data1D" 
    1212     
     13class TestLineFit(unittest.TestCase): 
     14    """ 
     15        Test Line fit  
     16    """ 
     17    def setUp(self): 
     18        self.data = Loader().load("linefittest.txt") 
     19         
     20    def test_fit_line_data_nosigma(self): 
     21        """  
     22            Fit_Test_1: test linear fit, ax +b, without fixed 
     23        """ 
     24         
     25        # Create invariant object. Background and scale left as defaults. 
     26        fit = invariant.FitFunctor(data=self.data) 
     27         
     28        ##Without holding 
     29        a,b = fit.fit(power=None) 
     30 
     31        # Test results 
     32        self.assertAlmostEquals(a, 2.3983,3) 
     33        self.assertAlmostEquals(b, 0.87833,3) 
     34 
     35 
     36    def test_fit_line_data_sigma(self): 
     37        """  
     38            Fit_Test_2: test linear fit, ax +b, with 'a' fixed 
     39        """ 
     40         
     41        # Create invariant object. Background and scale left as defaults. 
     42        fit = invariant.FitFunctor(data=self.data) 
     43         
     44        #With holding a = -power =4 
     45        a,b = fit.fit(power=-4) 
     46 
     47        # Test results 
     48        self.assertAlmostEquals(a, 4) 
     49        self.assertAlmostEquals(b, -4.0676,3) 
     50         
    1351class TestInvPolySphere(unittest.TestCase): 
    1452    """ 
Note: See TracChangeset for help on using the changeset viewer.