Changeset 90e5ca1 in sasview for Invariant/test/utest_use_cases.py


Ignore:
Timestamp:
Mar 17, 2010 9:01:04 PM (15 years ago)
Author:
Gervaise Alina <gervyh@…>
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:
9ce7641c
Parents:
43e685d
Message:

modify invariant to get the fitted power
add another unittest that fail in both gui and computation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Invariant/test/utest_use_cases.py

    rbdd162f r90e5ca1  
    237237        self.assertAlmostEquals(s , 941.7452, 3) 
    238238       
    239    
     239    def test_use_case_6(self): 
     240        """ 
     241            Invariant with high-Q extrapolation 
     242        """ 
     243        # Create invariant object. Background and scale left as defaults. 
     244        inv = invariant.InvariantCalculator(data=self.data) 
     245         
     246        # Set the extrapolation parameters for the high-Q range 
     247        inv.set_extrapolation(range='low', npts=10, function='power_law', power=4) 
     248         
     249        # The version of the call without error 
     250        # The function parameter defaults to None, then is picked to be 'power_law' for extrapolation='high' 
     251        qstar = inv.get_qstar(extrapolation='low') 
     252         
     253        # The version of the call with error 
     254        qstar, qstar_err = inv.get_qstar_with_error(extrapolation='low') 
     255 
     256        # Get the volume fraction and surface 
     257        v, dv = inv.get_volume_fraction_with_error(contrast=2.6e-6) 
     258        s, ds = inv.get_surface_with_error(contrast=2.6e-6, porod_const=2) 
     259         
     260        # Test results 
     261        self.assertAlmostEquals(qstar, 7.49e-5,2) 
     262        self.assertAlmostEquals(v, 0.005952674, 3) 
     263        self.assertAlmostEquals(s , 941.7452, 3) 
     264         
    240265class TestInvPinholeSmear(unittest.TestCase): 
    241266    """ 
Note: See TracChangeset for help on using the changeset viewer.