Changeset 6e74ee4 in sasview for Invariant


Ignore:
Timestamp:
Dec 18, 2009 3:43:36 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:
85b3971
Parents:
25a92d1
Message:

added fitfunctor.fit tests without errorbar data

Location:
Invariant/test
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • Invariant/test/utest_use_cases.py

    rc8c4fa1 r6e74ee4  
    1818        self.data = Loader().load("linefittest.txt") 
    1919         
    20     def test_fit_line_data_nosigma(self): 
     20    def test_fit_line_data(self): 
    2121        """  
    2222            Fit_Test_1: test linear fit, ax +b, without fixed 
     
    3434 
    3535 
    36     def test_fit_line_data_sigma(self): 
     36    def test_fit_line_data_fixed(self): 
    3737        """  
    3838            Fit_Test_2: test linear fit, ax +b, with 'a' fixed 
     
    4949        self.assertAlmostEquals(b, -4.0676,3) 
    5050         
     51class TestLineFitNoweight(unittest.TestCase): 
     52    """ 
     53        Test Line fit without weight(dy data) 
     54    """ 
     55    def setUp(self): 
     56        self.data = Loader().load("linefittest_no_weight.txt") 
     57         
     58    def test_fit_line_data_no_weight(self): 
     59        """  
     60            Fit_Test_1: test linear fit, ax +b, without fixed 
     61        """ 
     62         
     63        # Create invariant object. Background and scale left as defaults. 
     64        fit = invariant.FitFunctor(data=self.data) 
     65         
     66        ##Without holding 
     67        a,b = fit.fit(power=None) 
     68 
     69        # Test results 
     70        self.assertAlmostEquals(a, 2.4727,3) 
     71        self.assertAlmostEquals(b, 0.6,3) 
     72 
     73 
     74    def test_fit_line_data_fixed_no_weight(self): 
     75        """  
     76            Fit_Test_2: test linear fit, ax +b, with 'a' fixed 
     77        """ 
     78         
     79        # Create invariant object. Background and scale left as defaults. 
     80        fit = invariant.FitFunctor(data=self.data) 
     81         
     82        #With holding a = -power =4 
     83        a,b = fit.fit(power=-4) 
     84 
     85        # Test results 
     86        self.assertAlmostEquals(a, 4) 
     87        self.assertAlmostEquals(b, -7.8,3) 
     88                 
    5189class TestInvPolySphere(unittest.TestCase): 
    5290    """ 
Note: See TracChangeset for help on using the changeset viewer.